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)
Run the code above in your browser using DataLab