How to obtain p-values from a multivariable regression using the mvregress function?

17 次查看(过去 30 天)
I have a multivariable regression model I fit using mvregress. There are 6 response variables and 9 predictor variables, which gives me a total of 60 regression coefficients (1 intercept + 9 variables). The code I have runs without error, I just want to make sure I am calculating my p-values correctly given what MATLAB spits out for results. Here is what I have:
[beta, sigma, E, V] = mvregress(Xcell,doseDifferences); %Fitting the regression model
beta %Spitting out my regression coefficients
se = sqrt(diag(V)) %standard error calculation, V is the covariance matrix
dof = n-9-1; %degrees of freedom calculation (n observations, 9 predictor variables)
tRatio = beta./se; %Calculating t-statistic
pVals = 2*(1-tcdf(abs(tRatio),dof)); %Calculating my p-values
When I run this, my p-values make sense for the most part but some of the p-values don't seem correct. Am I calcualting the p-values correctly? Are my degrees of freedom calculated correctly?
  1 个评论
Star Strider
Star Strider 2022-7-18
The mvregress documentation links to manova1, so that would be where I would begin to find the relevant statistics. (I’m not posting this as an answer because I don’t have any recent experience with either function.) I’m surprised that something similar to fitlm (not applicable here) that produces nice summary statistics tables doesn’t exist for mvregress.

请先登录,再进行评论。

回答(1 个)

Rangesh
Rangesh 2023-10-13
Hi Brett,
I see that you are working on calculating p-values for multivariate linear regression. In your scenario, you have 6 response variables and 9 predictor variables, which leads to a total of 60 regression coefficients. To accurately calculate the degrees of freedom, you should use the formula dof = n - p - 1, where p represents the total number of coefficients (60 in your case). This discrepancy in calculating the degrees of freedom could have caused the discrepancy in the p-values.
I hope this resolves your query.
With regards,
Rangesh P

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by