[R-sig-ME] GAMM versus glmmTMB
dani
orchidn @ending from live@com
Wed May 23 08:28:20 CEST 2018
Hello everyone,
I am working with a GAMM model with two random groups and two splines. Please see below. The results indicate that var9 has a linear association with the DV, therefore I decided to run another model without splines: a glmmTMB model - so I could also run a zero inflated model (not shown here); I replaced variable v1 (age, which displayed a quadratic association with the DV) with a categorical variable based on 3 age groups I was interested in.
I was surprised to see that the results differed - for instance var8 is approaching significance in the glmmTMB model.
My question is: should I stick with the GAMM model and remove the spline for var9 and run the GAMM again and present those results or should I proceed with the glmmTMB model. I would like to use the glmmTMB model to be able to compare the fit for the zero inflated and simple Poisson models.
Thank you very much!
Best,
Dani
br5f<- gamm(Num_admiss ~ s(var1)+var2 + var3 + var4 + var5+
var6+ var7+var8+s(VAR9)+offset(lexpfn), random=list(GROUPA=~1, groupB=~1), niterPQL=100,family=quasipoisson, data=may21Omi)
summary(br5f)
plot(br5f$gam,pages=1)
summary(br5f$gam)
# Family: quasipoisson
# Link function: log
#
# Formula:
# Num_admiss ~ s(var1) + var2 + var3 + VAR4 +
# var5 + var6 + var7 + var8 + s(VAR9) + offset(lexpfn)
#
# Parametric coefficients:
# Estimate Std. Error t value Pr(>|t|)
# (Intercept) -7.82201 1.47685 -5.296 1.32e-07 ***
# var2M 0.06554 0.16972 0.386 0.6994
# var31 0.10356 0.18420 0.562 0.5741
# VAR41 -0.05777 0.20573 -0.281 0.7789
# var5 0.11638 0.04644 2.506 0.0123 *
# var6 0.02036 0.03520 0.578 0.5630
# var7 -0.09351 0.06160 -1.518 0.1292
# var8 -0.03119 0.04293 -0.726 0.4676
# ---
# Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1
#
# Approximate significance of smooth terms:
# edf Ref.df F p-value
# s(var1) 2.146 2.146 6.087 0.00312 **
# s(VAR9) 1.000 1.000 0.218 0.64083
# ---
# Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1
#
# R-sq.(adj) = 0.0317
# Scale est. = 4.0528 n = 1892
summary(br5f$lme)
# Linear mixed-effects model fit by maximum likelihood
# Data: data
# AIC BIC logLik
# 11065.24 11148.43 -5517.622
#
# Random effects:
# Formula: ~Xr - 1 | g
# Structure: pdIdnot
# Xr1 Xr2 Xr3 Xr4 Xr5 Xr6 Xr7 Xr8
# StdDev: 0.8294889 0.8294889 0.8294889 0.8294889 0.8294889 0.8294889 0.8294889 0.8294889
#
# Formula: ~Xr.0 - 1 | g.0 %in% g
# Structure: pdIdnot
# Xr.01 Xr.02 Xr.03 Xr.04 Xr.05 Xr.06 Xr.07 Xr.08
# StdDev: 7.618265e-05 7.618265e-05 7.618265e-05 7.618265e-05 7.618265e-05 7.618265e-05 7.618265e-05 7.618265e-05
#
# Formula: ~1 | GROUPA %in% g.0 %in% g
# (Intercept)
# StdDev: 0.0002181793
#
# Formula: ~1 | groupB %in% GROUPA %in% g.0 %in% g
# (Intercept) Residual
# StdDev: 0.0001290529 2.013153
#
# Variance function:
# Structure: fixed weights
# Formula: ~invwt
# Fixed effects: list(fixed)
# Value Std.Error DF t-value p-value
# X(Intercept) -7.822006 1.4776376 1470 -5.293589 0.0000
# Xvar2M 0.065538 0.1698107 1470 0.385945 0.6996
# Xvar31 0.103558 0.1843021 239 0.561892 0.5747
# XVAR41 -0.057767 0.2058345 173 -0.280647 0.7793
# Xvar5 0.116383 0.0464641 173 2.504787 0.0132
# Xvar6 0.020364 0.0352209 173 0.578183 0.5639
# Xvar7 -0.093506 0.0616327 173 -1.517156 0.1311
# Xvar8 -0.031187 0.0429514 173 -0.726106 0.4688
# Xs(var1)Fx1 -0.384263 0.2817892 173 -1.363652 0.1744
# Xs(VAR9)Fx1 -0.041480 0.0889423 173 -0.466372 0.6415
# Correlation:
# X(Int) Xgnd_M Xthn21 XNEW_S Xvar5 Xvar6 Xst_p1 Xvar8 Xs()F1
# Xvar2M -0.062
# Xvar31 -0.022 0.020
# XVAR41 -0.038 -0.029 0.189
# Xvar5 -0.008 0.057 -0.061 -0.206
# Xvar6 -0.868 -0.027 0.052 0.023 0.006
# Xvar7 -0.654 0.003 -0.089 0.043 -0.368 0.254
# Xvar8 0.011 -0.060 -0.001 0.034 -0.189 0.218 -0.228
# Xs(var1)Fx1 -0.019 0.023 0.000 -0.062 0.014 0.034 -0.006 0.029
# Xs(VAR9)Fx1 0.051 -0.095 -0.074 -0.052 -0.008 -0.078 0.037 -0.020 -0.021
#
# Standardized Within-Group Residuals:
# Min Q1 Med Q3 Max
# -0.8708042 -0.3019933 -0.2090718 -0.0899512 14.9421321
#
# Number of Observations: 1892
# Number of Groups:
# g g.0 %in% g
# 1 1
# GROUPA %in% g.0 %in% g groupB %in% GROUPA %in% g.0 %in% g
# 1472 1652
fit <-glmmTMB(Num_admiss ~ newagecat+var2 + var3 + VAR4 +
var9+var5+var6+ var7+var8+offset(lexpfn)+(1| GROUPA)+(1|groupB), family=poisson,data=may21Omi)
# Family: poisson ( log )
# Formula: Num_admiss ~ newagecat + var2 + var3 + VAR4 +
# var5 + var6 + var7+ var8 + var9 + offset(lexpfn) + (1 | GROUPA) + (1 | groupB)
# Data: may21Omi
#
# AIC BIC logLik deviance df.resid
# 2407.5 2479.6 -1190.8 2381.5 1879
#
# Random effects:
#
# Conditional model:
# Groups Name Variance Std.Dev.
# groupB (Intercept) 1.173 1.083
# GROUPA (Intercept) 4.125 2.031
# Number of obs: 1892, groups: groupB, 1636; GROUPA, 1472
#
# Conditional model:
# Estimate Std. Error z value Pr(>|z|)
# (Intercept) -9.5950170 1.6721112 -5.738 9.57e-09 ***
# newagecat2 -0.6298056 0.1970976 -3.195 0.0014 **
# newagecat3 -0.4693142 0.2934038 -1.600 0.1097
# var2M 0.1048778 0.1886372 0.556 0.5782
# var31 -0.0120491 0.2067959 -0.058 0.9535
# VAR41 -0.0189449 0.2255866 -0.084 0.9331
# var5 0.1032991 0.0498155 2.074 0.0381 *
# var6 0.0081499 0.0385051 0.212 0.8324
# var7 -0.0273567 0.0729078 -0.375 0.7075
# var8 -0.0617969 0.0455357 -1.357 0.1747
# var9 -0.0005731 0.0040367 -0.142 0.8871
---
# Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1
<http://aka.ms/weboutlook>
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list