gen.weight {irtQ}R Documentation

Generate Weights

Description

This function generates a set of normalized weights based on theta (ability) values to be used in functions such as est_score(), sx2_fit(), and covirt().

Usage

gen.weight(n = 41, dist = "norm", mu = 0, sigma = 1, l = -4, u = 4, theta)

Arguments

n

An integer specifying the number of theta (node) values for which weights are to be generated. Default is 41.

dist

A character string indicating the distribution type used to generate weights. Available options are "norm" for a normal distribution, "unif" for a uniform distribution, and "emp" for an empirical distribution.

  • If dist = "norm", either n or theta must be provided.

  • If dist = "unif", only n is applicable.

  • If dist = "emp", only theta must be specified.

mu, sigma

Mean and standard deviation of the normal distribution (used when dist = "norm").

l, u

Lower and upper bounds of the uniform distribution (used when dist = "unif").

theta

A numeric vector of empirical theta (node) values for which weights are generated.

Details

If theta is not specified, n equally spaced quadrature points and corresponding weights are generated from either the normal or uniform distribution:

If theta is specified:

Value

A data frame with two columns:

Author(s)

Hwanggyu Lim hglim83@gmail.com

See Also

est_score(), sx2_fit(), covirt()

Examples

## Example 1:
## Generate 41 Gaussian quadrature points and weights from the normal distribution
gen.weight(n = 41, dist = "norm", mu = 0, sigma = 1)

## Example 2:
## Generate 41 theta values and weights from the uniform distribution,
## given a minimum value of -4 and a maximum value of 4
gen.weight(n = 41, dist = "unif", l = -4, u = 4)

## Example 3:
## Generate normalized weights from the standard normal distribution,
## given a user-defined set of theta values
theta <- seq(-4, 4, by = 0.1)
gen.weight(dist = "norm", mu = 0, sigma = 1, theta = theta)

## Example 4:
## Generate equal normalized weights for theta values
## randomly sampled from the standard normal distribution
theta <- rnorm(100)
gen.weight(dist = "emp", theta = theta)


[Package irtQ version 1.0.0 Index]