Error in StandardGe​neralizedL​inearMixed​Model/vali​dateyRange

3 vues (au cours des 30 derniers jours)
Laurie
Laurie le 31 Jan 2018
Réponse apportée : Paul le 20 Juil 2020
I'm trying to fit a GLME model to proportion data. There are no NaNs, the response variable is in [0 1], and manually computing counts shows a vector of integers. Yet, running the following command generates an error in StandardGeneralizedLinearMixedModel/validateyRange on line 666:
weigths = ones(size(binomialsize));
fitglme(data2, 'y ~ x + (x|ID)','Distribution','binomial',...
'BinomialSize',binomialsize, 'Weights',weigths)
The full error is as follows:
Error using classreg.regr.lmeutils.StandardGeneralizedLinearMixedModel/validateyRange (line 666)
For Binomial distribution, the responses must be proportions, 'Weights' and 'BinomialSize' must be positive integers and the product of responses, 'Weights' and
'BinomialSize' must be integers.
Error in classreg.regr.lmeutils.StandardGeneralizedLinearMixedModel (line 4193)
validateyRange(sglme,sglme.y,binomialsize,weights,distribution);
Error in GeneralizedLinearMixedModel/fitStandardLMEModel (line 1317)
slme = classreg.regr.lmeutils.StandardGeneralizedLinearMixedModel(X,model.y,Zs,Psi,model.FitMethod,dofit,dostats,args{:});
Error in GeneralizedLinearMixedModel/fitter (line 891)
model.slme = fitStandardLMEModel(model);
Error in classreg.regr.FitObject/doFit (line 94)
model = fitter(model);
Error in GeneralizedLinearMixedModel.fit (line 2411)
model = doFit(model);
Error in fitglme (line 389)
glme = GeneralizedLinearMixedModel.fit(T,formula,varargin{:});
Manually running lines 663-667 in StandardGeneralizedLinearMixedModel using y, weights, and binomialsize as imputed to fitglme does not generate the error, in accordance with the above statement that the response variable should be valid.
What is going on? The response variable seems fine. I'm using Statistics and Machine Learning Toolbox Version 11.1 (R2017a)
  2 commentaires
Bernhard Suhm
Bernhard Suhm le 1 Fév 2018
Provide a sample of your data, see these instructions .
Naya Polychroni
Naya Polychroni le 12 Fév 2020
Hi Laurie,
Did you manage to solve this? I am having the same problem.

Connectez-vous pour commenter.

Réponses (3)

asc
asc le 4 Juil 2018
Were you able to run fitglme without error after this?

Naya Polychroni
Naya Polychroni le 12 Fév 2020
Hi Laurie,
Did you manage to solve this? I am having the same problem.
  1 commentaire
Paul
Paul le 20 Juil 2020
Solved. The response vector should not be proportions, it should be number of successes. The Matlab documentation is incorrect on this point, as is the code that produces the error.

Connectez-vous pour commenter.


Paul
Paul le 20 Juil 2020
Solved. The response vector should not be proportions, it should be number of successes. The Matlab documentation is incorrect on this point, as is the code that produces the error.

Community Treasure Hunt

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

Start Hunting!

Translated by