ordering: Ordering of Individuals and Items

Description Usage Arguments Value Examples

View source: R/ordering.R

Description

Reorder a data set given estimates of person abilities and item easiness.

Usage

1
ordering(x,rabil,reasi)

Arguments

x

The data set to be ordered.

rabil

A vector of estimates of person abilities.

reasi

A vector of estimates of item easiness.

Value

A list containing the following components:

matrix

The final ordered data set.

samples

The number of observations and variables of the original and the final reordered data set.

kept

Which cases are kept.

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
### Random Data with 100 observations and 10 variables with 5 levels of response
n = 100; v = 10; l = 5
Data <- matrix(NA,nrow=n,ncol=v)
psi <- seq(length=n,-3,3); theta <- seq(length=v,-3,3); eta <- matrix(NA,ncol=v,nrow=n)
seed <- matrix(c(1:(n*v)),nrow=n,ncol=v)
for(i in 1:n)
{
  for(j in 1:v)
  {
    set.seed(seed[i,j])
    eta[i,j] <- exp(psi[i]-theta[j])/(1+exp(psi[i]-theta[j]))
    Data[i,j] <- rbinom(1,l-1,eta[i,j])
  }
}
rm(n,v,eta,seed,i,j)

### Create Scores
AbilF <- latent.vs(Data,l,what="person",method="freq")
Af <- AbilF$abil
EasiF <- latent.vs(Data,l,what="item",method="freq")
Ef <- EasiF$easi

### Calculate optimal sample size
A <- opt.sample(Af)$round; E <- opt.sample(Ef)$round

### Reorder Data Set
rabil <- round(Af,A); reasi <- round(Ef,E)
Ordered <- ordering(Data,rabil,reasi)

vthorrf/CIRM documentation built on Nov. 5, 2019, 12:05 p.m.