Finding P-Values with the Null Hypothesis Being a Coefficient Equal to 0
13 次查看(过去 30 天)
显示 更早的评论
Hello. I apologize because this is as much of a statistical question as it is a Matlab question but I am extremely lost and need some help. I have a 72x1 double (titled x) that is basically just 1948-2019 and I have another 72x1 (titled y) double that is has the numbers of days over a certain temperatures for the each of 72 years. I found the least-squares linear regression of the data by doing
p=polyfit(x,y,1);
slope=p(1)
intercept=p(2)
which give me a slope of -0.0254 and a y-intercept of 83.6282.
Now I need to find p-value with the null hypothesis being a coefficient equal to zero (neutral trend). Im gonna be honest I have zero clue how to do this. I am aware of p-values but I do not know how to go about this, please help!
0 个评论
回答(1 个)
Jeff Miller
2020-7-7
The easiest way is with the corr function, because the p value for the slope is the same as the p value for the correlation coefficient:
[rho, pvalue] = corr(x,y);
You should also look at a scattergram to make sure that it looks like a cloud of points with no outliers, etc
scatter(x,y)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Hypothesis Tests 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!