id_sim_gen: Simulate IRT ideal point data

View source: R/Simulate.R

id_sim_genR Documentation

Simulate IRT ideal point data

Description

A function designed to simulate IRT ideal point data.

Usage

id_sim_gen(
  num_person = 20,
  num_items = 50,
  cov_effect = NULL,
  model_type = "binary",
  latent_space = FALSE,
  absence_discrim_sd = 3,
  absence_diff_mean = 0,
  discrim_reg_upb = 1,
  discrim_reg_lb = -1,
  discrim_miss_upb = 1,
  discrim_miss_lb = -1,
  discrim_reg_scale = 2,
  discrim_reg_shape = 2,
  discrim_miss_scale = 2,
  discrim_miss_shape = 2,
  diff_sd = 3,
  time_points = 1,
  time_process = "random",
  time_sd = 0.1,
  ideal_pts_sd = 3,
  prior_type = "gaussian",
  ordinal_outcomes = 3,
  inflate = FALSE,
  sigma_sd = 1,
  spline_knots = NULL,
  spline_degree = 2,
  spline_intercept_sd = 0.5,
  spline_basis_sd = 0.5,
  phi = 1
)

Arguments

num_person

The number of persons/persons

num_items

The number of items (bills in the canonical ideal point model)

cov_effect

The effect of a hierarchical/external covariate on the person ideal points. The covariate will be a uniformly-distributed random variable on the [0,1] scale, so covariate effects in the [-2,2] approximate range would result in noticeable effects on the ideal point scale.

model_type

One of 'binary', 'ordinal_rating', 'ordinal_grm', 'poisson' 'normal', or 'lognormal'

latent_space

Whether to use the latent space formulation of the ideal point model FALSE by default. NOTE: currently, the package only has estimation for a binary response with the latent space formulation.

absence_discrim_sd

The SD of the discrimination parameters for the inflated model

absence_diff_mean

The mean intercept for the inflated model; increasing it will lower the total number of missing data

discrim_reg_upb

The upper bound of the generalized Beta distribution for the observed discrimination parameters (gamma)

discrim_reg_lb

The lower bound of the generalized Beta distribution for the observed discrimination parameters (gamma)

discrim_miss_upb

The upper bound of the generalized Beta distribution for the missingness discrimination parameters (nu)

discrim_miss_lb

The lower bound of the generalized Beta distribution for the missingness discrimination parameters (nu)

discrim_reg_scale

The scale parameter for the generalized Beta distribution for the observed discrimination parameters (gamma)

discrim_reg_shape

The shape parameter for the generalized Beta distribution for the observed discrimination parameters (gamma)

discrim_miss_scale

The scale parameter for the generalized Beta distribution for the missingness discrimination parameters (nu)

discrim_miss_shape

The shape parameter for the generalized Beta distribution for the missingness discrimination parameters (nu)

diff_sd

The SD of the difficulty parameters (bill/item intercepts) for both missing and observed parameters (beta and omega)

time_points

The number of time points for time-varying legislator/person parameters

time_process

The process used to generate the ideal points: either 'random' for a random walk, 'AR' for an AR1 process, 'GP' for a Gaussian process, or 'splines' for a spline (see parameters spline_knots and spline_degree).

time_sd

The standard deviation of the change in ideal points over time (should be low relative to ideal_pts_sd)

ideal_pts_sd

The SD for the person/person ideal points

prior_type

The statistical distribution that generates the data for ideal point parameters (alpha) and difficulty intercepts (beta and omega). Currently only 'gaussian' is supported.

ordinal_outcomes

If model is 'ordinal', an integer giving the total number of categories

inflate

If TRUE, an missing-data-inflated dataset is produced.

sigma_sd

If a normal or log-normal distribution is being fitted, this parameter gives the standard

spline_knots

Number of knots (essentially, number of points at which to calculate time-varying ideal points given T time points). Default is NULL, which means that the spline is equivalent to polynomial time trend of degree spline_degree. Note that the spline number (if not null) must be equal or less than the number of time points.

spline_degree

The degree of the spline polynomial. The default is 2 which is a quadratic polynomial. A value of 1 will result in independent knots (essentially pooled across time points T). A higher value will result in wigglier time series.

spline_intercept_sd

The SD of the Normal distribution (centered on 0) used to draw the intercept for the basis spline function

spline_basis_sd

The SD of the Normal distribution (centered on 0) for the coefficients used to create the simulated ideal points from the spline function

phi

The phi (dispersion) parameter for the ordered beta distribution deviation of the outcome (i.e. the square root of the variance).

Details

This function produces simulated data that matches (as closely as possible) the models used in the underlying Stan code. Currently the simulation can produce inflated and non-inflated models with binary, ordinal (GRM and rating-scale), Poisson, Normal and Log-Normal responses.

Value

The results is a idealdata object that can be used in the id_estimate function to run a model. It can also be used in the simulation plotting functions.

See Also

id_plot_sims for plotting fitted models versus true values.


saudiwin/idealstan documentation built on April 11, 2025, 4:37 p.m.