Hello,
It appears as though Zelig has trouble integrating multiple datasets
when using a "logit.mixed" model within R. I'm hoping someone can verify the
problem and possibly suggest a work-around.
I've uploaded a sample dataset at
www.princeton.edu/~wbullock/sampleData.RData and here is a bit of code.
library(Amelia)
library(Zelig)
load("sampleData.RData")
X <- amelia(sampleData, idvars=c("st"), noms=c("female", "imports"),
ords=c("age", "edu", "inc"))
fit.1 <- zelig(imports ~ age + edu + female,
data=mi(X$imputations[[1]],X$imputations[[2]],X$imputations[[3]]), model =
"logit")
summary(fit.1)
fit.2 <- zelig(imports ~ tag(1|age) + tag(1|edu) + tag(1|female),
data=mi(X$imputations[[1]],X$imputations[[2]],X$imputations[[3]]), model =
"logit.mixed")
summary(fit.2) #generates error
fit.2
The multiple imputation seems to work just fine, as does the first Zelig
model using a standard logistic model. But the second Zelig model does not
properly integrate the datasets. Instead it simply runs the model on each
dataset separately.
Any thoughts or suggestions on the matter would be greatly appreciated.
Thank you,
--Will Bullock
Unfortunately we don't document specific algorithms. You might be able
to find the information in the original packages we wrap.
Kosuke Imai
Princeton University
http://imai.princeton.edu
Sent from my iPhone
On Jun 24, 2009, at 6:01 PM, "Zhang, Hui"
<Hui_Zhang(a)URMC.Rochester.edu> wrote:
> Dear Kosuke,
>
> Now I am trying to compare different available package for fitting
> longitudinal binary data using GLMM. I am just wondering which
> algorithm you used in Zelig but I am not able to find this
> information in zelig package and the website. Did you use either
> linearization or approximating the loglikelihood?
>
> Thank you very much!
>
> Hui
>
> -----Original Message-----
> From: monkeykupo(a)gmail.com [mailto:monkeykupo@gmail.com] On Behalf
> Of Olivia Lau
> Sent: Monday, March 30, 2009 10:03 PM
> To: Kosuke Imai
> Cc: Zhang, Hui; Gary King; Tu, Xin; zelig(a)lists.gking.harvard.edu;
> Delia Bailey
> Subject: Re: [zelig] RE: a question regarding R package "Zelig"
>
> Hi,
>
> There's a trade-off between N (total number of units) and M (number of
> clusters). These models are known to have some bias in situations
> where the number of clusters M is small, or the number of units n_m in
> each unit is large relative to the number of clusters. In order to
> show that the results are unbiased, try running 100 simulations with
> 100 clusters, and 5 units in each cluster. The mean of the
> simulations should return the true parameters to the first decimal
> place. Additional precision can be achieved by increasing the number
> of simulations.
>
> Best,
> Olivia
>
> On Mon, Mar 30, 2009 at 10:27 PM, Kosuke Imai <kimai(a)princeton.edu>
> wrote:
>> Hi,
>>
>> I'm not familiar with these kinds of models, but I wouldn't be
>> surprised if
>> the convergence has not been achieved at n = 300. It's also
>> possible that
>> variance parameters have uncertainty estimation which has not been
>> taken
>> into account (although I'm not 100 % sure about if this is indeed
>> the case,
>> and I'm ccing to the contributor of this model to see if she has any
>> insight). If this is the case, you might want to choose the bootstrap
>> option.
>>
>> Kosuke
>>
>> --
>> Department of Politics
>> Princeton University
>> http://imai.princeton.edu
>>
>> On Mon, 30 Mar 2009, Zhang, Hui wrote:
>>
>>> Dear Kosuke,
>>>
>>> Thank you so much for your response. After I update all the three,
>>> my R,
>>> lme4 and Zelig packages, to the newest version, the problem
>>> disappeared.
>>>
>>>
>>> Then I tested the Zelig package for binary data GLMM modeling.
>>> However,
>>> I did not get the result as supposed.
>>>
>>> Basically, I generate the dataset from a GLMM model to and then
>>> test the
>>> type I error using Zelig fitting. It did not give the correct number
>>> even for large sample size.
>>>
>>> I attached both the simulation strategy and R code in this email.
>>> Do you
>>> think that is because I did not use the the Package "Zelig"
>>> correctly or
>>> it has deficit?
>>>
>>> Thank you so much!
>>>
>>> Hui
>>>
>>> -----Original Message-----
>>> From: Kosuke Imai [mailto:kimai@Princeton.EDU]
>>> Sent: Sunday, March 29, 2009 9:34 PM
>>> To: Zhang, Hui
>>> Cc: Gary King; Delia Bailey; Tu, Xin; zelig(a)lists.gking.harvard.edu
>>> Subject: Re: a question regarding R package "Zelig"
>>>
>>> Can you try the latest version of Zelig and lme4 and do:
>>>
>>> demo(ls.mixed)
>>>
>>> It works for me and should work for you too... Note that you
>>> should do
>>>
>>> install.packages("Zelig", repos = "http://gking.harvard.edu")
>>>
>>> for Zelig.
>>>
>>> Thanks,
>>> Kosuke
>>>
>>>
>>
>> -
>> Zelig Mailing List, served by Harvard-MIT Data Center
>> Send messages: zelig(a)lists.gking.harvard.edu
>> [un]subscribe Options: http://lists.gking.harvard.edu/?info=zelig
>> Zelig program information: http://gking.harvard.edu/zelig/
>>
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options: http://lists.gking.harvard.edu/?info=zelig
Zelig program information: http://gking.harvard.edu/zelig/
Hi,
I'm new to Zelig. I was trying to figure out how Zelig simulates the
counterfactuals for a treatment group (after already having run matchit to
get treatment and control groups) to estimate the ATT. I think in basic
terms it estimates the parameters of a model (that you specify) for the
matched control group and then uses the estimated parameters and treatment
group's covariates to estimate predicted/expected values--these are the
counterfactuals for the treatment group.
But here's my question (and it is probably due to a lack of conceptual
understanding): Sometimes matching is in pairs (for example)--does the
simulation also take account for this? That is, if persons A, B, C in the
treatment group are matched to persons D, E, F respectively in the control
group, does the simulation take into account that matching has grouped A &
D, B & E, C & F? Or does the simulation just take the mass of the matched
control group observations and estimate a model through it to create
estimated parameters (to be used with the treatment group's covariates to
create counterfactuals)?
Sorry in advance if the question is not clear.
best,
Prashant
Dear Sirs
I am trying to apply a mixed logit model and to learn how to do it I
tried your vignette logit.mixed Unfortenatly I receive this error message.
Can you help me on how to pass this? Error in > checkSlotAssignment(object,
name, value) : "terms" is not a slot in class "mer"
Thanks in adavnce
Regards
Ivone Figueiredo
Hey folks, I have a question about passing values to Zelig inside a
function. I'm wondering why I can't pass a value the way I normally would
with a function. Take the following example:
# LET'S SAY I HAVE A SIMPLE MODEL
z.out <- zelig(murder.bin ~ age + income + educ ,
model = "logit",
data = mi(miin1, miin2, miin3, miin4, miin5))
summary(z.out)
# THIS WORKS
age.val <- 1
income.val <- 1
educ.val <- 1
x.out <- setx(z.out, age = age.val, income = income.val, educ = educ.val)
s.out <- sim(z.out, x = x.out)
print(summary(s.out))
# BUT THIS DOESN'T WORK
my.function <- function(age.val=2, income.val=2, educ.val= 2) {
print(c(tm,cv,rt))
x.out <- setx(z.out, age = age.val, income = income.val, educ = educ.val)
s.out <- sim(z.out, x = x.out)
print(summary(s.out))
}
my.function()
# AND THIS DOESN'T WORK
my.function(age.val=3, income.val=3, educ.val=3)
What am I doing wrong?