Finding P-Values with the Null Hypothesis Being a Coefficient Equal to 0

8 views (last 30 days)
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!

Answers (1)

Jeff Miller
Jeff Miller on 7 Jul 2020
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)

Community Treasure Hunt

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

Start Hunting!