Adding command to find p-value to script
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello. I need help with a piece of script that I have. I didn't make it myself. I am unable to contact the person who made it at the moment. I wonder if anyone could help me out in here. I understand that those lines calculate the regression values. I was wondering if I could add a line that would also calculate the p-value for my dataset? I understand that the command for finding the p-value is something like [R,P]=CORRCOEF(...) but I wouldn't know how to add that to the script.
for i = 1:nseq
i;
fit_data = NEW((i-1)* diff +1:(i)*diff,:);
CH4_slope = polyfit(fit_vector(1:end,1),fit_data(1:end,7),Regression_model); % regression stats is rendered as "a b c" parameter.
yfit_CH4 = polyval (CH4_slope,fit_vector(1:end,1));
yresid_CH4 = (fit_data(1:end,7)) - yfit_CH4;
SSresid_CH4 = sum(yresid_CH4.^2);
SStotal_CH4 = (length(fit_data(1:end,7))-1)* var(fit_data(1:end,7));
rsg_CH4 = 1 - SSresid_CH4/SStotal_CH4;
% rsg_CH4_adj = rsg_CH4 * (length(fit_data(1:end,10))-1)/(length(fit_data(1:end,10))-length(CH4_slope)-1);
0 Commenti
Risposte (1)
Star Strider
il 20 Apr 2015
Guessing here, but it looks as though it is calculating the adjusted R² value. I refer you to the Wikipedia article on Coefficient of determination for an explanation.
The p-value is a different discussion. See the ‘See also’ section at the end of that Wikipedia article for links to relevant articles.
0 Commenti
Vedere anche
Categorie
Scopri di più su Statistics and Machine Learning Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!