QFun: Extract Q-Function

View source: R/GoF.R

QFunR Documentation

Extract Q-Function

Description

QFun’ extracts the values of the Q-function from an R object inheriting class ‘cglasso’.

Usage

QFun(object, mle, verbose = FALSE, ...)

Arguments

object

an R object inheriting class ‘cglasso’, that is, the output of the model-fitting functions cglasso and cggm.

mle

logical. Should Q-values be computed using the maximum likelihood estimates? Default depends on the class of the argument object: mle = FALSE for objects with class cglasso and mle = TRUE for objects with class cggm.

verbose

logical for printing out a progress bar on the R console. Default is verbose = FALSE.

...

further arguments passed to cggm.

Details

QFun’ returns the value of the Q-function, i.e., the value of the function maximised in the M-step of the EM algorithm. The Q-function is defined as follows:

n/2 {log det Tht - tr(S Tht) - p log(2 pi)},

where S is the ‘working’ empirical covariance matrix computed during the E-step.

QFun is used as a workhorse function to compute the measures of goodness-of-fit returned by the functions AIC.cglasso and BIC.cglasso.

The function ‘print.QFun’ is used the improve the readability of the results.

Value

QFun’ returns an R object of S3 class “QFun”, i.e., a named list containing the following components:

value

a matrix with the values of the Q-function.

df

a matrix with the number of estimated non-zero parameters.

dfB

a matrix with the number of estimated non-zero regression coefficients.

dfTht

a matrix with the number of estimated non-zero partial correlation coefficients.

n

the sample size.

p

the number of response variables.

q

the number of columns of the design matrix X used to fit the model.

lambda

the lambda-values used to fit the model.

nlambda

the number of lambda-values.

rho

the rho-values used to fit the model.

nrho

the number of rho-values.

model

a description of the fitted model passed through the argument object.

Author(s)

Luigi Augugliaro (luigi.augugliaro@unipa.it)

See Also

AIC.cglasso, BIC.cglasso, cglasso, cggm, summary.cglasso, select.cglasso and to_graph.

Examples

set.seed(123)
# Y ~ N(b0+ XB, Sigma)  and
# 1. probability of left/right censored values equal to 0.05
# 2. probability of missing-at-random values equal to 0.05
n <- 100L
p <- 3L
q <- 2L
b0 <- runif(p)
B <- matrix(runif(q * p), nrow = q, ncol = p)
X <- matrix(rnorm(n * q), nrow = n, ncol = q)
rho <- 0.3
Sigma <- outer(1:p, 1:p, function(i, j) rho^abs(i - j))
Z <- rcggm(n = n, b0 = b0, X = X, B = B, Sigma = Sigma, probl = 0.05, probr = 0.5, 
           probna = 0.05)
out <- cglasso(. ~ ., data = Z)
QFun(out)

out.mle <- cggm(out, lambda.id = 3L, rho.id = 3L)
QFun(out.mle)

cglasso documentation built on Jan. 17, 2023, 5:10 p.m.