Category Error when using FitGLME
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
So I have several data sets with ordtinal and categorical values, I see no big difference in them. However, some of hese data sets give no errors while others give me this strange value for which I can find no explanation. Anyone have this issue? By the way, taking out that categorical variable didn't solve the issue.
Thanks!
Error using categorical (line 434)
Unable to create default category names. Specify category names using the CATEGORYNAMES input argument.
Error in nominal (line 152)
b = b@categorical(a,args{:},'Ordinal',false);
Error in classreg.regr.LinearLikeMixedModel/makeInteractionVar (line 806)
G = nominal(ds.(interactionVars{1}));
Error in classreg.regr.LinearLikeMixedModel/extractGroupingInfo (line 205)
model.makeInteractionVar(ds,interactionVars);
Error in GeneralizedLinearMixedModel.fit (line 2377)
model.GroupingInfo = extractGroupingInfo(model,dssubset);
Error in fitglme (line 398)
glme = GeneralizedLinearMixedModel.fit(T,formula,varargin{:});
Error in GLMFinal (line 35)
glmeVw2 = fitglme(bat1,'Vw ~ Td + (1|ThetaX) + (1|ThetaY) + (1|ThetaZ)','FitMethod','Laplace')
3 Commenti
Walter Roberson
il 18 Dic 2020
Do the variable names Vw, Td, ThetaX, ThetaY, and ThetaZ all exist in your table bat1 ?
Risposte (1)
Sam Litvin
il 18 Dic 2020
2 Commenti
Ive J
il 18 Dic 2020
I could not reproduce your error for both datasets you mentioned:
head(t1)
ThetaX ThetaY ThetaZ Td Vd Vw Hw Hd Ld Lw
________ _______ _______ _______ _______ ____ ____ _______ ______ ____
1.2333 1.2445 0.52498 0.53232 6.5127 34.5 71.5 -15.891 NaN NaN
1.6859 2.1313 0.93286 0.90519 6.5127 37.5 NaN NaN NaN NaN
1.3092 0.5145 3.7508 0.58472 29.102 41 55 -15.891 NaN NaN
-0.52485 1.4835 4.1045 1 29.102 37 NaN NaN NaN NaN
-11.536 -4.3153 13.498 0 36.438 38 NaN NaN NaN NaN
-4.6048 -3.5271 7.2064 0.55741 14.538 41.5 NaN NaN NaN NaN
13.477 -2.3554 2.5966 0 -1.105 39 35 15.911 15.182 14.5
26.936 -4.7887 5.1617 0.84217 -18.806 40 39 15.911 15.182 37.5
mdl1 = fitglme(t1,'Vw ~ Td + (1|ThetaX) + (1|ThetaY) + (1|ThetaZ)','FitMethod','Laplace'); % no error
mdl1
Generalized linear mixed-effects model fit by ML
Model information:
Number of observations 22
Fixed effects coefficients 2
Random effects coefficients 65
Covariance parameters 4
Distribution Normal
Link Identity
FitMethod Laplace
Formula:
Vw ~ 1 + Td + (1 | ThetaX) + (1 | ThetaY) + (1 | ThetaZ)
Model fit statistics:
AIC BIC LogLikelihood Deviance
133.39 139.94 -60.696 121.39
Fixed effects coefficients (95% CIs):
Name Estimate SE tStat DF
{'(Intercept)'} 38.1 2.2593 16.864 20
{'Td' } -3.1335 3.2122 -0.97551 20
pValue Lower Upper
2.7251e-13 33.388 42.813
0.34096 -9.834 3.567
Random effects covariance parameters:
Group: ThetaX (22 Levels)
Name1 Name2 Type
{'(Intercept)'} {'(Intercept)'} {'std'}
Estimate
0.67125
Group: ThetaY (22 Levels)
Name1 Name2 Type
{'(Intercept)'} {'(Intercept)'} {'std'}
Estimate
0.67125
Group: ThetaZ (21 Levels)
Name1 Name2 Type
{'(Intercept)'} {'(Intercept)'} {'std'}
Estimate
3.7062
Group: Error
Name Estimate
{'sqrt(Dispersion)'} 0.98473
also for second dataset:
head(t2)
ThetaX ThetaY ThetaZ Td Vd Vw Hw Hd Ld Lw Ph
_________ ________ ________ ________ ______ ____ ____ _______ ______ ____ __
1.1022 -1.0173 0.067847 0.60151 31.072 45 60.5 -16.492 NaN NaN 0
1.2061 -1.0606 0.16396 1 15.428 44.5 62.5 -16.492 NaN NaN 0
0.97804 -1.0005 0.19531 0.27491 6.9766 39.5 36.5 -16.492 NaN NaN 0
0.76398 -0.97725 0.1889 0 6.9766 41.5 12.5 -16.492 NaN NaN 0
0.0093436 0.27112 0.17762 0.099879 6.9766 29.5 34.5 -16.492 24.472 59.5 0
-0.059496 0.4879 0.39032 0.21028 22.845 34 85.5 -16.492 NaN NaN 0
0.12878 0.50104 0.34031 0.32137 31.072 12 14 -16.492 NaN NaN 0
-0.040724 0.63091 0.40665 0.20183 6.9766 23.5 35.5 -16.492 NaN NaN 0
mdl2 = fitglme(t2,'Vw ~ Td + (1|ThetaX) + (1|ThetaY) + (1|ThetaZ)','FitMethod','Laplace'); % no error
mdl2
Generalized linear mixed-effects model fit by ML
Model information:
Number of observations 30
Fixed effects coefficients 2
Random effects coefficients 90
Covariance parameters 4
Distribution Normal
Link Identity
FitMethod Laplace
Formula:
Vw ~ 1 + Td + (1 | ThetaX) + (1 | ThetaY) + (1 | ThetaZ)
Model fit statistics:
AIC BIC LogLikelihood Deviance
253.16 261.56 -120.58 241.16
Fixed effects coefficients (95% CIs):
Name Estimate SE tStat DF
{'(Intercept)'} 32.695 3.6806 8.883 28
{'Td' } -2.3505 8.4533 -0.27805 28
pValue Lower Upper
1.2288e-09 25.155 40.234
0.78301 -19.666 14.965
Random effects covariance parameters:
Group: ThetaX (30 Levels)
Name1 Name2 Type
{'(Intercept)'} {'(Intercept)'} {'std'}
Estimate
6.7341
Group: ThetaY (30 Levels)
Name1 Name2 Type
{'(Intercept)'} {'(Intercept)'} {'std'}
Estimate
6.7341
Group: ThetaZ (30 Levels)
Name1 Name2 Type
{'(Intercept)'} {'(Intercept)'} {'std'}
Estimate
6.7341
Group: Error
Name Estimate
{'sqrt(Dispersion)'} 6.7341
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!