フィルターのクリア

Adding command to find p-value to script

2 ビュー (過去 30 日間)
Imre
Imre 2015 年 4 月 20 日
回答済み: Star Strider 2015 年 4 月 20 日
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);

回答 (1 件)

Star Strider
Star Strider 2015 年 4 月 20 日
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.

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by