Variable length & Stepwise regression

1 次查看(过去 30 天)
I want to create a dataset
A = dataset('File',Araa06.txt');
Matlab returens errors:
Misuse dataset/readFile (line 207) Variable lengths must all be the same.
Error dataset (line 351) a = readFile(a,fileArg,otherArgs)
What could be the problem?
If I want to use dataset A for stepwise regression
mdl=stepwiselm(A,'Predictor variables','DEM','grad','Response variable','Yield')
What is the different between this one and
stepwise
If I just want to do stepwise regression, do I really need to build a model?

采纳的回答

Roger Wohlwend
Roger Wohlwend 2014-9-19
If you copy the contents of your txt-file and paste it into an Excel file, you see that not all numbers are separated by a tab. Some are separated by blanks. I guess that is why Matlab cannot read the txt file properly. It expects all numbers to be separated by tabs. So you have to fix the txt file first.
For stepwise regression you can use either stepwiselm or stepwise. They are basically the same. The latter offers you a GUI, the first is a class. I would recommend stepwiselm. You don't need a GUI. Just work with the class.
  1 个评论
Yaojiayin
Yaojiayin 2014-9-19
Thanks for your reply! I fixed the problem by just copy the first row(name of variables) in the original data file (in form of .txt) to Araa06, and it worked (for some reason). Then I did stepwiselm and wrote a report to my teacher.
Thanks again for answering my question!

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by