covest.SGB: Classical and robust asymptotic covariance matrix

Description Usage Arguments Details Value References See Also Examples

View source: R/covest.SGB.R

Description

Computation of two covariance matrices of the estimators of parameters in a SGB regression. The first is based on the Hessian and the second is the sandwich estimator.

Usage

1
2
covest.SGB(x, d, u, V, weight=rep(1,dim(d)[1]), x0 = NULL, hessian = NULL, ind = NULL, 
    shape1 = NULL)

Arguments

x

vector of parameters (shape1,coefi,shape2) where shape1 is the overall shape, coefi is the vector of regression coefficients (see initpar.SGB) and shape2 the vector of the D Dirichlet shape parameters; D: number of parts. shape1 and shape2 must be positive.

d

data matrix of explanatory variables (with constant vector if required in the model) (n \times m); n: sample size, m: number of auxiliary variables.

u

data matrix of compositions (variables to be explained) n \times D.

V

full rank transformation of log(parts) into log-ratios, matrix D \times (D-1).

weight

vector of length n; positive observation weights, default rep(1,n). Should be scaled to sum to n.

x0

specification of the initial parameter vector of length npar (optional), default: NULL, no specification.

hessian

Hessian matrix (optional), see regSGB, default: NULL, no specification. In this case the Hessian is computed numerically.

ind

vector of length equal to the number of fixed parameters; specifies the indices of the fixed components in the vector of parameters x (possible for shape1 and coefi (regression coefficients) only).

shape1

fixed value of the overall shape parameter, if heq = heqa.SGB or heq = heqab.SGB. Default is 1.

Details

This function is internally called by regSGB. In this case the Hessian is the output of auglag and is numerically computed.
A design based covariance matrix of the parameters can be obtained by linearization as the covariance matrix of the scores.

Value

a list with

summary

Data frame with
Initial = x0 (if specified),
Estimate = x,
StdErr1 = ordinary asymptotic standard error of parameters,
StdErr = robust asymptotic standard error,
p.value = asymptotic normal p-value based on StdErr. For shape1, H_0 is "shape1=shape1", or "shape1=1" if shape1=NULL. The other parameters are tested against 0.
signif = significance code based on p.value.

scores

matrix n \times npar. Each row contains the (unweighted) derivatives of the log-density at a data point w.r.t the parameters.

vcov1

ordinary asymptotic covariance matrix, inverse of minus the Hessian.

StdErr1

vector of ordinary asymptotic standard error of parameters.

varest2

robust asymptotic covariance matrix.

StdErr

vector of robust asymptotic standard error of parameters.

References

Huber, P. J. (1967). The behavior of maximum likelihood estimates under nonstandard conditions. In Proceedings of the Fifth Berkeley Symposium on Mathematical Statistics and Probability, Volume 1, pp. 221-233.

See Also

regSGB for creating oilr.

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
26
27
28
29
30
31
data(arc)
data(oilr)

## compositions
da <- as.matrix(log(arc[["depth"]]),ncol=1)
ua <- as.matrix(arc[,1:3])

## ilr transforms
 c1 <- 1/sqrt(2)
 c2 <- 1/sqrt(6)
 Vilr <- matrix(c(-c1,c1,0,-c2,-c2,2*c2),nrow=3)
 colnames(Vilr) <- c("ilr1","ilr2")
 Vilr
 
 covs <- covest.SGB(oilr[["par"]], da, ua, Vilr)

## Compare the ordinary and robust correlation matrices of parameters estimates.

## (Ordinary) covariance based on inverse Hessian
vcov1 <- covs[["vcov1"]] 
StdErr1 <- covs[["StdErr1"]]
## Estimated correlation matrix
vcor1 <- diag(1/StdErr1) %*% vcov1 %*% diag(1/StdErr1)
round(vcor1,2)

## Robust (Huber's sandwich estimator):
StdErr <- covs[["StdErr"]]
vcov <- covs[["vcov"]]

## Estimated correlation matrix
round(diag(1/StdErr) %*% vcov %*% diag(1/StdErr),2)

SGB documentation built on March 26, 2020, 8:02 p.m.