mudfoldsim: Function for constructing artificial item response data...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/mudfoldsim.R

Description

mudfoldsim function simulates unfolding data following a unimodal parametric function with flexible set up. User can control the number of respondents, the number of items and fixed parameters of the Item Response Function (IRF) under which the responses are generated. Moreover, the user of the mudfold package can allow (or not) individuals that are endorsing no items.

Usage

1
mudfoldsim(p=p,n=n,gamma1=5,gamma2=-10,zeros=FALSE,parameters="normal",seed=NULL)

Arguments

p

: This argument specifies the number of items (stimuli).

n

: Argument which allows the user to specify the number of respondents in the simulated data.

gamma1

: Parameter which is used in the IRF under which the data is generated. Default value is 5.

gamma2

: Parameter which is used in the IRF under which the data is generated. Default value is -10.

zeros

: Logical argument. If zeros=FALSE (default), only individuals who endorse at least one item are allowed. Else, if zeros=TRUE individuals with no response are allowed.

parameters

: A character string that controls the distribution of the person parameters. If parameters="normal" (default), individual parameters are drawn from a standard normal distribution. If parameters="uniform", the person parameters are uniformly drawn between the minimum and the maximum item parameters respectively.

seed

: An integer to be used in the set.seed function. If seed=NULL (default), then the seed is not set.

Details

For simulating the response of an individual i with scale parameter θ_i to an item j with scale parameter β_j we use the function P(X_j =1 \mid θ_i, β_j)=\frac{1}{1+e^{-γ_1 -γ_2(θ_i - β_j)^2}}. The parameters θ_i, β_j are sampled from a standard normal distribution, i.e., θ \sim \mathcal{N}(0,1), and β \sim \mathcal{N}(0,1).

Value

a list with 11 components.

obs_ord

: A character vector with the items in the simulated order.

true_ord

: A character vector with the items in the true order in which they constitute an unfolding scale.

items

: An integer corresponding to the number of the simulated items.

sample

: An integer corresponding to the number of the simulated respondents.

gamma1

: A value that corresponds to the parameter γ_1 of the IRF.

gamma2

: A value that corresponds to the parameter γ_2 of the IRF.

seed

: An integer that corresponds to the seed number that is going to be used in the set.seed function.

dat

: data frame containing the binary responses of n subjects on K items under a parametric Item Response Function.

probs

: A matrix containing the probabilities of positive response from n subjects on K items under a parametric Item Response Function.

item.patameters

: The simulated item parameters that have been used for sampling the data.

subject.parameters

: The simulated subject parameters that have been used for sampling the data.

Author(s)

Spyros E. Balafas (auth.), Wim P. Krijnen (auth.), Wendy J. Post (contr.), Ernst C. Wit (auth.)

Maintainer: Spyros E. Balafas (s.balafas@rug.nl)

References

W.H. Van Schuur.(1984). Structure in Political Beliefs: A New Model for Stochastic Unfolding with Application to European Party Activists. CT Press.

W.J. Post. (1992). Non parametric Unfolding Models: A Latent Structure Approach. M & T series. DSWO Press.

W.J. Post. and T.AB. Snijders. (1993).Non parametric unfolding models for dichotomous data. Methodika.

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
## Not run: 
## Simulate 5 different scenarios 

n.seed <- 10

sim1 <- mudfoldsim(p=6, n=100, gamma1=5, gamma2=-10, zeros=FALSE,seed=n.seed)
sim2 <- mudfoldsim(p=10,n=1000,gamma1=10,gamma2=-100,zeros=FALSE,seed=n.seed)
sim3 <- mudfoldsim(p=15,n=2000,gamma1=50,gamma2=-100,zeros=FALSE,seed=n.seed)
sim4 <- mudfoldsim(p=30,n=2000,gamma1=50,gamma2=-100,zeros=FALSE,seed=n.seed)
sim5 <- mudfoldsim(p=50,n=2000,gamma1=50,gamma2=-100,zeros=FALSE,seed=n.seed)


dat1 <- sim1$dat
dat2 <- sim2$dat
dat3 <- sim3$dat
dat4 <- sim4$dat
dat5 <- sim5$dat

fit1 <- mudfold(dat1)
fit1
fit2 <- mudfold(dat2)
fit2
fit3 <- mudfold(dat3)
fit3
fit4 <- mudfold(dat4)
fit4
fit5 <- mudfold(dat5)
fit5

## End(Not run)

SpyrosBalafas/mudfold documentation built on May 19, 2019, 2:53 a.m.