File: clmm.methods.R

package info (click to toggle)
r-cran-ordinal 2022.11-16-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,856 kB
  • sloc: ansic: 979; sh: 13; makefile: 5
file content (46 lines) | stat: -rw-r--r-- 1,061 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
library(ordinal)
data(wine)

#################################
## model.matrix method for clmm-objects:
fmm1 <- clmm(rating ~ contact + temp + (1|judge), data=wine)
mm <- model.matrix(fmm1)
stopifnot(inherits(mm, "matrix"),
          dim(mm) == c(72, 3))

#################################
## anova.clmm works even if formula does not have an environment:
fmm1 <- clmm(rating ~ temp * contact + (1|judge), data = wine)
fmm2 <- clmm(rating ~ temp + contact + (1|judge), data = wine)
environment(fmm1$formula) <- NULL
environment(fmm2$formula) <- NULL
anova(fmm1, fmm2)


#################################
## Test that ranef, condVar and VarCorr work as they are supposed to whether or
## not nlme and lme4 are loaded:

fm <- clmm(rating ~ temp + contact + (1|judge), data = wine)
fm
ranef(fm)
VarCorr(fm)
condVar(fm)
summary(fm)

library(nlme)
ranef(fm)
VarCorr(fm)
condVar(fm)
library(lme4)
ranef(fm)
VarCorr(fm)
condVar(fm)
fm1 <- lmer(Reaction ~ Days + (Days | Subject), data=sleepstudy)
ranef(fm1)
VarCorr(fm1)

ranef(fm)
VarCorr(fm)
condVar(fm)
summary(fm)