undiff_Sigma: Transform differenced to non-differenced error term...

View source: R/model_fitting.R

undiff_SigmaR Documentation

Transform differenced to non-differenced error term covariance matrix

Description

This function transforms the differenced error term covariance matrix Sigma back to a non-differenced error term covariance matrix.

Usage

undiff_Sigma(Sigma, i, checks = TRUE, pos = TRUE, labels = TRUE)

Arguments

Sigma

An error term covariance matrix of dimension J-1 x J-1 which was differenced with respect to alternative i.

i

An integer, the alternative number with respect to which Sigma was differenced.

checks

If TRUE the function runs additional input and transformation checks.

pos

If TRUE the function returns a positive matrix.

labels

If TRUE the function adds labels to the output matrix.

Value

A covariance matrix of dimension J x J. If this covariance matrix gets differenced with respect to alternative i, the results is again Sigma.

Examples

J <- 3
i <- 2
Sigma_full <- rwishart(3, diag(3))$W
Sigma <- delta(J, 2) %*% Sigma_full %*% t(delta(J, 2))
Sigma_back <- RprobitB:::undiff_Sigma(Sigma = Sigma, i = 2)

RprobitB documentation built on Nov. 10, 2022, 5:12 p.m.