After using mvregress, how can I find the rsquared value, t-values, p-values, F-statistic, and standard errors?

4 views (last 30 days)
After using mvregress, how can I find the rsquared value, t-values, p-values, F-statistic, standard errors and residual sum of squares? I have run a fixed effect regression using panel data. I have gotten my values for the intercept and slope parametres, however, now I want more information about the model and I'm not sure how to go about it. Any help on this one?

Answers (1)

Juan Zamora
Juan Zamora on 8 Mar 2015
Y = ChangePriceSqft;
X = [OneOverSqft, Baths, Distance];
% print scatter plot matrix againt sales
[H,AX,BigAx,P,PAx] = plotmatrix([Y,X],[Y,X]);
% regression model
X = [ones(n,1), X];
%[b, bint, r, rint, stats] = regress(Y, X);
[beta,Sigma,E,CovB,logL] = mvregress(X,Y);
Hypothesis = beta(1) + beta(2) * OneOverSqft + beta(3) * Baths + ...
beta(4) * Distance;
% r-squared
r2 = sum((Hypothesis - mean(Y)).^2) / sum((Y - mean(Y)).^2);
% number of explanatory variables
k = 3;
% Data from the Regression Model
% beta(1); % intercept
% beta(2); % 1/sqft
% beta(3); % baths
% beta(4); % distance
% model Standard Error
Se2 = sum((Y - beta(1) - beta(2) * OneOverSqft - beta(3) * Baths + ...
beta(4) * Distance).^2) / (n-k-1);
Se = sqrt(Se2);
% Partial Slopes - Standard Errors Bx
PartialStdErr = diag(sqrt(CovB)); % mvregress
%t-statistics (Beta / PartialStdErr)
tRatio = beta ./ PartialStdErr;
%p-values
pVals = 2*(1-tcdf(abs(tRatio),n-2));
% Summary Table of the Regression Model
RegressionSummary = [beta, PartialStdErr, tRatio, pVals];
  1 Comment
Juan Zamora
Juan Zamora on 11 Mar 2015
You can find the entire code with the csv file at https://github.com/zamoradev/ML/tree/master/MRM_HomePrices
There are more samples at: https://github.com/zamoradev/ML

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!