Clear Filters
Clear Filters

Weighted Least Square Regression

3 views (last 30 days)
Raziur Rahman
Raziur Rahman on 5 Jun 2015
Answered: Star Strider on 6 Jun 2015
I have a x matrix with 5 columns and Y matrix with one column of values. I want to minimize this function for all observations:sum(y-sum(alpha*x))^2. Which function can do this thing? I want to have the values of alpha and sum of alpha will be one.

Answers (1)

Star Strider
Star Strider on 6 Jun 2015
I don’t understand your equation. Weighted least squares requires:
WSSCF = sum(w.*(y-f(x)).^2); % Weighted Least Squares Cost Function
where ‘w’ is the vector of weights, and f(x) is actually a function of ‘x’ that maps ‘x’ to ‘y’. (This is schematic only. The actual function f(b,x) is a function of the parameters ‘b’ as well.
There are several linear and nonlinear parameter estimation functions that can do what you want, but the one you use depends on the nature of your data, the toolboxes you have available, and the model you want to use to fit it.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!