How to get P value for coefficient of determination in the form of single answer (not in the matrix form)
8 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I wanted to calculate p value for R2 which i have obtained byusing this code.
yfit = polyval(p,W);
yresid = Wsim(:) - yfit;
SSresid = sum(yresid.^2);
SStotal = (length(Wsim(:))-1) * var(Wsim(:));
R(nok) = 1 - SSresid/SStotal;
I need code after this to calculate p value and i need in the form of single answer (not in the matrix)
I would be extremely gareful if somebody can help.
0 件のコメント
回答 (1 件)
Vatsal
2023 年 10 月 17 日
Hi,
I understand that you would like to calculate the p-value for 'R2' based on the provided code. To calculate the p-value for ‘R2’ in MATLAB, you can use utilize the following code:
df_regression = 1; % Linear model.
df_residual = length(Wsim(:)) - 2; % N - 2 degrees of freedom for residuals
F_statistic = (R(nok) / df_regression) / ((1 - R(nok)) / df_residual);
p_value = 1 - fcdf(F_statistic, df_regression, df_residual);
To learn more about “fcdf” usage and syntax, you may refer to the MathWorks documentation link below:
I hope this helps!
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!