필터 지우기
필터 지우기

linear fit with fitlm or regress

조회 수: 4 (최근 30일)
Andreas Grøvan Aspaas
Andreas Grøvan Aspaas 2019년 5월 13일
댓글: Andreas Grøvan Aspaas 2019년 5월 15일
Hi
I have a data set of three variables. I want to use the equation y = a + b*temp + c*temp* sigma. When i write this like y~temp+(sigma*temp) in fitlm, I get 4 terms, Intercept, temp, sigma and temp:sigma.
My question is if sigma is the slope c and temp:sigma is temp*sigma for the c? I think this is correct, but I have not been able to figure out how the equation would look like based on the input arguments. The displayed "Linear regression model" is y ~1 + t*sigma
Thanks a lot!

채택된 답변

Jeff Miller
Jeff Miller 2019년 5월 14일
Your three variables are y, temp, and sigma? If I understand the model you want to fit, you might get a cleaner picture if you form a new variable:
prod = temp.*sigma;
and then use
y~temp+prod
  댓글 수: 5
Jeff Miller
Jeff Miller 2019년 5월 14일
Sorry, I just don't understand what model you are trying to fit. You say you are trying to get
y = (a0+b0*T) + (c0*sigma+d0*T)
but that does not look like a legitimate model to me as I said before.
Andreas Grøvan Aspaas
Andreas Grøvan Aspaas 2019년 5월 15일
Ok. It might not work. I was just thinking that I should be able to make whatever formula I wanted if I told matlab to make it.
I think the prod method you proposed works though. I do not get c0 and d0, but I get them both combined if I am not wrong. And this is enough as I just need to know how significant it is. It would be better to have them separated, but as I am not able to I am going to just accept it.
Thanks a lot for taking the time!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Regression에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by