フィルターのクリア

How to create a Coefficent table for regression analysis

5 ビュー (過去 30 日間)
Chimezie Umezie
Chimezie Umezie 2012 年 9 月 24 日
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 件)

カテゴリ

Help Center および File ExchangeModel Building and Assessment についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by