mudfoldsim | R Documentation |
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.
mudfoldsim(N, n, gamma1=5, gamma2=-10, zeros=FALSE, parameters="normal", seed=NULL)
N |
: 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 |
parameters |
: A character string that controls the distribution of the person parameters. If |
seed |
: An integer to be used in the |
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 can be samples sampled both from a standard normal distribution, i.e., θ \sim \mathcal{N}(0,1), and β \sim \mathcal{N}(0,1) or the the person parameters will be sampled uniformly within the range of the item parameters.
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 |
dat |
: data frame containing the binary responses of |
probs |
: A matrix containing the probabilities of positive response from |
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. |
Spyros E. Balafas (auth.), Wim P. Krijnen (auth.), Wendy J. Post (contr.), Ernst C. Wit (auth.)
Maintainer: Spyros E. Balafas (s.balafas@rug.nl)
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.
## Not run: ## Simulate 5 different scenarios n.seed <- 10 sim1 <- mudfoldsim(N=6, n=100, gamma1=5, gamma2=-10, zeros=FALSE,seed=n.seed) sim2 <- mudfoldsim(N=10,n=1000,gamma1=10,gamma2=-100,zeros=FALSE,seed=n.seed) sim3 <- mudfoldsim(N=15,n=2000,gamma1=50,gamma2=-100,zeros=FALSE,seed=n.seed) sim4 <- mudfoldsim(N=30,n=2000,gamma1=50,gamma2=-100,zeros=FALSE,seed=n.seed) sim5 <- mudfoldsim(N=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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.