Displaying 1 result from an estimated 1 matches for "coefsimul".
Did you mean:
coefsim
2012 Apr 26
2
Lambert (1992) simulation
...ce
rm(list=ls())
# Load zero-inflation package
library(pscl)
# Simulation conditions #3
NumSimulations=2000
X=seq(from=0,to=1,length.out=N)
Model.Matrix=cbind(rep(1,length(X)),X)
Gamma=c(-1.5,2)
Beta=c(1.5,-2)
P=exp(Model.Matrix%*%Gamma)/exp(1+Model.Matrix%*%Gamma)
Lambda=exp(Model.Matrix%*%Beta)
CoefSimulations=matrix(nrow=NumSimulations,ncol=2*dim(Model.Matrix)[2])
for(i in 1 : NumSimulations){
Lambda.Draw=rpois(N,Lambda)
U=runif(N)
Y=ifelse(U<=P,0,Lambda.Draw)
CoefSimulations[i,]=coef(zeroinfl(Y~X|X))
}
# What were the estimates?
colMeans(CoefSimulations) # My gamma estimates aren't even...