GetDeltaMethodParameters: GetDeltaMethodParameters

Description Usage Arguments Value Examples

View source: R/Disequilibrium.R

Description

Transforms the mean and variance covariance matrix of the estimators in an unrestricted space to a positive definite space for the delta method.

Usage

1
GetDeltaMethodParameters(mu, covmat = NULL, MaskRho = FALSE)

Arguments

mu

A numeric vector output from DE()$par

covmat

A numeric matrix output from DE()$vcov

MaskRho

The output from DE()$MaskRho

Value

A list containing the parameters of the normal distribution after transforming the coavariance variables to a positive definite space

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
set.seed(1775)
library(MASS)
beta01 = c(1,1)
beta02 = c(-1,-1)
N = 10000
SigmaEps = diag(2)
SigmaX = diag(2)
MuX = c(0,0)
par0 = c(beta01, beta02, SigmaX[1, 1], SigmaX[1, 2], SigmaX[2, 2])

Xgen = mvrnorm(N,MuX,SigmaX)
X1 = cbind(1,Xgen[,1])
X2 = cbind(1,Xgen[,2])
X = list(X1 = X1,X2 = X2)
eps = mvrnorm(N,c(0,0),SigmaEps)
eps1 = eps[,1]
eps2 = eps[,2]
Y1 = X1 %*% beta01 + eps1
Y2 = X2 %*% beta02 + eps2
Y = pmin(Y1,Y2)
df = data.frame(Y = Y, X1 = Xgen[,1], X2 = Xgen[,2])

results = DE(formula = Y ~ X1 | X2, data = df)

GetDeltaMethodParameters(results$par,results$vcov,results$MaskRho)

Disequilibrium documentation built on July 2, 2020, 3:27 a.m.