\name{drawInitialLatent} \alias{drawInitialLatent} \alias{lpriorLatent} \title{Draws initial values for a latent variable or calculates its log prior } \description{ The function \code{drawIntialLatent} takes a proficiency model and an associated parameter object and generates the specified number of random latent profiles. The function \code{lpriorLatent} takes a proficiency model, its associated parameter, and a matrix of latent profiles and calculates the log priors for those profiles. } \usage{ drawInitialLatent(pm, ncases = 1, background = NA, param=parameters(pm)) lpriorLatent(pm, latent, background = NA, param=parameters(pm)) } \arguments{ \item{pm}{ An object of class \code{\link{ProficiencyModel}}. } \item{ncases}{ The number of latent profiles to be generated. } \item{latent}{ A matrix of latent vectors whose likelihood is to be evaluated. It should be true that \code{ncol(obs) == nlatent(pm)}. } \item{background}{ An optional set of background (demographic) variables. Some proficiency model types ignore background variables. } \item{param}{ An object representing the parameters of \code{pm}. The type required is determined by the class of \code{pm}. } } \details{ The function \code{drawIntialLatent} draws the initial latent values. It outputs a matrix whose rows are cases, and whose columns represent the latent variables. The function \code{lpriorLatent} evaluates the prior distribution at each row of the \code{latent} matrix. A log prior value is generated for each row of \code{latent}. Each concrete subclass of \code{ProficiencyModel} has a corresponding parameter class. The class of the \code{param} argument should be the appropriate parameter class for the \code{pm} argument. } \value{ The function \code{drawIntialLatent} returns a matrix with \code{ncases} rows and \code{nlatent(pm)} columns. The function \code{lpriorLatent} returns a vector log prior values with a number of elements equal to \code{nrow(latent)}. } \references{ %% ~put references to the literature/web site here ~ } \author{Russell Almond} \seealso{ \code{\link{ProficiencyModel}} } \examples{ pm1 <- TimelessNormalPM(muMean=c(Mechanics=2,Fluency=2), varWeight=3, precScale=solve(matrix(c(.7,.3,.3,.7),2,2)), Sdf=3) parameters(pm1) <- drawPMParam(pm1) pm1.stud10 <- drawInitialLatent(pm1,10) lpriorLatent(pm1,pm1.stud10) } \keyword{ distribution } \keyword{ random }