Manual Weighted Least Squares Estimation

4 visualizaciones (últimos 30 días)
Chris Herdelin
Chris Herdelin el 17 de Jun. de 2020
Comentada: Chris Herdelin el 19 de Jun. de 2020
I have estimated WLS manually by dividing each of the coefficients by income^0.5. My question is, when I do that, does it automatically divde the constant by income^0.5? If not, how would I add 1/income^0.5 for the constant? Would I just create a variable for 1/income^2 and then add it to the matrix where I have all of my coefficents? Any help you could give would be greatly appreciated!

Respuestas (1)

Ajit Kasturi
Ajit Kasturi el 18 de Jun. de 2020
Assuming that you are asking whether division of each element of the matrix works, Yes it does. You can divide/add the constant (in your case it is 1/income^2) element-wise to a matrix as shown below.
Income = 2;
x= [1 2 3; 2 3 4; 4 5 6];
c= income^2;
Y=x/c;
For more information, refer the following link:
  2 comentarios
Chris Herdelin
Chris Herdelin el 18 de Jun. de 2020
Thanks so much! Ok. That makes sense. Then how do I include the constatn when performing the regression mdl = fitlm(X,Y)? Doesn't the regression automatically calculate the constant? How do I incorporate the constant 1/income^2 into the regression equation? Thanks again!
Chris Herdelin
Chris Herdelin el 19 de Jun. de 2020
Income = 2;
x= [1 2 3; 2 3 4; 4 5 6];
c= income^2;
Y=x/c;
Error using ^ (line 51)
Incorrect dimensions for raising a matrix to a power.
Check that the matrix is square and the power is a
scalar. To perform elementwise matrix powers, use
'.^'.

Iniciar sesión para comentar.

Categorías

Más información sobre Support Vector Machine Regression en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by