フィルターのクリア

Least squares linear regression when squares have to do with elasticity?

2 ビュー (過去 30 日間)
J
J 2012 年 4 月 5 日
How can I calculate a least squares linear regression when squares have to do with elasticity?
Say in an ordinary least squares regression, a square distance from one point to the regression line is ydelta^2. I want the same ydelta distance to more important for some points than for others depending on elasticity functions for each points.
Is it possible to create this type of regression using a matlab formula? I am not a mathematician by trade.

回答 (1 件)

Richard Willey
Richard Willey 2012 年 4 月 5 日
Here's a simple example using the new regression functions in the 12a release. All you need to do is pass the appropriate weight vector in to the LinearModel function.
% Generate some data
X = 10 * rand(100,1);
Y = 5 + 3*X + randn(100,1);
% Assume a weight vector
temp = linspace(1, 50, 50);
temp = temp';
Weight_Vector = vertcat(temp, flipud(temp))
% Perform your regression
myFit = LinearModel.fit(X,Y, 'Weights', Weight_Vector)
plot(myFit)
FWIW, you can also pass weight vectors in to other regression functions, so if you're easier earlier versions of the Tbx you should be fine.

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by