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!
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.
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
Dear Zelig users,
I have been struggling for a while now to perform a rare events logistic
regression procedure. I have come to the point where my R code runs
smoothly, however I experience trouble interpreting the Zelig output. A few
issues I hope someone can help me with:
- Some categorical (factor) variables and intercepts that are not
significant in an ordinary logit model, receive in the relogit procedure
Pr(>|z|) values of 0.000e+00.
- The case control prior correction for the intercept is based on tau, the
ratio between positive and negative events (e.g. King and Zeng, 2001, Eq.
7). However, changing tau affects all coefficients except the intercept.
- Based on e.g. King and Zeng (2001), I understand that after prior and bias
correction, probabilities calculated according to general equation Pr(Y=1|B)
= 1/(1 + exp(xB)) lead to underestimation and still need to be corrected
for uncertainties, as described in Eq. 15-16 of King and Zeng (2001). It is
not clear however, how (or if) Zelig relogit deals with this correction.
Fitted() or predict() obviously do not apply this correction.
Any help would be appreciated - I have been trying to figure this out for
more than a week now. Please note that I am not subscribed to the mailing
list. I am not sure if answers appear on gmane.comp.lang.r.zelig, if not:
comments can be sent to hanne.debrue(a)ees.kuleuven.be.
Many thanks!!
Hanne
I wonder if someone could provide an explanation of the meaning of
"under the assumption that everything stays the same except that the
treatment indicator is switched to ti = 0"
Hello,
I am having trouble running an ei.RxC model through Zelig. At first I got
the error that has been discussed in previous posts (i.e. November 2012)
where R replied that ei.RxC wasn't an available model:
** The model "ei.RxC" is not available with the currently loaded packages,
** and is not an official Zelig package.
** The model's name may be a typo.
So, following Matt Owen's November 2012 post, I upgraded to R version
3.0.2 and rolled back Zelig 4.0 to Zelig 3.5.
Now, however, I get an error--> Error: could not find function "zelig"
A February 2007 post recommended that the user switch from
library(zelig) to library(Zelig), but that is not the problem in my
case.
But when I do run library(Zelig) I get a response that:
Error : .onAttach failed in attachNamespace() for 'Zelig', details:
call: NULL
error: '.readRDS' is defunct.
Use 'readRDS' instead.
See help("Defunct")
Error: package or namespace load failed for 'Zelig'
Any idea about what is going on here? Did my installation of Zelig 3.5
work? I'm pasting the full documentation below. It shows that I first
removed Zelig, installed the 3.5 version, (unsuccessfully) tried to open
library(Zelig), and (unsuccessfully) tried to run the model.
Much Thanks,
Jennifer Boylan
> remove.packages("Zelig")
Removing package from 'C:/Users/Jenny/Documents/R/win-library/3.0'
(as 'lib' is unspecified)
> install.packages("Zelig", repos = "http://r.iq.harvard.edu/archived",
type = "source")
Installing package into 'C:/Users/Jenny/Documents/R/win-library/3.0'
(as 'lib' is unspecified)
trying URL 'http://r.iq.harvard.edu/archived/src/contrib/Zelig_3.5.4.tar.gz'
Content type 'application/x-gzip' length 5711031 bytes (5.4 Mb)
opened URL
downloaded 5.4 Mb
* installing *source* package 'Zelig' ...
files 'inst/doc/figs/icon_minus.gif', 'inst/doc/figs/icon_plus.gif',
'inst/doc/figs/increase.eps', 'inst/doc/figs/increase.pdf',
'inst/doc/figs/roc.eps', 'inst/doc/figs/roc.pdf',
'inst/doc/figs/sample1.eps', 'inst/doc/figs/sample1.pdf',
'inst/doc/figs/sample2.eps', 'inst/doc/figs/sample2.pdf',
'inst/doc/figs/ternary.eps', 'inst/doc/figs/ternary.pdf',
'inst/doc/figs/vertci.eps', 'inst/doc/figs/vertci.pdf' are missing
files 'DESCRIPTION', 'R/zelig2probit.R', 'inst/doc/blogit.pdf',
'inst/doc/bprobit.pdf', 'inst/doc/gamma.mixed.pdf', 'inst/doc/gamma.pdf',
'inst/doc/gamma.survey.pdf', 'inst/doc/logit.mixed.pdf',
'inst/doc/logit.pdf', 'inst/doc/logit.survey.pdf', 'inst/doc/ls.mixed.pdf',
'inst/doc/ls.pdf', 'inst/doc/negbin.pdf', 'inst/doc/normal.survey.pdf',
'inst/doc/poisson.mixed.pdf', 'inst/doc/poisson.pdf',
'inst/doc/poisson.survey.pdf', 'inst/doc/probit.mixed.pdf',
'inst/doc/probit.pdf', 'inst/doc/probit.survey.pdf',
'inst/doc/vigpics/blogit-BasicExamplePlot.pdf',
'inst/doc/vigpics/blogit-JointExamplePlot.pdf',
'inst/doc/vigpics/bprobit-BasicExamplePlot.pdf',
'inst/doc/vigpics/bprobit-JointEstimationPlot.pdf',
'inst/doc/vigpics/gamma-ExamplePlot.pdf',
'inst/doc/vigpics/gammasurvey-ExistingPlot.pdf',
'inst/doc/vigpics/gammasurvey-ReplicatePlot.pdf',
'inst/doc/vigpics/lmmixed-ExamplesPlot.pdf',
'inst/doc/vigpics/logit-ExamplePlot.pdf',
'inst/doc/vigpics/logit-FirstDifferencesPlot.pdf',
'inst/doc/vigpics/logit-ROCPlot.pdf',
'inst/doc/vigpics/logitsurvey-ExistingPlot.pdf',
'inst/doc/vigpics/logitsurvey-ReplicatePlot.pdf',
'inst/doc/vigpics/ls-DummyPlot.pdf',
'inst/doc/vigpics/ls-Example4Plot.pdf',
'inst/doc/vigpics/ls-ExamplesPlot.pdf',
'inst/doc/vigpics/negbin-Example1Plot.pdf',
'inst/doc/vigpics/normal-ExistingPlot.pdf',
'inst/doc/vigpics/normal-ReplicatePlot.pdf',
'inst/doc/vigpics/poisson-ExamplePlot.pdf',
'inst/doc/vigpics/poissonsurvey-ExistingPlot.pdf',
'inst/doc/vigpics/poissonsurvey-ReplicatePlot.pdf',
'inst/doc/vigpics/probitsurvey-ExistingPlot.pdf',
'inst/doc/vigpics/probitsurvey-ReplicatePlot.pdf',
'inst/doc/vigpics/weibull-ExamplePlot.pdf', 'inst/doc/weibull.pdf',
'man/Zelig-package.Rd' have the wrong MD5 checksums
** R
** data
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
'blogit.Rnw'
'bprobit.Rnw'
'gamma.Rnw'
'gamma.mixed.Rnw'
'gamma.survey.Rnw'
'logit.Rnw'
'logit.mixed.Rnw'
'logit.survey.Rnw'
'ls.Rnw'
'ls.mixed.Rnw'
'negbin.Rnw'
'normal.survey.Rnw'
'poisson.Rnw'
'poisson.mixed.Rnw'
'poisson.survey.Rnw'
'probit.Rnw'
'probit.mixed.Rnw'
'probit.survey.Rnw'
'weibull.Rnw'
** testing if installed package can be loaded
##
## Zelig (Version 3.5.4, built: 2010-01-20)
## Please refer to http://gking.harvard.edu/zelig for full
## documentation or help.zelig() for help with commands and
## models supported by Zelig.
##
## Zelig project citations:
## Kosuke Imai, Gary King, and Olivia Lau. (2009).
## ``Zelig: Everyone's Statistical Software,''
## http://gking.harvard.edu/zelig.
## and
## Kosuke Imai, Gary King, and Olivia Lau. (2008).
## ``Toward A Common Framework for Statistical Analysis
## and Development,'' Journal of Computational and
## Graphical Statistics, Vol. 17, No. 4 (December)
## pp. 892-913.
## To cite individual Zelig models, please use the citation format printed
with
## each model run and in the documentation.
##
* DONE (Zelig)
The downloaded source packages are in
'C:\Users\Jenny\AppData\Local\Temp\RtmpCMxAyF\downloaded_packages'
> library(Zelig)
##
## Zelig (Version 3.5.4, built: 2010-01-20)
## Please refer to http://gking.harvard.edu/zelig for full
## documentation or help.zelig() for help with commands and
## models supported by Zelig.
##
## Zelig project citations:
## Kosuke Imai, Gary King, and Olivia Lau. (2009).
## ``Zelig: Everyone's Statistical Software,''
## http://gking.harvard.edu/zelig.
## and
## Kosuke Imai, Gary King, and Olivia Lau. (2008).
## ``Toward A Common Framework for Statistical Analysis
## and Development,'' Journal of Computational and
## Graphical Statistics, Vol. 17, No. 4 (December)
## pp. 892-913.
## To cite individual Zelig models, please use the citation format printed
with
## each model run and in the documentation.
##
Error : .onAttach failed in attachNamespace() for 'Zelig', details:
call: NULL
error: '.readRDS' is defunct.
Use 'readRDS' instead.
See help("Defunct")
Error: package or namespace load failed for 'Zelig'
> STATA <- read.dta("C:/R/aggvote2.dta", convert.factors = FALSE)
> z.out <- zelig(cbind(ndc, npp, thirdparty, reject, novote12) ~ allakan +
allga + allewe + allguan + allgurma + allmole + allgrusi + allmande +
allothers + allmissing, model = "ei.RxC", data=STATA)
Error: could not find function "zelig"
>
--
PhD Candidate
Department of Political Science
University of Florida
PO Box 117325
Gainesville, FL 32611-7325
Dear Subscribers,
On the basis of syntax from the ZeligChoice Manual I wanted to receive s.out results after BLOGIT (e.g. qi$ev, qi$fd). However, after sim() command I get information about non-conformable arguments. Could you interpret the message? Is it a problem with matrix dimensions?
Actually, I wanted to compare results of BIPROBIT computed in Stata with BLOGIT (bivariate logit is not available in Stata). Unfortunately, I do not use R often enough :(
Regards,
Thank you in advance
library(ZeligChoice)
data<-read.csv("data.csv", header=TRUE, sep=";")
z.out2<-zelig(list(mu1=y1~age+gender+company+educ_4+educ_3+educ_2+qual_3+qual_2+qual_1,mu2=y2~age+gender+educ_4+educ_3+educ_2),model="blogit",data=data)
x.hi <- setx(z.out2, gender = 1)
x.lo <- setx(z.out2, gender = 0)
s.out2 <- sim(z.out2, x = x.lo, x1 = x.hi)
AFTER THIS COMMAND I GET AN EROR:
Error in all.coef[[1]] %*% as.matrix(xm[[1]]) : non-conformable arguments
Hi,
I'd like to know when this feature will be back,
"Average Treatment Effect" quantities of interest are not being included
in
zelig models temporarily. Simulation of these qi's will return pending a
minor update to the 'setx' function.
kindly respond to private email - not on the list
thanks marwan
--------------------------------------------------
Marwan Khawaja, Ph.D.
Chief, Demographic and Social Statistics Section
Statistics Division
UN-ESCWA
P.O. Box 11-8575
Riad el-Solh 1107 2270
Beirut, Lebanon
Email: khawaja(a)un.org
Tel.: (+961-1) 978365 (direct)
Fax: (+961-1) 981510
_____________________________
> Hello,
> I am trying to estimate average treatment effect in the Zelig package
> (current R version on Windows), and ran the model exactly as in the
> documentation page 18 of the MatchIt package, and got the following error massage,
>
> ate.all<-c(s.out61$qi$att.ev, -s.out62$qi$att.ev)Error in
> -s.out62$qi$att.ev : invalid argument to unary operator
>
> (s.out62 is similar to s.out2 in the example0
>
> Appreciate your help.
Kindly respond to my private email - am not a
> subscriber to list at the moment.
>
> Thanks Marwan Khawaja
>
Hi,
Trying to fit a GEE model using Zelig. Installed Zelig as follows:
install.packages("ZeligChoice", repos="http://r.iq.harvard.edu", type="source")
Receiving the following error message for GEE model as shown
on page 269 here - http://r.iq.harvard.edu/docs/zelig.pdf
Error in UseMethod("multi.dataset") : no applicable method for
'multi.dataset' applied to an object of class "name"
Is there a known reason for this error message?
What can I do to address it?
Thanks!