MATLAB: How to create a Coefficent table for regression analysis

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

Best Answer

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.