discrete_cov: Discrete covariance-matrix functions

Description Usage Arguments Details Value See Also Examples

Description

Discrete covariance-matrix functions return a covariance matrix that does not depend on evaluation points t. Possibilities are zero_cov, id_cov, diag_cov and unstr_cov. See details for further information.

Usage

1
2
3
4
5
6
7
8
9
zero_cov(t, param = NULL)

id_cov(t, param = c(scale = 1))

const_cov(t, param = c(scale = 1))

diag_cov(t, param)

unstr_cov(t, param)

Arguments

t

evaluation points.

param

parameters for the covariance matrix.

Details

The discrete covariance-matrix functions return m x m covariance matrices where m is the length of t. They are discrete in the sense that they do not depend on the specific evaluation points t. These covariance matrix functions are mainly used to model latent variables.

zero_cov returns an m x m zero matrix.

id_cov returns an m x m identity matrix.

const_cov returns an m x m matrix consisting of all ones. Note: this covariance matrix has rank 1 and is thus generally not positive definite.

diag_cov returns an m x m diagonal matrix with param on the diagonal.

unstr_cov returns an unstructured m x m covariance matrix with the diagonal given by the first m elements in param, and the remaining filling the upper and lower triangles. If the supplied parameters does not specify a positive definite matrix, the function tries to return the nearest positive definite matrix (see nearPD). This may cause unstr_cov to be slow if m is not small.

Value

Covariance matrix of dimension m x m where m is the length of t.

See Also

make_cov_fct

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Evaluation points
t <- 0:1
# Generate zero, identity and constant covariance matrices
zero_cov(t)
id_cov(t)
const_cov(t)

# Generate diagonal covariance
diag_cov(t, param = 1:2)

# Generate unstructured covariance matrix
unstr_cov(t, param = c(1, 1, 0.5))

# Generate unstructured covariance matrix with parameters
# that will not produce a positive matrix
(C <- unstr_cov(t, param = c(1, 1, 1.1)))
det(C)

larslau/pavpop documentation built on June 14, 2019, 2:18 p.m.