Finally a modern Bayesian implementation of the Zelig package here.
Showing posts with label simulation. Show all posts
Showing posts with label simulation. Show all posts
Friday, January 08, 2021
Monday, February 05, 2018
Friday, October 17, 2014
Wednesday, November 14, 2012
Zelig 4 is trouble
Zelig 4 is causing so many problems. I had to uninstall it and went back to the old 3.55.
Saturday, December 17, 2011
Sunday, December 11, 2011
Saturday, February 26, 2011
Simulate parameters
This blog shows how to simulate parameters from a tobit model with a few line of R code.
Friday, February 11, 2011
Simulating second difference using Zelig
I am trying to simulate second difference using Zelig, here is my code:
--------------------------------------------------------
data(turnout)
# estimation
z.out <- zelig(vote ~ race*age + educate + income,
model = "logit", data = turnout)
summary(z.out)
# first difference
x.low <- setx(z.out, educate = 12)
x.high <- setx(z.out, educate = 16)
s.out <- sim(z.out, x = x.low, x1 = x.high)
s.low <- sim(z.out, x=x.low)
s.high <- sim(z.out, x=x.high)
dif <- (s.high$qi$ev - s.low$qi$ev)
# second difference
x.low.low <- setx(z.out, educate = 12, age = 20)
x.low.high <- setx(z.out, educate = 12, age = 30)
x.high.low <- setx(z.out, educate = 16, age = 20)
x.high.high <- setx(z.out, educate = 16, age = 30)
s1 <- sim(z.out, x = x.low.low, x1 = x.low.high)
s2 <- sim(z.out, x = x.high.low, x1 = x.high.high)
did1 <- s1$qi$fd - s2$qi$fd
# or equivalent
s3 <- sim(z.out, x = x.low.low, x1 = x.high.low)
s4 <- sim(z.out, x = x.low.high, x1 = x.high.high)
did2 <- s3$qi$fd - s4$qi$fd
--------------------------------------------------------
data(turnout)
# estimation
z.out <- zelig(vote ~ race*age + educate + income,
model = "logit", data = turnout)
summary(z.out)
# first difference
x.low <- setx(z.out, educate = 12)
x.high <- setx(z.out, educate = 16)
s.out <- sim(z.out, x = x.low, x1 = x.high)
s.low <- sim(z.out, x=x.low)
s.high <- sim(z.out, x=x.high)
dif <- (s.high$qi$ev - s.low$qi$ev)
# second difference
x.low.low <- setx(z.out, educate = 12, age = 20)
x.low.high <- setx(z.out, educate = 12, age = 30)
x.high.low <- setx(z.out, educate = 16, age = 20)
x.high.high <- setx(z.out, educate = 16, age = 30)
s1 <- sim(z.out, x = x.low.low, x1 = x.low.high)
s2 <- sim(z.out, x = x.high.low, x1 = x.high.high)
did1 <- s1$qi$fd - s2$qi$fd
# or equivalent
s3 <- sim(z.out, x = x.low.low, x1 = x.high.low)
s4 <- sim(z.out, x = x.low.high, x1 = x.high.high)
did2 <- s3$qi$fd - s4$qi$fd
---------------------------------------------------------
It would be great if Zelig can do this directly though.
Sunday, August 01, 2010
NetLogo-R-Extension
Here is a bridge between NetLogo and R, which looks very interesting. But I was not able to get it work on my Ubuntu box (running the latest R).
Programming in NetLogo
Here is a nice introduction to NetLogo from a programming language perspective.
Saturday, June 20, 2009
Statistical simulation
Chapter 7 of Data Analysis Using Regression and Multilevel/Hierarchical Models by Gelman and Hill offers good description of why use statistical simulation in quantitative research. Their R package ARM provides a good place to get started to program one's own simulation module. Of course, Zelig has already had a impressive collection of models pre-programmed; but custom programming is always more fun.
Thursday, December 25, 2008
Simcol
This R package (http://simecol.r-forge.r-project.org/) looks interesting. For one thing: it can do Conway's game of life.
Friday, November 21, 2008
Stata equavalence to Zelig
The R package Zelig can generate meaningful results such as predicted value, expected value, first difference, etc. from a wide variety of statistical procedures via simulation or bootstrapping. The Stata module "prvalue" and "prgen" seem to do at least a subset of what Zelig can do. Interestingly, the authors did not mention Gary King's work on Zelig and "Clarify".
However, it does not seem to work with mixed effect models.
However, it does not seem to work with mixed effect models.
Monday, June 09, 2008
Predict, simulate, and graph aML results
The multilevel and multiprocess software aML is quite amazing. It handles a much greater number of models than most other packages, and it is fast to reach convergence given suitable starting values. However, it does not have lots of facilities for results presentation.
I have used this software for several of my own research. I think it will be highly desirable to streamline the communication between aML and Stata or R. I can think of the following steps:
I have used this software for several of my own research. I think it will be highly desirable to streamline the communication between aML and Stata or R. I can think of the following steps:
- Estimate a mode in aML;
- Extract point estimates and variance/covariance from the output file using Python;
- Transfer the extracted results to R;
- Predict, simulate, and graph the results with Zelig or other facilities built into R.
Sunday, April 15, 2007
A good new book on Monte Carlo methods
Title: Simulation and Monte Carlo: With applications in finance and MCMC
Author: J. S. Dagpunar
Publisher: Wiley
This new book seems really cool and I will try to remember to buy it next time I visit US.
http://as.wiley.com/WileyCDA/WileyTitle/productCd-0470854952.html
Author: J. S. Dagpunar
Publisher: Wiley
This new book seems really cool and I will try to remember to buy it next time I visit US.
http://as.wiley.com/WileyCDA/WileyTitle/productCd-0470854952.html
Subscribe to:
Posts (Atom)