How to create a Coefficent table for regression analysis

5 次查看(过去 30 天)
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 个评论
Chimezie Umezie
Chimezie Umezie 2012-9-25
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

请先登录,再进行评论。

采纳的回答

Tom Lane
Tom Lane 2012-9-25
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.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by