How to create a Coefficent table for regression analysis

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

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일

0 개 추천

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