- "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
3 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Sai Pavan
on 17 Apr 2024
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 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!