Effacer les filtres
Effacer les filtres

Store logistic regression models in an array?

3 vues (au cours des 30 derniers jours)
shane
shane le 19 Sep 2013
I have a for loop that creates a set of binary logistic regression models using the GeneralizedLinearModel.stepwise() function.
I need to store these models but I receive errors when I try to use an array or a structure to store them.
eg)
Output.Model(Model_Num) = GeneralizedLinearModel.stepwise()
"Error using classreg.regr.FitObject/subsref (line 710) Parentheses indexing is not allowed"
OR:
Model{Model_Num} = GeneralizedLinearModel.stepwise()
"Cell contents assignment to a non-cell array object."
OR:
Model(Model_Num) = GeneralizedLinearModel.stepwise()
"The following error occurred converting from GeneralizedLinearModel to double: Error using double Conversion to double from GeneralizedLinearModel is not possible."
But I don't think it works for logistic regression models varying number of parameters.
Is this perhaps not possible, in which case is my only option to use the count variable in the naming of the different models (I have read this is not advised). Thanks!

Réponse acceptée

Shashank Prasanna
Shashank Prasanna le 20 Sep 2013
Modifié(e) : Shashank Prasanna le 20 Sep 2013
mdl = GeneralizedLinearModel.stepwise(....)
Model{1} = mdl;
Model{2} = mdl;
Storing the models in a cell array works perfectly fine for me. Could you share your code so that we can see what's going wrong?
  1 commentaire
shane
shane le 20 Sep 2013
Thank you. The problem was that I was assigning the model directly to the array. I needed to store it to mdl first as you did above.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by