I'm trying to use lmer() to estimate a discrete-time survival model for a
dataset containing data about 2438 households sampled from 52 different
neighborhoods. Naturally, since it's a clustered sample, I want to account
for that in my model, hence my interest in using lmer() instead of glm(). 

After re-arranging the household level data into a "person-period" dataset
where each household has one row for every period between entering the study
and either having the event occur or being censored, I've got a little over
34,000 records in the data frame. I've got the Period variable stored as a
factor (levels are 1:23, each period is a week long), and various other
time-varying predictors are stored as dummy-coded factors, as is the outcome
variable (EventTV). I also have 23 different factors named Week1 to Week23
that are dummy codes for each specific period. 

Session info output is at the bottom of this message. 

So, my situation is as follows. I want to test two interaction terms
(Week2*OR1pc and Week3*OR1pc) because I have reason to believe that OR1pc
only has an effect in weeks 2 and 3. So, I expect the main effect to be
non-significant, and each interaction term to yield a positive significant
coefficient. When I try the model in lmer(), it takes about 40 minutes or so
to run, but doesn't give any error message. When I try to get a summary ()
of the model, I get an error message as shown below. 

> levels(RS05.multilevel$Week2)
[1] "0" "1"
> levels(RS05.multilevel$Week3)
[1] "0" "1"
> levels(RS05.multilevel$OR1pc)
[1] "0" "1"

> model.16a <- lmer(formula = EventTV ~ Period + OR1pc + OR1flyer + OR2pctv
+ 
+                             OR2flyertv + Spanish_Version + MUDwell + 
+                             Week2*OR1pc + Week3*OR1pc + 0 + (1 |
ClusterID), 
+                 data=RS05.factors, family = binomial(logit),
method="Laplace")                
> 
> summary(model.16a)
Error in if (any(sd < 0)) return("'sd' slot has negative entries") : 
        missing value where TRUE/FALSE needed

Is this a bug in the code, an indication of some flaw in my specification of
the model, or something else entirely? I could really use expert assistance.
Is there a better way to test this hypothesis?

For comparison purposes, here's what I got when I tried the same model in
glm() without the random effect. That worked fine and gave me results that
make sense given my research context. The only thing I hesitate about is the
message about 2 coefficients not being defined, but I expected that because
the Week2 and Week3 factors would be redundant with the representation of
Period 2 and Period 3 from the Period factor. Since the glm() ran without
any other unusual message and gives reasonable results otherwise, am I OK in
assuming this output can be trusted?

> model.8d <- glm(formula = EventTV ~ Period + OR1pc + OR1flyer + OR2pctv +
OR2flyertv 
+                 + Spanish_Version + MUDwell + Week2*OR1pc + Week3*OR1pc +
0, 
+                 data=RS05.multilevel, family = binomial(logit))
> summary(model.8d)

Call:
glm(formula = EventTV ~ Period + OR1pc + OR1flyer + OR2pctv + 
    OR2flyertv + Spanish_Version + MUDwell + Week2 * OR1pc + 
    Week3 * OR1pc + 0, family = binomial(logit), data = RS05.multilevel)

Deviance Residuals: 
       Min          1Q      Median          3Q         Max  
-7.043e-01  -2.871e-01  -1.066e-01  -5.772e-05   3.773e+00  

Coefficients: (2 not defined because of singularities)
                  Estimate Std. Error z value Pr(>|z|)    
Period1          -20.51325  358.74618  -0.057   0.9544    
Period2           -2.24257    0.14910 -15.041  < 2e-16 ***
Period3           -2.11969    0.14912 -14.214  < 2e-16 ***
Period4           -2.46439    0.14794 -16.658  < 2e-16 ***
Period5           -3.23030    0.17413 -18.551  < 2e-16 ***
Period6           -3.08626    0.17008 -18.146  < 2e-16 ***
Period7           -5.01505    0.32616 -15.376  < 2e-16 ***
Period8           -4.86421    0.29759 -16.345  < 2e-16 ***
Period9           -3.13471    0.17442 -17.972  < 2e-16 ***
Period10          -3.44370    0.18986 -18.138  < 2e-16 ***
Period11          -5.20857    0.35823 -14.540  < 2e-16 ***
Period12          -4.62217    0.28237 -16.369  < 2e-16 ***
Period13         -20.69211  468.38440  -0.044   0.9648    
Period14          -5.43548    0.40017 -13.583  < 2e-16 ***
Period15          -5.76831    0.46612 -12.375  < 2e-16 ***
Period16          -5.98896    0.51701 -11.584  < 2e-16 ***
Period17          -6.68056    0.71923  -9.288  < 2e-16 ***
Period18          -6.39167    0.71938  -8.885  < 2e-16 ***
Period19         -20.69271  546.71473  -0.038   0.9698    
Period20         -20.69271  546.71473  -0.038   0.9698    
Period21         -20.69271  546.71473  -0.038   0.9698    
Period22         -20.69271  546.71473  -0.038   0.9698    
Period23          -7.08386    1.00871  -7.023 2.18e-12 ***
OR1pc1             0.07477    0.09405   0.795   0.4266    
OR1flyer1         -0.03340    0.12451  -0.268   0.7885    
OR2pctv1           0.24920    0.10954   2.275   0.0229 *  
OR2flyertv1        0.18916    0.09772   1.936   0.0529 .  
Spanish_Version1  -0.20695    0.09785  -2.115   0.0344 *  
MUDwell1          -0.27209    0.10819  -2.515   0.0119 *  
Week21                  NA         NA      NA       NA    
Week31                  NA         NA      NA       NA    
OR1pc1:Week21      0.31715    0.15983   1.984   0.0472 *  
OR1pc1:Week31      0.33899    0.16052   2.112   0.0347 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 48286.0  on 34831  degrees of freedom
Residual deviance:  7427.2  on 34800  degrees of freedom
AIC: 7489.2

Number of Fisher Scoring iterations: 19

> sessionInfo()
R version 2.4.1 (2006-12-18) 
i386-pc-mingw32 

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"  
[7] "base"     

other attached packages:
       boot        lme4      Matrix     lattice     foreign 
   "1.2-27" "0.9975-13" "0.9975-11"   "0.14-17"    "0.8-18" 


Steven J. Pierce, M.S.
Doctoral Student in Ecological/Community Psychology
Department of Psychology
Michigan State University
240B Psychology Building
East Lansing, MI 48824-1116

E-mail: pierces1@msu.edu
Web: http://www.psychology.msu.edu/eco/


	[[alternative HTML version deleted]]


