Is it possible to do multiple linear regression with constaint?

Hi, i'm trying to delete coefficients if they fail the t-test and if the Rsquared is 0,5. The only problem is that i don't know how!! I'm using LinearModel.fit because i need to keep an eye on the coefficient names (im using datasets). Thank you in advance!

3 件のコメント

José-Luis
José-Luis 2013 年 5 月 30 日
編集済み: José-Luis 2013 年 5 月 30 日
What have you tried so far? What problems have you encountered in your implementation?
Simon
Simon 2013 年 5 月 30 日
The problem so far is that I looped a LinearModel function using .coefficient only (from a dataset)so that i can track the coefficient names after i put the constraints. I'm trying to remove an answer if Rsquared if lower than 0,5 and if tstats are -1,96 < 0 < 1,96. It seems easy using the regress function but using LinearModel it seems like a pain. Everytime i try to remove an object in .Coefficients it says that it<s a read only mode...
Simon
Simon 2013 年 5 月 30 日
If i try to create a variable Fstat{i} = REG.Coefficients.tStat i will loose the Var names. With 4-5 var it isn<t much of a problem but with 50+ I won<t be able to understand the answer.

サインインしてコメントする。

 採用された回答

Tom Lane
Tom Lane 2013 年 5 月 30 日

0 投票

I don't really understand the question, but to the part where you express a desire to retain the variable names when you save the coefficients, you could try this:
Fstat{i} = REG.Coefficients(:,'tStat')
The difference is that ds.x fetches the variable x from the dataset ds, whereas ds(:,'x') creates a single-column dataset using only the column for x.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

質問済み:

2013 年 5 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by