RlogLikelihood {WMCapacity}R Documentation

Compute various quantities relating to the working memory models in the package WMCapacity

Description

These functions will compute the log-likelihood, log-posterior, and the gradient of the log-posterior for the multinomial tree models of working memory capacity in the package WMCapacity. These functions are not meant to be called by the user.

Usage

     RlogLikelihood(x,setup)
     
     RlogPosterior(x,setup)
    
     RgradLogPosterior(x,setup)
     
     RlogPosteriorWithCov(x,setup,precList,means)
         
     RgradLogPosteriorWithCov(x,setup,precList,means)
     

Arguments

x the vector containing values at which to evaluate the function.
setup an object of class WM2Package, containing the model information.
precList a list of length equal to the number of covariance matrices modelled. Each element of the list must be a square matrix, representing a precision matrix of appropriate size. The sizes are determined by the model specification.
means A matrix with rows corresponding to the precision matrices, and columns correpsonding to the parameters involved in the precision matrices. The number of rows will be the number of precision matrices modelled, and the number of columns will be equal to the number of columns in the largest precision matrix.

Details

The RlogLikelihood function computes the log-likelihood of the model at the given values. This is used internally for computing the deviance information criterion (DIC) value.

The RlogPosterior function computes the (negative) log-posterior of the model at the given values. This is used internally for obtaining starting values for MCMC.

The RgradLogPosterior function computes the (negative) gradient of the log-posterior of the model at the given values. This is used internally for obtaining starting values for MCMC.

The RlogPosteriorWithCov and RgradLogPosteriorWithCov compute the (negative) log-posterior and (negative) gradient, respectively. The difference between these two functions and the two above (without covariances) is that these two functions are designed for models with covariance matrices defined. The log-posterior and gradient will be conditioned on the given covariance matrices and means.

For further details, see the user's manual at http://drsmorey.org/research/rdmorey/.

Value

For the likelihood and posterior functions, a single value. For the gradient functions, a vector of the same length as the parameter vector. Each element repesents the partial derivative at the given value.

See Also

WMCapacityGUI, for fitting the working memory models.

Examples

     ## Not run: 
     ## load Visual Array data set (Rouder et al., 2008)
     data(VisualArray)

     output = WMCapacityGUI(data=VisualArray)
     
     # compute log-likelihood at posterior mean 
     RlogLikelihood(output@output@par[,5],output)
     ## End(Not run)
     
     

[Package WMCapacity version 0.9.1 Index]