lrt: Likelihood Ratio Test

Description Usage Arguments Value Author(s) References See Also Examples

Description

This function applies likelihood ratio tests between one reference model (object) and some competing models.

Usage

1
2
3
4
5
6
7
lrt(object, ...)
## S3 method for class 'nrm'
lrt(object,  ...)
## S3 method for class 'nelm'
lrt(object,  ...)
## S3 method for class 'modc'
lrt(object,  ...)

Arguments

object

An object of class nrm, nelm or modc. In general, there are two approaches. The first one is fitting 2 or more models separately and supplying them to the function. The first object should be the most restrictive one (smallest number of parameters). The second approach is using the model_comp() function first to fit several models and then supplying the resulting object to this function to get lrt tests.

...

Objects of class nrm or nelm, which should be compared to the first object (reference model). So likelihood ratio tests are realized always between the reference model and all the others (1 vs 2, 1 vs 3, 1 vs 4 ...).

Value

The function returns a matrix with the following values

-2 loglikelihood difference

This is the difference of every submitted model vs. the reference model (object).

degrees of freedom difference

This is the difference in df between the reference model and the other models.

p-value

The resulting p-value whoch depends on the particular likelihood and the df difference.

Author(s)

Manuel Reif

References

Holland, P. W., & Wainer, H. (1993). Differential item functioning. Hillsdale, NJ: Lawrence Erlbaum.

See Also

nrm nelm model_comp

Examples

 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
## Too long for R CMD check :-(

## Not run: 
## NUMBER OF ITEMS
nit <- 3

set.seed(2046)
x1 <- rnorm(nit*5,0,1.7)
zeta <- tapply(x1,rep(1:nit,each=5), function(x) round(x - mean(x),3))

# lambda parameters
x2 <- rnorm(nit*5,0,1.1)
lam  <- tapply(x2,rep(1:nit,each=5), function(x)
{
  sort(round(x - mean(x),3),decreasing=FALSE)
})


# create a parlist as a first step
ParList <- mapply(function(one,two)
{
  x1 <- c(one,two)
  names(x1) <- paste0(rep(c("zeta","lam"),each=length(one)),1:length(one))
  return(x1)
},one=zeta,two=lam,SIMPLIFY=FALSE)


## NUMBER OF RESPONDENTS
nper <- 2000


names(ParList) <- paste0("item",1:length(ParList))

perp1 <- rnorm(nper,0,1)
perp2 <- rnorm(nper,0.3,1)

simdat1 <- NRM.sim(ParList,perp1)
simdat2 <- NRM.sim(ParList,perp2)

simdatall <- rbind(simdat1,simdat2)
simdatallg <- data.frame(GROUP=factor(rep(c("A","B"),each=nper)),simdatall)


my_resh <- reshMG(simdatallg,items=2:(nit+1),groups=1,correct=rep(3,nit),echo=FALSE)

est1 <- nrm(my_resh)


des2 <- designTemp(ngru=2,nit=nit,TYPE="NRM")
des2[[1]][2,1] <- 2 

my_resh2 <- reshMG(simdatallg,items=2:(nit+1),groups=1,correct=rep(3,nit),echo=FALSE,design=des2)

est2 <- nrm(my_resh2)

### LIKELIHOOD RATIO TEST
lrt(est1,est2)


## End(Not run)

manuelreif/mcIRT documentation built on May 21, 2019, 11:26 a.m.