% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/eq.R
\name{eq}
\alias{eq}
\title{Observed Score Equating}
\usage{
eq(
  score1,
  freq1,
  cdf1 = NULL,
  score2,
  freq2,
  cdf2 = NULL,
  lim1 = NULL,
  lim2 = NULL,
  smooth1 = 0,
  bandwid1 = 3,
  smooth2 = 0,
  bandwid2 = 3,
  method = 2,
  interpol_method = "linear",
  title = "",
  nolow = 0,
  round = 1,
  print = 1,
  plot = 1
)
}
\arguments{
\item{score1}{a vector consisting of the score of test1}

\item{freq1}{a vector consisting of the frequency counts at score1}

\item{cdf1}{a vector consisting of the cumulative frequencies at score1}

\item{score2}{a vector consisting of the score of test2}

\item{freq2}{a vector consisting of the frequency counts at score2}

\item{cdf2}{a vector consisting of the cumulative frequencies at score2}

\item{lim1}{min and max score of test1}

\item{lim2}{min and max score of test2}

\item{smooth1}{# of times to smooth cdf1}

\item{bandwid1}{bandwidth for running average smooth of cdf1}

\item{smooth2}{# of times to smooth cdf2}

\item{bandwid2}{bandwidth for running average smooth of cdf2}

\item{method}{= 1 to use linear equating \cr
= 2 to use equi-percentile equating}

\item{interpol_method}{= "constant", "linear" or "spline"}

\item{title}{title string}

\item{nolow}{= 1 to avoid lowering scores}

\item{round}{= 0 not to round the result to integer. (not yet available)}

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

\item{plot}{= 1 to plot the conversion table \cr
= 2 to plot the cdf \cr
= 3 to plot the smoothed cdf}
}
\value{
a list of the following:\cr
ctable: the conversion table consisting of (score, score21, freq1) \cr
mands:  the summary stat of the converted score dist: (score21,freq1) \cr
newfreq: the frequency distribution of the converted score (score21, freq21)
\cr
sdist1 and sdist2: input and smoothed score distributions \cr
cntr: a list of control parameters used.

\code{ctable} shows that
test score score1[i] of test1 is equivalent to
test score score21[i] of test2.
}
\description{
This performs the observed score equating of
the test score 1 to the test score 2.
}
\details{
Equipercentile equating of test1 score \code{x1} to test2 score \code{x2}
 is defined as\cr
\preformatted{
 x21 = invF2( F1(x1) )
}
where \code{F1} is the distribution function of \code{x1} and
\code{invF2} is the inverse of the distribution function of \code{x2}.
In this function, \code{invF2} is calculated by interpolating
\code{( F2(x2), x2 )} at \code{F1(x1)} with or without smoothing.

Equipercentile equating is essentially the same as native \code{qqplot}. \cr
Therefore, the following two codes produce similar results: \cr
\preformatted{
 eq( score1=score1, freq1=freq1, score2=score2, freq2=freq2 )
 qqplot( expand_freqdist( score1, freq1 )
             , expand_freqdist( score2, freq2 ), type="l" )
}
Note that, since native \code{qqplot} cannot handle case weight,
\code{lazy.tools::expand_freqdist} is used to recover the raw data
from frequency table.


\code{cdf} has priority over \code{freq}.
}
\examples{

seed <- 1701
set.seed(seed)

scoredist1 <- gen_test_score( 500, 0,10, beta=c(2,4), plot=1 )
scoredist2 <- gen_test_score( 1000, 0,15, beta=c(4,2), plot=1 )
reseq <- eq( score1=scoredist1[,1], freq1=scoredist1[,2]
           , score2=scoredist2[,1], freq2=scoredist2[,2]
           , smooth1=3, smooth2=3, method=2, plot=3 )

}
