Dear Dan,
Thanks. I think this is exactly what I am looking for.
Best,
Shige
2008/4/9 Powers, Daniel A <dpowers(a)austin.utexas.edu>du>:
Shige—
I have had some success in using the MLE's (and their variance covariance
matrix) in the simulation of nonlinear functions. This is especially useful
when the asymptotic variance of the function is hard to derive using the
delta method (or if you prefer less programming work). The trick is in
getting the parameters and the covariance matrix from your external program
(aML) output in a useable form for convenient input data to R.
You can sample from the MVN for the MLE's. You can either provide the
variance of the MLE's as a parameter for the MVN draw or you can draw a new
var/cov matrix by using the estimated one as the mean in a
Wishart/Inverse-Wishart dist. Assuming you have a vector of parameters
(called b0s below) and a cov matrix (called v.0s), something like the
following code will give you 1000 simulations of b0s that you can used to
define the functions of the MLEs.
J <- 1000
K <- length(b0s)
#
library(mvtnorm)
library(MCMCpack)
b.0sim <- array(NA, c(K,J))
for (j in 1:J) {
S <- length(b.0s)^2 - 1
# draw vc matrix from wishart
vb.0 <- rwish(S, 1/S*v.0s)
# draw b from mvnormal around mle
bb0 <- rmvnorm(1,b.0s,vb.0)
b.0sim[,j] <- bb0
}
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Daniel A. Powers, Ph.D.
Department of Sociology
University of Texas at Austin
1 University Station A1700
Austin, TX 78712-0118
phone: 512-232-6335
fax: 512-471-1748
dpowers(a)mail.la.utexas.edu
------------------------------
*From:* owner-zelig_at_lists_gking_harvard_edu(a)mail.hmdc.harvard.edu[mailto:
owner-zelig_at_lists_gking_harvard_edu(a)mail.hmdc.harvard.edu] *On Behalf
Of *???
*Sent:* Tuesday, March 18, 2008 1:18 PM
*To:* zelig(a)lists.gking.harvard.edu
*Subject:* [zelig] Simulation using results outside of R/Zelig
Dear All,
I estimated a quite complicated multilevel endogenous switching model
using aML (
http://www.applied-ml.com/), which can produce point estimates
as well as variance-covariance matrix. Now I would like to have Zelig to use
these results (estimated using aML) and simulate quantities of substantive
interest. Where can I find some examples and tutorials for a task like this?
How do I get started? Thanks.
Best,
Shige