cov.gmnl | R Documentation |
These are a set of functions that help to extract the variance-covariance matrix, the correlation matrix, and the standard error of the random parameters for models of class gmnl
.
cov.gmnl(x, Q = NULL) cor.gmnl(x, Q = NULL) se.cov.gmnl(x, sd = FALSE, Q = NULL, digits = max(3, getOption("digits") - 2))
x |
an object of class |
Q |
this argument is only valid if the " |
sd |
if |
digits |
the number of digits. |
The variance-covariance matrix is computed using the Cholesky decomposition LL'=Σ.
se.cov.gmnl
function is a wrapper for the deltamethod
function of the msm package.
cov.gmnl
returns a matrix with the variance of the random parameters if the model is fitted with random coefficients. If the model is fitted with correlation = TRUE
, then the variance-covariance matrix is returned.
If correlation = TRUE
in the fitted model, then se.cov.gmnl
returns a coefficient matrix for the elements of the variance-covariance matrix or the standard deviations if sd = TRUE
.
Mauricio Sarrias msarrias86@gmail.com
Greene, W. H. (2012). Econometric Analysis, Seventh Edition. Pearson Hall.
Train, K. (2009). Discrete Choice Methods with Simulation. Cambridge University Press.
gmnl
for the estimation of different multinomial models with individual heterogeneity.
## Not run: ## Examples using Electricity data set from mlogit package library(mlogit) data("Electricity", package = "mlogit") Electr <- mlogit.data(Electricity, id.var = "id", choice = "choice", varying = 3:26, shape = "wide", sep = "") ## Estimate a MIXL model with correlated random parameters Elec.cor <- gmnl(choice ~ pf + cl + loc + wk + tod + seas| 0, data = Electr, subset = 1:3000, model = 'mixl', R = 10, panel = TRUE, ranp = c(cl = "n", loc = "n", wk = "n", tod = "n", seas = "n"), correlation = TRUE) ## Use functions for correlated random parameters cov.gmnl(Elec.cor) se.cov.gmnl(Elec.cor) se.cov.gmnl(Elec.cor, sd = TRUE) cor.gmnl(Elec.cor) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.