\name{drawObs} \alias{drawObs} \alias{llikeObs} \title{Draws observable values or calculates their likelihood } \description{ The function \code{drawObs} takes an evidence model, an associated parameter object, and a matrix of latent profiles and generates an observed response vector for each profile. The function \code{llObs} takes an evidence model, its associated parameter, and a matrix of latent profiles, and a matrix of observation vectors and calculates the log priors for those observations. } \usage{ drawObs(em, latent, background = NA, QQ=Q(em), param=parameters(em)) llikeObs(em, obs, latent, background = NA, QQ=Q(em), param=parameters(em)) } \arguments{ \item{em}{ An object of class \code{\link{EvidenceModel}}. } \item{obs}{ A matrix of observation vectors corresponding whose likelihood should be evaluated. It should be true that either \code{nrow(latent) == nrow(obs)} or \code{nrow(latent)==1}. It should also be true that \code{ncol(obs) == nobserved(em)}. } \item{latent}{ A matrix of latent vectors corresponding to the individuals represented in the observations. It should be true that \code{ncol(latent) == ncol(QQ)}. } \item{background}{ An optional set of background (demographic) variables. Some proficiency model types ignore background variables. } \item{QQ}{A Q-matrix to use (only needed if different from the one stored with the evidence model).} \item{param}{ An object representing the parameters of \code{em}. The type required is determined by the class of \code{em}. } } \details{ The function \code{drawObs} draws an observation vector for each latent profile in \code{latent}. The function \code{llObs} evaluates the prior distribution at each row of the \code{obs} matrix. A log prior value is generated for each row of \code{obs}. Each concrete subclass of \code{EvidenceModel} has a corresponding parameter class. The class of the \code{param} argument should be the appropriate parameter class for the \code{em} argument. } \value{ The function \code{drawObs} returns a matrix with \code{nrow(latent)} rows and \code{nobserved(em)} columns. The function \code{llObs} returns a vector log prior values with a number of elements equal to \code{nrow(obs)}. } \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) Q <- matrix(c(1,0,1,1),2,2) em1 <- new("FixedQNormalEM", Q=Q, zMean=c(Mechanics=0,Fluency=0), zStd=diag(c(1,1)), Rmean=matrix(c(.7,.3,.3,.7),2,2), Rdf=3, hMean=c(1,1,.5), hStd=rep(.25,3)) parameters(em1) <- drawEMParam(em1) em1.obs10 <- drawObs(em1,pm1.stud10) llikeObs(em1,em1.obs10,pm1.stud10) } \keyword{ distribution } \keyword{ random }