Error in StandardGeneralizedLinearMixedModel/validateyRange
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Naya Polychroni
il 12 Feb 2020
Hi Laurie,
Did you manage to solve this? I am having the same problem.
Risposte (3)
Naya Polychroni
il 12 Feb 2020
Hi Laurie,
Did you manage to solve this? I am having the same problem.
1 Commento
Paul
il 20 Lug 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.
Paul
il 20 Lug 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.
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!