# use the obk.long data (mildly reasonable)
data(obk.long)
mixed(value ~ treatment * phase + (hour|id), obk.long)
# Examples for using the per.parammeter argument:
data(obk.long, package = "afex")
obk.long$hour <- ordered(obk.long$hour)
# tests only the main effect parameters of hour individually per parameter.
mixed(value ~ treatment*phase*hour +(1|id), per.parameter = "^hour$", data = obk.long)
# tests all parameters including hour individually
mixed(value ~ treatment*phase*hour +(1|id), per.parameter = "hour", data = obk.long)
# tests all parameters individually
mixed(value ~ treatment*phase*hour +(1|id), per.parameter = ".", data = obk.long)
# example data from package languageR:
# Lexical decision latencies elicited from 21 subjects for 79 English concrete nouns,
# with variables linked to subject or word.
data(lexdec, package = "languageR")
# using the simplest model
m1 <- mixed(RT ~ Correct + Trial + PrevType * meanWeight +
Frequency + NativeLanguage * Length + (1|Subject) + (1|Word), data = lexdec)
m1
# gives:
## Effect df1 df2 Fstat p.value
## 1 (Intercept) 1 96.6379 13573.1410 0.0000
## 2 Correct 1 1627.7303 8.1452 0.0044
## 3 Trial 1 1592.4301 7.5738 0.0060
## 4 PrevType 1 1605.3939 0.1700 0.6802
## 5 meanWeight 1 75.3919 14.8545 0.0002
## 6 Frequency 1 76.0821 56.5348 0.0000
## 7 NativeLanguage 1 27.1213 0.6953 0.4117
## 8 Length 1 75.8259 8.6959 0.0042
## 9 PrevType:meanWeight 1 1601.1850 6.1823 0.0130
## 10 NativeLanguage:Length 1 1555.4858 14.2445 0.0002
# Fitting a GLMM using parametric bootstrap:
require("mlmRev") # for the data, see ?Contraception
gm1 <- mixed(use ~ age + I(age^2) + urban + livch + (1 | district),
family = binomial, data = Contraception, args.test = list(nsim = 10), method = "PB")
## using multicore
require(parallel)
(nc <- detectCores()) # number of cores
cl <- makeCluster(rep("localhost", nc)) # make cluster
# to keep track of what the function is doind, redirect output to outfile:
# cl <- makeCluster(rep("localhost", nc), outfile = "cl.log.txt")
# obtain fits with multicore:
mixed(value ~ treatment*phase*hour +(1|id), data = obk.long, method = "LRT", cl = cl)
Run the code above in your browser using DataLab