File: test.clm.profile.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 (36 lines) | stat: -rw-r--r-- 1,445 bytes parent folder | download | duplicates (3)
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
library(ordinal)

## Testing that the profile remains the same - that the model object
## is not 'distorted' by update(object/fitted, doFit=FALSE)
set.seed(1234)
wts <- runif(nrow(wine), 0, 2)
fm3 <- clm(rating ~ temp + contact, data=wine,
           weights=wts)
pr <- profile(fm3)

set.seed(1234)
fm3 <- clm(rating ~ temp + contact, data=wine,
           weights=runif(nrow(wine), 0, 2))
pr3 <- profile(fm3)
## > set.seed(1234)
## > fm3 <- clm(rating ~ temp + contact, data=wine,
## +            weights=runif(nrow(wine), 0, 2))
## > pr3 <- profile(fm3)
## Warning messages:
## 1: In profile.clm.beta(fitted, which.beta, alpha, max.steps, nsteps,  :
##   profile may be unreliable for tempwarm because only 1
##   steps were taken down
## 2: In profile.clm.beta(fitted, which.beta, alpha, max.steps, nsteps,  :
##   profile may be unreliable for tempwarm because only 1
##   steps were taken up
## 3: In profile.clm.beta(fitted, which.beta, alpha, max.steps, nsteps,  :
##   profile may be unreliable for contactyes because only 1
##   steps were taken down
## 4: In profile.clm.beta(fitted, which.beta, alpha, max.steps, nsteps,  :
##   profile may be unreliable for contactyes because only 1
##   steps were taken up
##
stopifnot(isTRUE(all.equal(pr, pr3, check.attributes=FALSE)))
stopifnot(
    isTRUE(all.equal(pr$tempwarm[, "lroot"], pr3$tempwarm[, "lroot"])),
    isTRUE(all.equal(pr$contactyes[, "lroot"], pr3$contactyes[, "lroot"])))