Convergence testing

library(lattice)
library(lme4)
library(blme)
library(reshape2)
library(ggplot2); theme_set(theme_bw())
library(gridExtra)  ## for grid.arrange
library(bbmle) ## for slice2D; requires *latest* r-forge version (r121)
source("allFit.R")

Load data:

dList <- load("data.RData")

Spaghetti plot: don’t see much pattern other than (1) general increasing trend; (2) quantized response values (table(dth$Estimate) or unique(dth$Estimate) also show this); (3) skewed residuals

sort(unique(dth$Estimate))
##  [1]  0.0  0.5  1.0  1.5  2.0  2.5  3.0  4.0  5.0  6.0  7.0  7.5  8.0 10.0
## [15] 12.0 15.0 17.0 20.0 25.0 30.0 35.0 40.0 50.0 60.0 70.0 75.0 90.0
(p0 <- ggplot(dth,aes(Actual,Estimate))+geom_point()+
    geom_line(aes(group=factor(pid)))+
    stat_summary(fun.y=mean,geom="line",colour="red",lwd=2))

plot of chunk spaghett1

getcor <- function(object) attr(VarCorr(object)[[1]],"correlation")[2,1]
f1 <- lmer(Estimate~Actual+(Actual|pid),data=dth,REML=FALSE)
getcor(f1)

logging (there are zero values: it’s a bit sloppy, but I’m just going to use log(0.5+x) as the response – log(1+x) may look even better …) helps a great deal with the fit (no longer singular), and with the Q-Q

f1L <- lmer(log10(0.5+Estimate)~Actual+(Actual|pid),data=dth,REML=FALSE)
VarCorr(f1L)
##  Groups   Name        Std.Dev. Corr 
##  pid      (Intercept) 0.28539       
##           Actual      0.00633  -0.20
##  Residual             0.27445

Q-Q plot shows the problem …

grid.arrange(qqmath(f1),qqmath(f1L),nrow=1)

plot of chunk qq

and helps the general residual plot

grid.arrange(plot(f1,type=c("p","smooth")),
             plot(f1L,type=c("p","smooth")),nrow=1)