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 CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by