Learn R Programming

LMN (version 1.1.3)

lmn_loglik: Loglikelihood function for LMN models.

Description

Loglikelihood function for LMN models.

Usage

lmn_loglik(Beta, Sigma, suff)

Value

Scalar; the value of the loglikelihood.

Arguments

Beta

A p x q matrix of regression coefficients (see lmn_suff()).

Sigma

A q x q matrix of error variances (see lmn_suff()).

suff

An object of class lmn_suff (see lmn_suff()).

Examples

Run this code
# generate data
n <- 50
q <- 3
Y <- matrix(rnorm(n*q),n,q) # response matrix
X <- 1 # intercept covariate
V <- 0.5 # scalar variance specification
suff <- lmn_suff(Y, X = X, V = V) # sufficient statistics

# calculate loglikelihood
Beta <- matrix(rnorm(q),1,q)
Sigma <- diag(rexp(q))
lmn_loglik(Beta = Beta, Sigma = Sigma, suff = suff)

Run the code above in your browser using DataLab