\name{TimelessNormalParam} \alias{TimelessNormalParam} \alias{getmu} \alias{getSigma} \alias{getiSigma} \alias{is.pd} \title{Parameter for the TimelessNormalPM } \description{ The \code{\link{TimelessNormalPM}} is a proficiency model for a single time point where the proficiency itself is considered multidimesional. The parameter consists of a mean vector (\code{mu}) and a covariance matrix (\code{Sigma}). } \usage{ TimelessNormalParam(mu=numeric(),Sigma=matrix(),is.pd=is.pdm(Sigma), iSig=solve(Sigma)) getmu(param) getmu(param) <- m getSigma(param) getSigma(param) <- S getiSigma(param) } \arguments{ \item{mu}{ A mean vector for a multivate normal distribuiton. This should have conformable dimensions with the \code{Sigma} argument. } \item{Sigma}{ A square covariance matrix. The number of rows and columns should equal the length of \code{mu}. Although \code{Sigma} should normally be positive definite, the various functions using this class should fail gracefully if that is not true. } \item{is.pd}{A logical value, whether or not \code{Sigma} is posivite definite. This could be the case if say, a Newton-type optimizer took a step outside of the legal values for a covariance matrix. The default value runs the function \code{\link{is.pd}} to check, so this should be fine.} \item{iSig}{If supplied, this should be then inverse of \code{Sigma} (if Sigma is positive definite). Note that if \code{iSig} and not \code{Sigma} is not supplied, then \code{Sigma} will be calculated by inverting \code{iSig}.} \item{param}{ A \code{TimelessNormalParam} object whose paramers are desired. } \item{m}{ A mean vector for a multivate normal distribuiton. This should have conformable dimensions with the \code{Sigma} argument. } \item{S}{ A square covariance matrix. The number of rows and columns should equal the length of \code{mu}. Although \code{Sigma} should normally be positive definite, the various functions using this class should fail gracefully if that is not true. } } \details{ This class is the parameter object corresponding to the \code{\link{TimelessNormalPM}} object. The slot \code{mu} contains the mean vector and the slot \code{Sigma} contains the covariance matrix. Note that many routines use the precision matrix (inverse variance matrix) so this is cached as \code{iSig}. It is possible when using the various optimization algorithms and the \code{\link{pvec}()} function, that a covariance matrix will be modified in such a way that it is no longer positive definite. The flag \code{is.pd} is used to test for this case. Functions using this class should always test this flag before using the parameter object. The constructor function as well as the setter method \code{getSigma(param) <- S} (and the \code{pvec(param)} setter) automatically check the positive definite flag and calculate the inverse the matrix is positive definite. } \value{ A \code{TimelessNormalParam} object with slots: \item{mu}{Mean vector} \item{Sigma}{Covariance matrix}. \item{is.pd}{A logical flag which indicates whether the covariance matrix is positive definite.} \item{iSig}{Precision (inverse covariance) matrix. Note that if the covariance matrix is not positive definite, this may return \code{matrix(NA)}.} The functions \code{getmu}, \code{getSigma}, \code{is.pd} and \code{getiSigma} return the value of the corresponding slots. } \references{ %% ~put references to the literature/web site here ~ } \author{Russell Almond} \seealso{ Superclass: \code{\link{ParameterObject}} Subclasses: \code{\link{TimeInvariantNormalParam}} Used By: \code{\link{TimelessNormalPM}} } \examples{ p1 <- TimelessNormalParam(mu=c(Mechanics=2,Fluencey=2), Sigma=matrix(c(.7,.3,.3,.7),2,2)) stopifnot(is.pd(p1)) getmu(p1) getSigma(p1) stopifnot(all(abs(getiSigma(p1)-solve(getSigma(p1))) < sqrt(.Machine$double.eps))) pvec(p1) pvec(p1)[2]<-3 stopifnot(all(abs(getmu(p1)-c(2,3)) < sqrt(.Machine$double.eps))) ## Setting off-diagonal element of covariance matrix pvec(p1)[5]<-.5 stopifnot(all(abs(as.vector(getSigma(p1)) - c(.7,.5,.5,.7)) < sqrt(.Machine$double.eps))) ## Supplying precision matrix rather than covariance p2 <- TimelessNormalParam(mu=c(Mechanics=2,Fluencey=3), iSig = getiSigma(p1)) stopifnot(all(abs(getSigma(p1)-getSigma(p2)) < sqrt(.Machine$double.eps))) ## Test of making a singular matrix. pvec(p2)[5] <- pvec(p2)[4] stopifnot(!is.pd(p2)) print("This next command should generate a singular matrix error.") stopifnot(class(try(getiSigma(p2))=="try-error")) } \keyword{ class }