vcov.lognlm {logNormReg} | R Documentation |
Covariance matrix for lognlm fits
Description
Computes covariance matrix of parameter estimates from a lognlm
fit via the sandwich formula.
Usage
## S3 method for class 'lognlm'
vcov(object, emp = FALSE, exH = TRUE, se = FALSE, ...)
Arguments
object |
a fitted model object of class |
emp |
logical; if |
exH |
logical; if |
se |
logical; if |
... |
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
Examples
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