gen_test_score {lazy.tools}R Documentation

Generating Test Score Distribution

Description

This function generates a frequency distribution table of n discrete test scores in [minscore,maxscore].

Usage

gen_test_score(n, minscore = 0, maxscore = 100, normal = c(50, 15),
  beta = NULL, dump = 0, print = 0, plot = 0,
  title = "Score Distribution")

Arguments

n

# of observations.

minscore

The minimum score.

maxscore

The maximum score.

normal

Vector consisting of mean and std for normal distribution.

beta

Vector of alpha and beta parameters for beta distribution in [minscore,maxscore].

dump

= 1 to output the discrete random numbers.

print

= 1 to print the result.

plot

= 1 to plot the result.

title

Title string to be used in plot.

Details

This function generates a frequency distribution table of n discrete test scores in [minscore,maxscore].

Continuous random numbers, either normal or generalized beta, are first generated and then they are discretized by cut function. Those values outside of [minscore,maxscore] will be set to minscore or maxscore, resp.

beta parameter has priority over nomal parameter.

Value

If dump == 0, a matrix consisting of (score, frequency).
otherwise, a list of rv, random numbers, and freqdist matrix.

Examples

seed <- 1701
set.seed(seed)

minscore <- 0; maxscore <- 50
n <- 500

scoredist1 <- gen_test_score( n, minscore, maxscore, beta=c(4,8), plot=1 )
scoredist2 <- gen_test_score( n, minscore, maxscore, normal=c(30,5), plot=1)
# mixture
scoredist12 <- merge_tables( scoredist1,scoredist2 )
barplot(height=scoredist12[,2], names.arg=as.character(scoredist12[,1])
        , main="Score Dist", cex.names=.65, space=0, las=2)


[Package lazy.tools version 0.1.3 Index]