[R-sig-ME] weighted vs unweighted GLMER variance estimates
Paulsen, David
paulsendj at upmc.edu
Mon Jan 7 18:38:01 CET 2013
Dear Users,
I've recently been working on analyzing a longitudinal & cross-sectional fMRI data set of unbalanced design consisting of approx 160 participants. Consistent with multilevel modeling often used in fMRI analysis, I've been using parameter and variance estimates in neural response from each subject as my data, with Age and Age^2 as predictor variables. I've also been checking to see how the results from weighted GLMs (wGLM), weighted GLMER (wGLMER), and unweighted GLMs, compare to a standard fMRI analysis package (FSL) with a subset of the data. In doing so, I've found that the weighted GLMER produces more similar variance estimates than the unweighted GLMER, provided I make an adjustment to output provided by lme4.
Essentially, the fixed effects error variance for the wGLMER appears to be larger than the error variance for the GLMER on an order proportional to error of the between-subjects residuals. This adjustment appears to be reliable across the 1900 regressions I ran my tests on.
I'm unsure of why using weights should so drastically affect the Fixed Effects variance, why dividing the wGLMER variance estimates by the residual variance achieves similarity to the unweighted GLMER variance estimates, and if I am justified in using these adjusted amounts to calculate t-values. I am including data from my full sample for an example, but am printing only some output here for immediate observation.
Help on this matter would be very much appreciated.
Regards,
David Paulsen
> # DISPLAY RESULTS
> summary(glmer_out)
Linear mixed model fit by REML
Formula: yhat ~ Age_adj + I(Age_adj^2) + (1 | subjectID)
AIC BIC logLik deviance REMLdev
2714 2731 -1352 2710 2704
Random effects:
Groups Name Variance Std.Dev.
subjectID (Intercept) 325.64 18.045
Residual 2846.26 53.350
Number of obs: 249, groups: subjectID, 137
Fixed effects:
Estimate Std. Error t value
(Intercept) 31.8412 4.7634 6.685
Age_adj 2.7313 1.4915 1.831
I(Age_adj^2) -0.4337 0.3100 -1.399
Correlation of Fixed Effects:
(Intr) Age_dj
Age_adj 0.039
I(Age_dj^2) -0.507 -0.615
> summary(wglmer_out)
Linear mixed model fit by REML
Formula: yhat ~ Age_adj + I(Age_adj^2) + (1 | subjectID)
AIC BIC logLik deviance REMLdev
751.9 769.4 -370.9 747.5 741.9
Random effects:
Groups Name Variance Std.Dev.
subjectID (Intercept) 818725.8 904.835
Residual 2400.1 48.991
Number of obs: 249, groups: subjectID, 137
Fixed effects:
Estimate Std. Error t value
(Intercept) 30.1223 215.3330 0.140
Age_adj 2.8065 66.2379 0.042
I(Age_adj^2) -0.4986 13.2487 -0.038
Correlation of Fixed Effects:
(Intr) Age_dj
Age_adj 0.056
I(Age_dj^2) -0.506 -0.626
>
> # COMPARE GLMER SE, wGLMER SE, & wGLMER ADJUSTED SE
> glmer_stderr
(Intercept) Age_adj I(Age_adj^2)
4.7634370 1.4914602 0.3099561
> wglmer_stderr
(Intercept) Age_adj I(Age_adj^2)
215.33304 66.23788 13.24866
> wglmer_stderr_adj
(Intercept) Age_adj I(Age_adj^2)
4.3953591 1.3520419 0.2704305
# DATA & CODE
yhat <- c(-17.86383, -67.93507, 62.77558, -25.00129, 8.600049, 19.74757, 36.35019, 19.78256, 63.44397, 187.6141, 39.21401, -32.13604, 112.21, 99.78252, 52.1128, 8.983917, -0.2228356, 45.04539, 152.8446, 69.4516, -17.09545, 33.01205, 11.79658, 236.2675, 59.41111, 48.96542, -28.8011, 8.018624, -80.94499, 61.5362, 122.6593, 26.82249, 137.6959, 13.70128, 153.4673, 88.05206, 12.78811, 9.1956, 19.80628, 38.78817, 54.4374, -26.908, -17.47678, -12.40804, -33.34377, -12.54371, -29.12496, 29.89239, 76.09109, -1.456215, -42.91579, -35.48977, 40.3413, 96.75193, -26.20043, 72.88014, -4.498486, 44.04082, 120.6856, 36.17123, -36.29802, 53.01909, -51.50906, -22.85605, 49.57092, 120.6811, 114.3392, -2.821136, 81.09837, -55.07222, 73.61099, 47.53521, 49.42628, 145.0036, 40.72733, 2.6586, -23.1839, 74.15407, 34.09974, 43.26672, 34.73029, -43.57184, -19.39236, 99.23603, -8.092349, -9.658018, 46.68232, 18.92779, 60.55532, 67.58183, 70.43863, -66.24371, 30.25297, 63.24903, -44.24773, 110.2207, 51.43445, 34.92665, -9.43949, 33.45405, 31.89272, 14.7246, -37.78331, 101.5455, -6.926058, 15.54408, 200.0708, 49.00461, 8.489271, 15.56577, 18.82096, 79.90823, -33.52191, 65.90131, -41.56767, 41.44206, 17.85847, -0.7615868, -17.49322, 21.56572, -55.35418, -96.07809, -33.83941, 20.94368, 94.30896, 82.08093, -30.9233, 28.62884, -9.951429, 80.26689, 101.3565, 57.31608, 33.58985, 6.77054, 67.09788, -8.760614, -6.980731, -5.862709, 54.40738, 43.92796, 39.94324, 4.664509, 27.7117, 9.358894, 25.28339, -15.61768, 86.86378, 83.1256, -21.28656, -72.29863, 9.106373, 35.14648, 25.62542, 91.91111, 51.71715, 62.60024, 261.3518, 51.44857, -23.74933, 81.17366, -0.2988409, 25.64609, 0.03400882, -33.95691, 37.02612, 50.46914, -24.85151, 27.13361, 48.47046, 40.92603, 68.63319, 49.97451, -2.729544, -76.28941, 64.21523, -39.13202, 106.9234, 69.32959, 55.89867, 85.48119, 51.0333, -12.99842, 46.53439, 49.33897, -3.042722, 110.3458, 65.66805, 119.5013, -56.69803, 36.52827, -20.95306, 37.66682, -7.274448, 90.77976, 55.46455, -50.28808, 59.24579, 50.87093, -34.55978, 46.75426, -4.968956, -58.17086, 21.63069, 23.14527, -8.624804, 130.3394, 25.99968, 26.47401, 9.909436, -42.20339, 33.77307, -42.8187, -33.09747, -4.354581, 19.64606, 49.20227, 27.82024, 25.82506, 110.3884, 110.5982, 185.3917, -75.21708, 40.95378, 51.64703, -67.93621, 95.71213, 32.24789, 3.461251, -37.93186, -25.56975, 41.39754, 69.54233, 50.13354, -39.70442, 56.94862, -27.39709, 96.96685, 74.49326, 16.48888, -13.52116, 3.87862, 105.7628, -70.72237, 35.75502, 77.68787, 102.3832, -40.57845, 104.7736, 12.21588)
Age_adj <- c(5.78, 10.55, 0.41, 2.01, -1.67, -0.01, 0.69, 2.16, 1.09, 2.58, 4.02, 0.56, 2.03, -0.25, 1.16, 5.11, 5.45, 0.59, 2.12, 3.86, 8.65, 1.6, -4.51, -2.83, 1.32, 5.07, 4.21, 3.72, 5.29, 3.48, 4.91, 6.47, 3.93, 5.79, 7.12, 8.62, 1.86, 3.43, 5.78, 3.09, 4.66, 6.15, 8.55, -3.59, -2.09, 2.03, 3.52, 4.38, 7.91, 2.53, 4.22, 5.66, -0.18, 1.41, 3.01, 3.8, 6.79, 6.79, 3.96, -2.35, -0.76, 1.3, -0.15, 1.62, 5.5, 0.65, 3.85, -1.13, 0.35, -3.29, -1.81, 0.39, -3.94, -2.53, -1.01, -4.43, -2.79, -1.28, -4.89, -2.12, -0.85, 0.65, 2.37, 3.98, -0.43, 1.45, 2.49, -3.47, -1.92, -0.55, 2.91, -1.47, 1.68, -1.03, 0.73, 4.18, 5.58, -2.53, -0.87, 2.46, 5.72, -0.76, 3.31, -0.16, 1.83, 3, 1.16, 2.69, 0.69, 2.2, 3.68, 1.1, 3.17, 4.92, 6.45, 0.56, 2.13, 3.79, 5.25, 0.41, 1.96, 3.51, -0.11, 1.44, 2.9, -3.76, -2.12, -0.66, 1.68, 3.2, 3.6, 3.14, 5.17, 2.86, 4.89, 2.44, -0.26, 1.52, -4.28, -2.73, -1.18, -0.39, 0.9, -3.88, -2.09, 2.88, 2.96, 4.58, 5.9, -2.88, -1.35, 0.12, 3.39, 4.88, 6.25, 3.57, 5.33, 3.49, 5.31, 6.43, 3.9, 5.69, 3.33, -3.97, -1.62, -0.78, -1.32, 0.2, -1.56, -3.23, -2.59, -1.19, 3.86, 3.88, 5.59, -3.31, 3.74, 5.47, -3.85, 0.88, 2.64, 1.28, -2.77, -1.19, -3.24, 3.54, 3.81, -1.35, 0.17, 3.86, 5.42, -4.54, -2.85, -3.72, 1.69, -2.22, -3.3, -1.7, -1.06, 0.52, -0.88, -2.84, -1.13, 2.65, -4.12, -2.07, 1.2, -4.84, -3.1, -4.87, -3.18, -1.41, -1.95, 0.18, -1.62, 1.67, 3.15, 0.07, 1.53, 3.65, 5.48, 0.04, -4.08, -2.44, 0.74, -0.23, 1.44, 1.94, 3.68, -1.19, 3.11, 4.9, 3.95, 5.73, 0.6, 2.31, 3.9, 3.86, 5.57, -0.78, 0.71, 1.21, 3.32, 0.97, 1.29, 2.91, 0.3, 1.74, -1.86)
subjectID <- c(10128, 10134, 10152, 10152, 10153, 10153, 10156, 10156, 10173, 10173, 10173, 10181, 10181, 10300, 10300, 10315, 10385, 10406, 10406, 10406, 10431, 10451, 10466, 10466, 10529, 10558, 10565, 10567, 10567, 10568, 10568, 10568, 10572, 10572, 10572, 10574, 10585, 10585, 10585, 10589, 10589, 10589, 10594, 10599, 10599, 10604, 10604, 10604, 10605, 10608, 10608, 10608, 10616, 10616, 10616, 10623, 10623, 10623, 10625, 10626, 10626, 10626, 10627, 10627, 10629, 10633, 10635, 10636, 10636, 10637, 10637, 10637, 10638, 10638, 10638, 10644, 10644, 10644, 10646, 10652, 10653, 10653, 10654, 10654, 10661, 10661, 10661, 10662, 10662, 10662, 10664, 10665, 10665, 10666, 10666, 10667, 10667, 10671, 10671, 10673, 10673, 10674, 10675, 10677, 10677, 10677, 10678, 10678, 10680, 10680, 10680, 10686, 10689, 10689, 10689, 10696, 10697, 10697, 10697, 10699, 10699, 10699, 10700, 10700, 10700, 10701, 10701, 10701, 10703, 10703, 10707, 10708, 10708, 10709, 10709, 10710, 10711, 10711, 10717, 10717, 10717, 10747, 10747, 10749, 10749, 10757, 10758, 10758, 10758, 10760, 10760, 10760, 10761, 10761, 10761, 10762, 10762, 10765, 10765, 10765, 10766, 10766, 10768, 10772, 10772, 10773, 10774, 10774, 10778, 10779, 10780, 10780, 10782, 10786, 10786, 10787, 10788, 10788, 10790, 10796, 10796, 10797, 10798, 10798, 10800, 10802, 10803, 10804, 10804, 10805, 10805, 10806, 10806, 10807, 10808, 10809, 10811, 10811, 10812, 10812, 10813, 10814, 10814, 10817, 10818, 10818, 10820, 10821, 10821, 10822, 10822, 10824, 10826, 10826, 10836, 10839, 10839, 10840, 10840, 10841, 10841, 10842, 10843, 10843, 10845, 10847, 10847, 10849, 10849, 10850, 10851, 10851, 10852, 10852, 10869, 10869, 10870, 10872, 10872, 10873, 10873, 10874, 10875, 10877, 10879, 10879, 10887, 10887, 10888)
var_est <- c(2117.232, 1856.527, 2752.249, 1364.204, 1195.229, 4033.198, 6462.032, 1612.014, 2854.178, 3227.569, 2090.262, 2407.377, 2311.557, 3347.094, 2348.126, 1691.455, 3862.144, 1361.611, 5045.376, 2004.46, 2111.046, 1531.715, 4047.582, 4162.438, 1782.844, 2445.805, 4974.277, 972.256, 2732.625, 3149.915, 4282.503, 1667, 3445.044, 3929.609, 1857.306, 1929.016, 1806.192, 1350.487, 2163.956, 1382.237, 2105.488, 2425.088, 1585.392, 1284.99, 1839.946, 1783.923, 3088.686, 1905.855, 1395.401, 3912.845, 1873.235, 2499.939, 1997.997, 3953.164, 1110.427, 2128.916, 1421.97, 2578.543, 2438.239, 2143.414, 5448.135, 895.8371, 3876.441, 2454.641, 1266.05, 1286.321, 2371.491, 1845.233, 948.009, 2334.511, 1238.893, 2484.186, 2104.395, 1628.669, 3306.381, 1225.193, 2251.642, 2629.077, 2847.037, 3861.317, 2171.143, 1803.323, 4486.976, 3057.108, 1319.224, 2902.172, 2046.981, 2164.243, 3769.546, 1308.071, 2630.981, 1733.245, 1859.789, 2422.816, 5358.247, 5088.674, 1326.271, 2338.529, 1818.681, 1583.202, 1830.168, 2420.32, 1737.724, 2471.06, 1173.188, 2552.61, 3719.981, 1856.206, 1467.039, 4748.495, 2014.772, 1903.904, 1797.682, 2616.952, 2618.1, 2875.845, 1561.778, 2121.504, 3907.931, 1736.165, 5158.229, 2934.292, 2275.788, 2782.14, 7164.727, 3635.709, 3204.541, 3073.852, 1856.379, 2473.882, 4525.398, 2001.25, 2475.327, 2637.609, 7965.129, 5800.15, 3788.97, 3192.963, 1291.541, 6677.519, 2196.154, 2828.934, 2965.4, 3243.802, 3391.377, 2682.823, 1832.081, 2508.383, 3403.081, 2939.152, 3820.748, 2516.928, 2568.668, 5601.77, 2319.515, 3408.002, 7352.196, 3070.829, 1270.897, 2475.052, 2129.083, 3462.514, 2968.115, 1359.369, 2687.299, 2150.726, 1933.411, 1238.447, 4716.554, 3671.501, 4155.547, 2423.732, 1733.876, 2068.158, 2195.333, 1946.794, 3901.803, 1843.907, 2325.319, 3433.175, 2690.929, 2712.109, 3240.584, 2034.036, 814.4943, 4247.212, 4431.068, 1880.548, 1985.781, 2672.374, 2516.915, 8474.012, 2994.591, 3063.671, 3094.606, 1464.994, 1020.753, 3616.184, 1180.809, 3700.844, 2663.671, 2229.899, 1616.548, 2157.592, 2610.113, 5337.962, 1900.459, 1621.1, 2519.966, 1817.123, 2161.079, 5065.147, 1928.294, 2759.455, 2299.465, 2884.927, 3980.114, 5071.609, 2488.129, 2993.238, 1656.281, 2927.721, 2920.717, 1268.808, 3921.836, 2113.641, 4456.005, 3496.747, 3684.217, 2233.274, 2769.909, 1703.298, 11747.37, 1467.061, 3739.88, 4333.55, 4014.81, 2267.72, 1952.689, 2909.576, 4136.469, 4080.664, 3515.684, 1847.262, 2734.856, 4158.62, 6032.312, 2431.275, 2705.765)
# RUN GLMER, SAVING STD.ERR.
glmer_out <- glmer(yhat ~ Age_adj + I(Age_adj^2) + (1|subjectID))
glmer_stderr <- coef(summary(glmer_out))[,"Std. Error"]
# RUN wGLMER, SAVING STD.ERR.
wglmer_out <- glmer(yhat ~ Age_adj + I(Age_adj^2) + (1|subjectID), weights=1/var_est)
rand_resid_sd <- as.numeric(summary(wglmer_out)@REmat[2,"Std.Dev."])
wglmer_stderr <- coef(summary(wglmer_out))[,"Std. Error"]
wglmer_stderr_adj <- wglmer_stderr/rand_resid_sd
# DISPLAY RESULTS
summary(glmer_out)
summary(wglmer_out)
# COMPARE GLMER SE, wGLMER SE, & wGLMER ADJUSTED SE
glmer_stderr
wglmer_stderr
wglmer_stderr_adj
David J. Paulsen, Ph.D.
Laboratory of Neurocognitive Development
Western Psychiatric Institute and Clinic
University of Pittsburgh Medical Center
Loeffler Building
121 Meyran Avenue
Pittsburgh, PA 15213
412.383.8168
More information about the R-sig-mixed-models
mailing list