Borrar filtros
Borrar filtros

Store logistic regression models in an array?

3 visualizaciones (últimos 30 días)
shane
shane el 19 de Sept. de 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!

Respuesta aceptada

Shashank Prasanna
Shashank Prasanna el 20 de Sept. de 2013
Editada: Shashank Prasanna el 20 de Sept. de 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 comentario
shane
shane el 20 de Sept. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by