% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gen_test_score.R
\name{gen_test_score}
\alias{gen_test_score}
\title{Generating Test Score Distribution}
\usage{
gen_test_score(
  n,
  minscore = 0,
  maxscore = 100,
  normal = c(50, 15),
  beta = NULL,
  beta_ms = NULL,
  dump = 0,
  print = 0,
  plot = 0,
  title = "Score Distribution"
)
}
\arguments{
\item{n}{# of observations.}

\item{minscore}{The minimum score.}

\item{maxscore}{The maximum score.}

\item{normal}{Vector consisting of mean and std for normal distribution.}

\item{beta}{Vector of alpha and beta parameters for beta distribution
in [minscore,maxscore].}

\item{beta_ms}{Vector of mean and std of the generalized beta distribution
in [minscore,maxscore].}

\item{dump}{= 1 to output the discrete random numbers.}

\item{print}{= 1 to print the result.}

\item{plot}{= 1 to plot the result.}

\item{title}{Title string to be used in plot.}
}
\value{
If dump == 0, a matrix consisting of (score, frequency). \cr
otherwise, a list of rv, random numbers, and freqdist matrix.
}
\description{
This function generates a frequency distribution table
 of n discrete test scores in [minscore,maxscore].
}
\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_ms parameter has the priority over beta and nomal parameter.
}
\examples{
seed <- 1701
set.seed(seed)

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

s1 <- gen_test_score( n, minscore, maxscore, beta=c(4,8), plot=1 )
( mands(s1[,1],s1[,2]) )
s2 <- gen_test_score( n, minscore, maxscore
                    , beta_ms=c(33.29, 13.07), plot=1 )
( mands(s2[,1],s2[,2]) )

# mixture
minscore <- 0; maxscore <- 50
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)
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)

}
