[R-sig-ME] Comparisons of models with and without a threshold

Christian Starzynski starzynski at uni-heidelberg.de
Wed Sep 10 11:56:34 CEST 2014


Dear All

I have data from multiple subjects that leads to the assumption that the
dependent variable stays constant up to some value of the independent
variable (here x=3) and decreases linearly for bigger x. I'd like to
test a model with a threshold behavior with a purely linear model.

Here is a minimal example
##example start
library(lme4)
#generate some data
#threshold set at k=3
data <- data.frame(subj=rep(c("A", "B", "C"), each=10), x=rep(seq(1,10),
times=3), y=0)
data[data$subj=="A",]$y <- c(rnorm(3, mean=0.5, sd=0.1), rnorm(7,
mean=-1, sd=0.1)*seq(4,10))
data[data$subj=="B",]$y <- c(rnorm(3, mean=1, sd=0.1), rnorm(7, mean=-1,
sd=0.1)*seq(4,10))
data[data$subj=="C",]$y <- c(rnorm(3, mean=2, sd=0.1), rnorm(7, mean=-1,
sd=0.1)*seq(4,10))
data <- transform(data, k=as.numeric(x>3))

#model without threshold
fm0 <- lmer(y ~ x + (1|subj), data=data, REML=F)

#model with threshold
fm1 <- lmer(y ~ x:k + (1|subj), data=data, REML=F)
##example end

-Is it valid to use a likelihood ratio test as done in anova(fm0, fm1)
to show the better fit of the threshold model?

-If(yes){Is it correct to adjust the p-value by add 1 to df of the
threshold model because k is a free parameter?}

-else{May I use BIC instead? Do I need to adjust df}


Thanks in advance!

Christian

-- 
Christian Starzynski

Neurologische Klinik
Universitätsklinikum Heidelberg
Im Neuenheimer Feld 400
69120 Heidelberg



More information about the R-sig-mixed-models mailing list