Elinor | 26 Jul 01:27 2014

Cannot load Zelig

Hello,
I cannot seem to load the Zelig package. I get the following error message
when trying to load it:

library(Zelig)
Loading required package: boot
Loading required package: MASS
Loading required package: sandwich
Error : .onAttach failed in attachNamespace() for 'Zelig', details:
  call: packageDescription(package.name, lib.loc = mylib)$Version
  error: $ operator is invalid for atomic vectors
In addition: Warning message:
In packageDescription(package.name, lib.loc = mylib) :
  no package 'Zelig' was found
Error: package or namespace load failed for ‘Zelig’

Any idea how I can get it to work? I am using R version 3.1.1.
Thanks,
Elinor

-
--
Zelig Mailing List, served by HUIT
Send messages: zelig <at> lists.gking.harvard.edu
[un]subscribe Options: http://lists.gking.harvard.edu/mailman/listinfo/zelig
Zelig program information: http://gking.harvard.edu/zelig/
Zelig mailing list
Zelig <at> lists.gking.harvard.edu

To unsubscribe from this list or get other information:
(Continue reading)

Ryan Turner | 25 Jul 23:15 2014
Picon

Zelig 5?

Dear Zelig List:

Can anybody comment on the status of Zelig 5?  The Zelig website indicates a "Spring - Summer 2014" release,
though it looks like it hasn't been updated in a while (Documentation page says Zelig Documentation will
be updated summer 2013).  I found the Zelig 5 github repository, and it looks like there has been a lot of work
done.  Is the dev version considered stable and safe or is it still alpha/early beta?

For reasons I don't perfectly recall, I had to downgrade from Zelig 4.2.1 to 3.5.4.  On a recent rebuild of my R
library I thought it was time to look back into this issue.

Thanks,
Ryan

--
Ryan J. Turner, M.S. <rjturner@...>
Ph.D. Candidate, Dept. of Engineering and Public Policy
Carnegie Mellon University & Instituto Superior Técnico
+1-412-304-5014 (C) | +1-484-483-3244 (GV)

Héctor Bahamonde | 18 Jul 18:24 2014
Picon

Re: Question regarding "plot(z.out)"

Hello, I think I figured it out… 

thanks.

##############################
# match.data <- matchit(...)
# model.1 <- zelig(...match.data...)

treat.r <- c(0, 1)
model.treat <- setx(model.1, treat = treat.r)
model.treat.s <- sim(model.1, x = Model.treat)
model.treat.e <- data.frame(simulation.matrix(model.treat.s, "Expected Values: Y|X"))


X1 <- model.treat.e$X1
X2 <- model.treat.e$X2

density.plot <- ggplot() + geom_density(aes(x=X1), data= model.treat.e,  fill="grey", alpha = .5) 
        + geom_density(aes(x=X2), data=model.treat.e, fill="dark grey", alpha = .5) 

##############################


On 18Jul, 2014, at 12:00 PM, zelig-request <at> lists.gking.harvard.edu wrote:

Send Zelig mailing list submissions to
zelig-boHuZhbfW+Y6DHxCPSz5rMrP0aXywZMx@public.gmane.orgu

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.gking.harvard.edu/mailman/listinfo/zelig
or, via email, send a message with subject or body 'help' to
zelig-request-boHuZhbfW+Y6DHxCPSz5rL5+avTOL6Rl@public.gmane.org

You can reach the person managing the list at
zelig-owner-boHuZhbfW+Y6DHxCPSz5rL5+avTOL6Rl@public.gmane.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Zelig digest..."


Today's Topics:

  1. Question regarding "plot(z.out)" (Hector Bahamonde)


----------------------------------------------------------------------

Message: 1
Date: Tue, 8 Jul 2014 10:17:52 -0400
From: Hector Bahamonde <hib6-nChP9VK/LToysehGhLVACCmkPJUwDNjP@public.gmane.org>
To: zelig-boHuZhbfW+Y6DHxCPSz5rL5+avTOL6Rl@public.gmane.org
Subject: [zelig] Question regarding "plot(z.out)"
Message-ID:
<CAOXA_80sDPRCr31j+FNBno_QBqXnP0E33t0gw7v3Oq+PGW_QBA-JsoAwUIsXotQFR93xxRIaA@public.gmane.orgcom>
Content-Type: text/plain; charset="utf-8"

Dear all,

I am very new to R and I am trying to plot the simulations Zelig performs.
I know about the "plot(z.out)" syntax, but I am only interested in plotting
the ?Comparison of E(Y|X) and  E(Y|X1)? plot. Is that possible? My final
goal is to plot it using the ggplot2 library.

Thanks,
Hector

--
*H?ctor Bahamonde N.*
PhD Student
Political Science Department - Rutgers University
Hickman Hall, 89 George street, room 602.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gking.harvard.edu/pipermail/zelig/attachments/20140708/a0d26be2/attachment-0001.html>

------------------------------

_______________________________________________
Zelig mailing list
Zelig-boHuZhbfW+Y6DHxCPSz5rL5+avTOL6Rl@public.gmane.org

To unsubscribe from this list or get other information:

https://lists.gking.harvard.edu/mailman/listinfo/zelig

End of Zelig Digest, Vol 157, Issue 1
*************************************



--
Héctor Bahamonde N.
PhD Student
Political Science Department - Rutgers University
Hickman Hall, 89 George street, room 602.

<div>
<div>Hello, I think I figured it out&hellip;&nbsp;</div>
<div><br></div>
<div>thanks.</div>
<div><br></div>
<div>##############################</div>
<div>
<div># match.data &lt;- matchit(...)</div>
<div># model.1 &lt;- zelig(...match.data...)</div>
<div><br></div>
<div>treat.r &lt;- c(0, 1)</div>
<div>model.treat &lt;- setx(model.1, treat = treat.r)</div>
<div>model.treat.s &lt;- sim(model.1, x = Model.treat)</div>
<div>model.treat.e &lt;- data.frame(simulation.matrix(model.treat.s, "Expected Values: Y|X"))</div>
<div><br></div>
<div><br></div>
<div>X1 &lt;- model.treat.e$X1</div>
<div>X2 &lt;- model.treat.e$X2</div>
<div><br></div>
<div>density.plot &lt;- ggplot() <span class="Apple-tab-span">	</span>+ geom_density(aes(x=X1), data= model.treat.e, &nbsp;fill="grey", alpha = .5)&nbsp;</div>
<div>
<span class="Apple-tab-span">							</span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;+ geom_density(aes(x=X2), data=model.treat.e, fill="dark grey", alpha = .5)&nbsp;</div>
</div>
<div><br></div>
<div>##############################</div>
<div><br></div>
<br><div>
<div>On 18Jul, 2014, at 12:00 PM, <a href="mailto:zelig-request@...">zelig-request <at> lists.gking.harvard.edu</a> wrote:</div>
<br class="Apple-interchange-newline"><div>Send Zelig mailing list submissions to<br><span class="Apple-tab-span">	</span><a href="mailto:zelig@...">zelig@...u</a><br><br>To subscribe or unsubscribe via the World Wide Web, visit<br><span class="Apple-tab-span">	</span>https://lists.gking.harvard.edu/mailman/listinfo/zelig<br>or, via email, send a message with subject or body 'help' to<br><span class="Apple-tab-span">	</span>zelig-request@...<br><br>You can reach the person managing the list at<br><span class="Apple-tab-span">	</span>zelig-owner@...<br><br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of Zelig digest..."<br><br><br>Today's Topics:<br><br> &nbsp;&nbsp;1. Question regarding "plot(z.out)" (Hector Bahamonde)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Tue, 8 Jul 2014 10:17:52 -0400<br>From: Hector Bahamonde &lt;hib6@...&gt;<br>To: zelig@...<br>Subject: [zelig] Question regarding "plot(z.out)"<br>Message-ID:<br><span class="Apple-tab-span">	</span>&lt;CAOXA_80sDPRCr31j+FNBno_QBqXnP0E33t0gw7v3Oq+PGW_QBA@...com&gt;<br>Content-Type: text/plain; charset="utf-8"<br><br>Dear all,<br><br>I am very new to R and I am trying to plot the simulations Zelig performs.<br>I know about the "plot(z.out)" syntax, but I am only interested in plotting<br>the ?Comparison of E(Y|X) and &nbsp;E(Y|X1)? plot. Is that possible? My final<br>goal is to plot it using the ggplot2 library.<br><br>Thanks,<br>Hector<br><br>-- <br>*H?ctor Bahamonde N.*<br>PhD Student<br>Political Science Department - Rutgers University<br>Hickman Hall, 89 George street, room 602.<br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: &lt;http://lists.gking.harvard.edu/pipermail/zelig/attachments/20140708/a0d26be2/attachment-0001.html&gt;<br><br>------------------------------<br><br>_______________________________________________<br>Zelig mailing list<br>Zelig@...<br><br>To unsubscribe from this list or get other information:<br><br>https://lists.gking.harvard.edu/mailman/listinfo/zelig<br><br>End of Zelig Digest, Vol 157, Issue 1<br>*************************************<br>
</div>
</div>
<br><div apple-content-edited="true">
<div><div><div><div><div>
<br><br><span>--</span><br><span>H&eacute;ctor Bahamonde N.</span><br><span>PhD Student</span><br><span>Political Science Department -&nbsp;</span><span>Rutgers University</span><div><span>Hickman Hall, 89 George street, room 602.</span></div>
<div>
<a href="http://www.hectorbahamonde.com">http://www.hectorbahamonde.com</a><span><br></span><br><br><br><br>
</div>
</div></div></div></div></div>
</div>
<br>
</div>
Hector Bahamonde | 8 Jul 16:17 2014
Picon

Question regarding "plot(z.out)"

Dear all,

I am very new to R and I am trying to plot the simulations Zelig performs. I know about the "plot(z.out)" syntax, but I am only interested in plotting the “Comparison of E(Y|X) and  E(Y|X1)” plot. Is that possible? My final goal is to plot it using the ggplot2 library.

Thanks,
Hector

-- 
Héctor Bahamonde N.
PhD Student
Political Science Department - Rutgers University
Hickman Hall, 89 George street, room 602.
<div><div dir="ltr">Dear all,<div><br></div>
<div>
<span>I am very new to R and I am trying to plot the simulations Zelig performs. I know about the "plot(z.out)" syntax, but I am only interested in plotting the &ldquo;Comparison of E(Y|X) and &nbsp;E(Y|X1)&rdquo; plot. Is that possible? My final goal is to plot it using the&nbsp;</span>ggplot2 library.</div>
<div><br></div>
<div>Thanks,</div>
<div>Hector<br clear="all"><div><br></div>--&nbsp;<div dir="ltr">
<span>H&eacute;ctor Bahamonde N.</span><br><span>PhD Student</span><br><span>Political Science Department -&nbsp;</span><span>Rutgers University</span><div>
<span>Hickman Hall, 89 George street, room 602.</span>
</div>
</div>
</div>
</div></div>
Korom, Philipp | 25 Jun 09:35 2014
Picon

Quantile regression

Dear all,

 

I am currently trying to conduct quantile regression in Zelig and it does not work out.

In the net I can find two vignettes:

 

Rq: Quantile Regression for Continuous Dependent Variables

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.205.1968

 

quantile: Quantile Regression for Continuous Dependent Variables

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.205.3837

 

Independent of which specification I use (model=”rq”; model=”quantile”), I get the following message:

** The model "rq" is not available with the currently loaded packages,

** and is not an official Zelig package.

** The model's name may be a typo.

 

I greatly appreciate any help

 

Best regards,

Philipp

 

 

 

Philipp Korom

____________________________________

Senior Researcher

Max Planck Institute for the Study of Societies

Institut Max Planck pour l’étude des sociétés

Paulstr. 3 | 50676 Cologne | Germany

kr-faN9prI2E+4@public.gmane.org | www.mpifg.de

Phone +49 221 2767-274 | Fax +49 221 2767-555

 

<div><div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Dear all,<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">I am currently trying to conduct quantile regression in Zelig and it does not work out.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">In the net I can find two vignettes:<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Rq: Quantile Regression for Continuous Dependent Variables<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.205.1968"><span>http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.205.1968</span></a><p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">quantile: Quantile Regression for Continuous Dependent Variables<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.205.3837"><span>http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.205.3837</span></a><p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Independent of which specification I use (model=&rdquo;rq&rdquo;; model=&rdquo;quantile&rdquo;), I get the following message:<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">** The model "rq" is not available with the currently loaded packages,<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">** and is not an official Zelig package.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">** The model's name may be a typo.</span><span lang="EN-US"><p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">I greatly appreciate any help<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Best regards,<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Philipp<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Philipp Korom<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">____________________________________<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Senior Researcher<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Max Planck Institute for the Study of Societies <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Institut Max Planck pour l&rsquo;&eacute;tude des soci&eacute;t&eacute;s<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Paulstr. 3 | 50676 Cologne | Germany <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">kr@... | www.mpifg.de <p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Phone +49 221 2767-274 | Fax +49 221 2767-555<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
</div></div>
David Hill | 24 Jun 15:19 2014

Cannot retrieve summary() of combined datasets in gamma.mixed

Greetings,

I am attempting to run a gamma.mixed model on five imputed datasets from Amelia II.  I used mi() to combine the datasets in the zelig run.  As with some others, when I call the summary () , I receive the error

*Error in object[[1]]$result$call : $ operator not defined for this S4 class*

I can get the summaries for each individual dataset,but I cannot retrieve the summary of the combined datasets. I can combine the datasets using Rubin's rules, but given this analysis will use several different models and plots,
having the combined results would be far simpler.

Thanks,

David


David Hill
Associate Professor of Political Science
Stetson University
DeLand, FL 32723
(386) 822-7579
<div>
<div>Greetings,<br><br>
I am attempting to run a gamma.mixed model on five imputed datasets from Amelia II.&nbsp; I used mi() to combine the datasets in the zelig run.&nbsp; As with some others, when I call the summary () , I receive the error<br><br>*Error in object[[1]]$result$call :
  $ operator not defined for this S4 class*<br><br>I can get the summaries for each individual dataset,but I cannot retrieve the summary of the combined datasets.  I can combine the datasets using Rubin's rules, but given this analysis will use several different models and plots, <br>having the combined results would be far simpler.<br><br>Thanks,<br><br>David<br>
<br><div>
<br><div>David Hill <br>
Associate Professor of Political Science<br>
Stetson University<br>
DeLand, FL 32723<br>
(386) 822-7579<br>
</div>
</div>
</div>
</div>
Whitney | 21 Jun 20:07 2014
Picon

Model Residual Help

> LU2010 -> zelig(Result~ Wetland + Developed+ Grasses+Crops,
model="logit.gee", id="Location",corstr="exchangeable", data=y2010) 

> LU2010$residuals
NULL

I am running Zelig 4.2-1 and using the "logit.gee" model link to fit a
model. I am trying to get a print out of the model residuals to use to test
for spatial autocorrelation; however, when I try to get the print out it
says null. 

My model is. I do not get any errors when I run the model and I get
coefficients and cun run Wald test. 

Any help or ideas would be greatly appreciated.

Laura Lazarus Frankel | 19 Jun 19:29 2014
Picon

Help with sim()

Hi All,

I think I'm having an issue either with setx() or sim()--not sure which one.  The zelig() command runs fine and summary(z.out) output has the correct results--the same I get from lm().  Setx() and Sim() also both run without a problem, but summary(s.out) prints without any actual results and when I try to plot(s.out) I get an error saying there are no y values.  The output and my code are below.  I feel like I'm missing something pretty obvious here, but am about out of ideas.  Thanks in advance for any help!

Cheers,
Laura

> masculinityscorewhole<-zelig(qual~masculinityscore+female+age+education+black+latino+republican+working+homemaker+partnered+kids+homemaker*kids+partnered*kids+polinterest+vote12b, weights=cces3$postweight, model="normal", data=cces3)

> x.high<- setx(masculinityscorewhole, female=1)
> x.low <- setx(masculinityscorewhole, female=0)
> exp.out2<- sim(masculinityscorewhole, x = x.low, x1 = x.high)
> summary(exp.out2)

Model:  normal
Number of simulations:  1000

Values of X
     (Intercept) masculinityscore female age education black latino republican working homemaker partnered kids polinterest
     vote12b homemaker:kids partnered:kids
attr(,"assign")
 [1]  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15

Values of X1
     (Intercept) masculinityscore female age education black latino republican working homemaker partnered kids polinterest
     vote12b homemaker:kids partnered:kids
attr(,"assign")
 [1]  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15

<div><div dir="ltr">Hi All,<br><br>I think I'm having an issue either with setx() or sim()--not sure which one. &nbsp;The zelig() command runs fine and summary(z.out) output has the correct results--the same I get from lm(). &nbsp;Setx() and Sim() also both run without a problem, but summary(s.out) prints without any actual results and when I try to plot(s.out) I get an error saying there are no y values. &nbsp;The output and my code are below. &nbsp;I feel like I'm missing something pretty obvious here, but am about out of ideas. &nbsp;Thanks in advance for any help!<br><br>Cheers,<br>Laura<br><br>&gt; masculinityscorewhole&lt;-zelig(qual~masculinityscore+female+age+education+black+latino+republican+working+homemaker+partnered+kids+homemaker*kids+partnered*kids+polinterest+vote12b, weights=cces3$postweight, model="normal", data=cces3)<br><br>&gt; x.high&lt;- setx(masculinityscorewhole, female=1) <br>&gt; x.low &lt;- setx(masculinityscorewhole, female=0)<br>&gt; exp.out2&lt;- sim(masculinityscorewhole, x = x.low, x1 = x.high) <br>&gt; summary(exp.out2)<br><br>Model: &nbsp;normal <br>Number of simulations: &nbsp;1000 <br><br>Values of X<br>&nbsp; &nbsp; &nbsp;(Intercept) masculinityscore female age education black latino republican working homemaker partnered kids polinterest<br>&nbsp; &nbsp; &nbsp;vote12b homemaker:kids partnered:kids<br>
attr(,"assign")<br>&nbsp;[1] &nbsp;0 &nbsp;1 &nbsp;2 &nbsp;3 &nbsp;4 &nbsp;5 &nbsp;6 &nbsp;7 &nbsp;8 &nbsp;9 10 11 12 13 14 15<br><br>Values of X1<br>&nbsp; &nbsp; &nbsp;(Intercept) masculinityscore female age education black latino republican working homemaker partnered kids polinterest<br>
&nbsp; &nbsp; &nbsp;vote12b homemaker:kids partnered:kids<br>attr(,"assign")<br>&nbsp;[1] &nbsp;0 &nbsp;1 &nbsp;2 &nbsp;3 &nbsp;4 &nbsp;5 &nbsp;6 &nbsp;7 &nbsp;8 &nbsp;9 10 11 12 13 14 15<br><br>
</div></div>
Megan B. | 15 Apr 05:11 2014

"In mer_finalize(ans) : singular convergence (7)" error in fitting a mixed gamma model

Hi everyone, 

I have a dataset of plant drought tolerance values, and my 
original goal was to partition variance in 
these values among the nested random levels Biome/Study site. 
However, my drought tolerance data is significantly non-normal, 
and is best-fit by a gamma distribution, according to the R 
package fitdistr. Since lme4 doesn't seem to be able to work 
with gamma distributions (I got the 
same error as described in this thread:
 https://stat.ethz.ch/pipermail/r-sig-mixed-
models/2010q2/003786.html), 
I wanted to use zelig to determine which level accounts for the 
greatest variance in this trait. 

I tried specifying the following model:

zelig(V37 ~ tag(1|Biomes/Site_Numbers), data = Seasonal_sites, 
model = "gamma.mixed") -> mod1

But I get the following error message: 
"In mer_finalize(ans) : singular convergence (7)"

And my estimated variances go to infinity:

 0:     54.614133: 0.263523  2.62573
  1:    -1594.5787:  0.00000  18.5619
  2:    -1917.2900:  0.00000  25.9591
  3:    -2469.0981: 0.0137130  45.6228
  4:    -2936.0296:  0.00000  73.0933
  5:    -3428.4451:  0.00000  119.754
  6:    -3910.9637: 0.000840655  193.870
  7:    -4510.8977:  0.00000  352.310
  8:    -4903.5986:  0.00000  520.560
  9:    -5425.1380:  0.00000  873.876
 10:    -5896.6090: 6.68957e-09  1395.44
.
.
.
 86:    -42758.744: 8.50187e+09 1.05330e+19
 87:    -43234.416: 1.36270e+10 1.68826e+19
 88:    -43802.180: 2.39304e+10 2.96476e+19
 89:    -44250.090: 3.73145e+10 4.62293e+19

Why am I getting this odd result- am I doing something wrong?

The drought tolerance data "V37" varies 
from roughly 1 -6, with n = 185, if that helps. 
Please let me know if I can supply any more info about my data. 
Thanks very much for your help!

Hanne De Brue | 28 Mar 10:49 2014
Picon

Zelig relogit

Dear sir,

 

For my doctoral research I apply rare events logistic regression from the Zelig package in R to a data set of Roman archaeological sites within Belgium. I wish to calculate some measure to validate the model, such as ROC and percent correctly predicted for varying probability cut-off values. For that, I would also like to calculate the probabilities of the event occurring for both a calibration and a validation data set. However, I am not sure how to tackle this part. I understood from your work that, besides a prior (case-control) correction of the intercept and corrections for biased coefficients, the probability itself also needs to be corrected. The general equation probability = 1 / (1 + exp(-xB)) is hence not sufficient.

 

I am struggling to figure out how Zelig can calculate this adjusted probability. I noticed that R functions such as predict() and fitted() use the general equation, which implies an underestimation. I thought that I might use setx() and sim(), however I am not sure how to apply them to all observations of my data sets (and not only e.g. a mean of all observations), nor can I find the resulting probability value(s). Defining values of one observation in setx() and calling the sim() summary indicates that a value of 1 is used for the intercept (?) and that the probability (E(Y|X)) equals 0.001 (as it does for any other combination of x.out values – maybe because of rounding to three decimals?). Calling s.out$qi$ev returns ‘NULL’.

 

I would greatly appreciate any help on this issue.

Thank you very much in advance.

 

Kind regards

Hanne

 

Hanne De Brue

KU Leuven

Division of Geography

Department of Earth and Environmental Sciences

Celestijnenlaan 200E, box 2409, B-3001 Leuven

T +32 16 329763

E hanne.debrue[at]ees.kuleuven.be

 

<div>
<div class="WordSection1">
<p class="MsoNormal">Dear sir,<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><span lang="EN-US">For my doctoral research I apply rare events logistic regression from the Zelig package in R to a data set of Roman archaeological sites within Belgium. I wish to calculate some measure to validate the model, such as
 ROC and percent correctly predicted for varying probability cut-off values. For that, I would also like to calculate the probabilities of the event occurring for both a calibration and a validation data set. However, I am not sure how to tackle this part.
 I understood from your work that, besides a prior (case-control) correction of the intercept and corrections for biased coefficients, the probability itself also needs to be corrected. The general equation probability = 1 / (1 + exp(-xB)) is hence not sufficient.
<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">I am struggling to figure out how Zelig can calculate this adjusted probability. I noticed that R functions such as predict() and fitted() use the general equation, which implies an underestimation. I thought that I might
 use setx() and sim(), however I am not sure how to apply them to all observations of my data sets (and not only e.g. a mean of all observations), nor can I find the resulting probability value(s). Defining values of one observation in setx() and calling the
 sim() summary indicates that a value of 1 is used for the intercept (?) and that the probability (E(Y|X)) equals 0.001 (as it does for any other combination of x.out values &ndash; maybe because of rounding to three decimals?). Calling s.out$qi$ev returns &lsquo;NULL&rsquo;.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">I would greatly appreciate any help on this issue.
<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Thank you very much in advance.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Kind regards<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">Hanne<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-US">Hanne De Brue<p></p></span></p>
<p class="MsoNormal"><span lang="EN-GB">KU Leuven</span><span lang="EN-GB"><p></p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Division of Geography</span><span lang="EN-GB"><p></p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Department of Earth and Environmental Sciences<p></p></span></p>
<p class="MsoNormal"><span>Celestijnenlaan 200E, box 2409, B-3001 Leuven</span><span><p></p></span></p>
<p class="MsoNormal"><span>T +32 16 329763</span><span><p></p></span></p>
<p class="MsoNormal"><span lang="EN-US">E hanne.debrue[at]ees.kuleuven.be<p></p></span></p>
<p class="MsoNormal"><span lang="EN-US"><p>&nbsp;</p></span></p>
</div>
</div>
Meredith, Christy S -FS | 27 Mar 21:54 2014
Picon

help with obtaining fitted values?

Hello I am having trouble finding the fitted values from Zelig. I ultimately want to use my models to predict on a new dataset and then be able to extract the fitted values to determine how well my model performs. I have tried varies methods in the documentation, but nothing works for me.  I appreciate any help.

 

Thanks!

 

Christy Meredith

 

My code:

 

z.out=zelig(beavpres~Grad+Elev + distancew+Elev + GrazingR+AvgPrecip+deciduous+Bf+AvgVWidth*Grad,data=update5a,model="relogit",tau=0.05)

 

cv.out=cv.glm(z.out,data=update5a) # try cross validation

 

x.out <- setx(z.out)

s.out <- sim(z.out,x.out)

 

 

#attempt to determine fitted values- doesn’t work

s.out$qi$ev

z.out$fitted.values

 

 

Christy Meredith

USDA Forest Service

Rocky Mountain Research Station

PIBO Monitoring

Data Analyst

Voice: 435-755-3573

Fax: 435-755-3563

 





This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.
<div>
<div class="WordSection1">
<p class="MsoNormal">Hello I am having trouble finding the fitted values from Zelig. I ultimately want to use my models to predict on a new dataset and then be able to extract the fitted values to determine how well my model performs. I have tried varies methods
 in the documentation, but nothing works for me. &nbsp;I appreciate any help. <p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Thanks!<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Christy Meredith<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">My code:<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">z.out=zelig(beavpres~Grad+Elev + distancew+Elev + GrazingR+AvgPrecip+deciduous+Bf+AvgVWidth*Grad,data=update5a,model="relogit",tau=0.05)<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">cv.out=cv.glm(z.out,data=update5a) # try cross validation<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">x.out &lt;- setx(z.out)<p></p></p>
<p class="MsoNormal">s.out &lt;- sim(z.out,x.out)<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">#attempt to determine fitted values- doesn&rsquo;t work<p></p></p>
<p class="MsoNormal">s.out$qi$ev<p></p></p>
<p class="MsoNormal">z.out$fitted.values<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Christy Meredith<p></p></p>
<p class="MsoNormal">USDA Forest Service<p></p></p>
<p class="MsoNormal">Rocky Mountain Research Station<p></p></p>
<p class="MsoNormal">PIBO Monitoring<p></p></p>
<p class="MsoNormal">Data Analyst<p></p></p>
<p class="MsoNormal">Voice: 435-755-3573<p></p></p>
<p class="MsoNormal">Fax: 435-755-3563<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
</div>
<br><br><br><br>
This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil
 or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.
</div>

Gmane