Effacer les filtres
Effacer les filtres

How to create a Coefficent table for regression analysis

5 vues (au cours des 30 derniers jours)
Chimezie Umezie
Chimezie Umezie le 24 Sep 2012
I want to create a Coefficient table showing the Standard errors, P-value,t-statistics and the coefficient.
I have used the following algorithm:
D = x2fx(X, 'interaction'); b = regress(Y,D);
I tried using the following but I got an error message:
format short e t = stats.tstat; CoeffTable = dataset({t.beta,'coef'},{t.se,'StdErr'},{t.t,'tStat'},{t.pval,'pVal'})
Thank you
  1 commentaire
Chimezie Umezie
Chimezie Umezie le 25 Sep 2012
Here is the data: x1=[2198,6000,2198,6000, 2198,6000,2198,6000, 2198,6000,2198,6000, 2198,6000,2198,6000]'; x2=[2348,2348,4000,4000, 2348,2348,4000,4000, 2348,2348,4000,4000, 2348,2348,4000,4000]'; x3=[2348,2348,2348,2348,8000,8000,8000,8000, 2348,2348,2348,2348,8000,8000,8000,8000]'; x4=[2348,2348,2348,2348, 2348,2348,2348,2348,4078,4078,4078,4078, 4078,4078,4078,4078]'; X=[x1 x2 x3 x4 ]; Stress=[248,269,250,271,240,247,244,268,249,278,251,283,240,253,246,270]';
Below is the algorithm: D = x2fx(X, 'interaction'); b = regress(Stress,D); format short e t = stats.tstat; CoeffTable = dataset({t.beta,'coef'},{t.se,'StdErr'},{t.t,'tStat'},{t.pval,'pVal'})
The error message is: ??? Undefined variable "stats" or class "stats.tstat".
Thanks Tom

Connectez-vous pour commenter.

Réponse acceptée

Tom Lane
Tom Lane le 25 Sep 2012
What error message? You didn't define the variable stats in the code you provided, so I could imagine that might be a problem.
If you used regstats to calculate stats, then another potential problem is that x2fx inserts a column of ones, but regstats also inserts its own column of ones.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by