- "coefTest" function: https://ww.mathworks.com/help/stats/linearmodel.coeftest.html
- "fitlm" function: https://in.mathworks.com/help/stats/fitlm.html
Doubt about significance of regression
2 次查看(过去 30 天)
显示 更早的评论
Dear all, In an excel file, we have temperature (te) and humidity (hu) data in two columns. The Gaussian kernel-density estimation and best-fit quadratic curve were plotted. However, we need to determine whether the relationship is statistically significant or not, as well as the coefficient of determination (R2). For calulation of the both of them, we used functions like: 1. cofficient of determination R2= fitlm(te, hu) 2. statistically significant p= coefTest(lm) Is it correct? If not, please provide the any other suggestions.
Thank you.
0 个评论
回答(1 个)
Sai Pavan
2024-4-17
Hello Srinivas,
I understand that you want to confirm whether your method of determining statistical significance and R-square calculation is correct.
Your approach to determine the statistical significance is indeed correct. The "coefTest" function can be used to perform a hypothesis test on the coefficients of the linear model obtained from "fitlm" function. The null hypothesis for this test is that all coefficients associated with predictors (excluding the intercept) are zero. A low p-value (typically <0.05) would lead you to reject the null hypothesis, indicating that there is a statistically significant relationship between temperature and humidity. And to assess the relationship between temperature and humidity and calculate the coefficient of determination (R²), you can use the "fitlm" function, which fits a linear regression model.
Here is a code snippet that illustrates the same:
% Linear model fitting
lm = fitlm(te, hu);
disp(lm); % Display the summary
R2 = lm.Rsquared.Ordinary; % Coefficient of Determination (R²)
fprintf('Coefficient of Determination (R²): %f\n', R2);
% Statistical significance
p = coefTest(lm);
fprintf('P-value for statistical significance: %f\n', p);
Please refer to the below documentation to learn more about:
Hope it helps!
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!