vcov.lognlm: Covariance matrix for lognlm fits

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/vcov.lognlm.R

Description

Computes covariance matrix of parameter estimates from a lognlm fit via the sandwich formula.

Usage

1
2
## S3 method for class 'lognlm'
vcov(object, emp = FALSE, exH = TRUE, se = FALSE, ...)

Arguments

object

a fitted model object of class "lognlm" returned by lognlm()

emp

logical; if TRUE, the ‘meat’ (i.e the information matrix) is computed empirically by the outer product of the individual score contributions.

exH

logical; if TRUE the expected (rather than the observed) hessian is used in the sandwich formula.

se

logical; if TRUE the square root of the elements of the main diagonal are returned (rather than the whole matrix).

...

additional arguments.

Details

If object has been obtained via lognlm(.., lik=TRUE) the returned covariance matrix (or standard errors only) refers to regression coefficients and the log response standard deviation. Otherwise (if lik=FALSE has been set), it includes entries relevant to regression coefficients only. The var-covariance matrix comes from the sandwich formula using expected (if exH=TRUE) or the observed (if exH=FALSE) hessian at solution. Some simulations under correct model specification show that emp=TRUE and exH=FALSE lead to somewhat more unstable standard errors.

Value

The variance-covariance matrix of the parameter estimates, if se=FALSE; otherwise the square root of the main diagonal entries.

Note

Currently for likelihood-based fits, exH=FALSE and emp=TRUE are always set.

Author(s)

Vito Muggeo

See Also

lognlm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
n=50
s=.3

#covariates
x<-seq(.1,10,l=n) 
z<-rnorm(n)
#response
mu<- 10+.5*x- z  #linear regression function
y<-rlnorm(n, log(mu)-s^2/2, s) #data..

o<- lognlm(y~x+z, lik=TRUE) #the model
vcov(o) #the full covariance matrix 
vcov(o, se=TRUE) #st.errs only 

 

logNormReg documentation built on Nov. 8, 2021, 5:07 p.m.