r_identified: Random generation from the distribution of true or observed...

View source: R/r_identified_function.R

r_identifiedR Documentation

Random generation from the distribution of true or observed scores for identified students

Description

This function samples random variates from the distribution of true scores for identified students using rejection sampling.

Usage

r_identified(
  n,
  relyt = 1,
  test.cutoff,
  valid = 1e-07,
  nom.cutoff = 1e-07,
  mu = 0
)

Arguments

n

The number of values to sample.

relyt

Confirmatory test reliability coefficient. Range (0, 1]. Must not be exactly 0. Defaults to 1; in this case, the returned values are observed scores. If an alternative value is supplied for relyt, the returned values are true scores.

test.cutoff

Confirmatory test cutoff percentile. Range (0, 1). Must not be exactly 0 or 1.

valid

Nomination validity coefficient. Controls the relatedness of the nomination scores and the confirmatory test scores. Range (0, 1). Must not be exactly 0 or 1, and must be less than the square root of the test reliability.

nom.cutoff

Nomination cutoff percentile. Range (0, 1). Must not be exactly 0 or 1.

mu

Population mean true score on a standardized (z-score) metric. Defaults to zero.

Details

The returned values are interpreted as true scores if a value is provided for argument relyt; otherwise, they are observed scores. See also d_identified for the normalized density, p_identified for the cumulative density function, and q_identified for the quantile function.

Examples

# generate true scores
r_identified(
  n = 10, relyt = .9, valid = .6,
  test.cutoff = .9, nom.cutoff = .1, mu = 0
)

# generate observed scores
r_identified(
  n = 10, relyt = .9, valid = .6,
  test.cutoff = .9, nom.cutoff = .1, mu = 0
)

# make a histogram of data from 100000 draws
draws <- r_identified(
  n = 100000, relyt = .99, valid = .6,
  test.cutoff = .95, nom.cutoff = .9, mu = 0
)
hist(draws, breaks = 80, freq = FALSE, xlab = "True score")

# superimpose the theoretical density

# create vector of true scores
Tscores <- seq(0, 4, length.out = 200)

# add the density to the histogram
p.id <- sapply(Tscores, d_identified,
  relyt = .99,
  test.cutoff = .95, nom.cutoff = .9, valid = .6
)

points(x = Tscores, y = p.id, type = "l", col = "red")

mcbeem/giftedCalcs documentation built on May 3, 2022, 3:34 a.m.