a simple question about linear regression

2 ビュー (過去 30 日間)
Fred
Fred 2014 年 3 月 2 日
コメント済み: Image Analyst 2014 年 3 月 2 日
Hi, I have a n*2 matrix named Y which has two columns; the first column is my observation values and the second column is the probability associated with the observation value in the same row of the first column. Now If I have a set of probabilities let's call it Z(n*1) how can I fined a value for each probability with linear regression of Y values?

採用された回答

Image Analyst
Image Analyst 2014 年 3 月 2 日
編集済み: Image Analyst 2014 年 3 月 2 日
Try this (untested)
% Find regression formula:
value = Y(:, 1); % Value
p = Y(:, 2); % Probability
coefficients = polyfit(value, p, 3); % Fit 2rd order polynomial
% Now get estimate for some values Z
% Z is a n by 1 array of a bunch of values.
estimated_p = polyval(coefficients, Z)
If you want interpolation instead of regression, you can use interp1(). Just say what you want.
  1 件のコメント
Image Analyst
Image Analyst 2014 年 3 月 2 日
Note, in case you didn't know, because a lot of people don't, even a 3rd or 10th order polynomial is a linear regression because it's linear in the coefficients , which is what counts, rather than linear in the x value.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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