Zelig seems to default to listwise deletion. Can I tell it to delete
pairwise?
Thanks,
Keith Schnakenberg
-
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/
Dear all,
Does zelig support regression of time series with lagged explainatory
variables?
y~x+lag(x,-1)+lag(x, -2)
Thank you for your help.
--
John Li
The University of Chicago GSB
Phone: (847) 356-3158
zli1(a)ChicagoGSB.edu
I am trying to use zelig to estimate models for various subsets of my
data. The relevant code is below:
library(foreign)
ssrl <- read.spss("ayerscleaned2.sav", to.data.frame=TRUE)
library(Zelig)
m1sample=ssrl[ssrl$HFOR==1,]
m1 <- zelig(ENGLISH ~ TIME + PCTH2 + CONTACT + SEND + VISIT2 + LIVED
+ MEXICAN + MALE + EDU + INCOME + AGE, model="logit", data="m1sample")
When I try to run the last command, I get the following error message:
Error in eval(predvars, data, env) : invalid 'envir' argument
I get the same error message for all other subsets and for the data
with no subsets.
Could anyone shed some light on what might be the cause of this error?
Thank you,
Keith Schnakenberg
-
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/
Dear All,
I estimated a quite complicated multilevel endogenous switching model using
aML (http://www.applied-ml.com/), which can produce point estimates as well
as variance-covariance matrix. Now I would like to have Zelig to use these
results (estimated using aML) and simulate quantities of substantive
interest. Where can I find some examples and tutorials for a task like this?
How do I get started? Thanks.
Best,
Shige
Hello,I have estimated a logistic regression model with Zelig using the mi
command to combine multiple imputed datasets. I understand that the summary
output is the combined result and that I can also print out individual
results by dataset. However, in calculating predicted probabilities, I am
wondering which coefficients are being used by Zelig - would these be from
the combined results? In addition, when setting the independent variables
to their means (setx command) - would this be some weighted mean of that
variable across those five datasets? Finally, could someone clarify the
difference between the expected values and the predicted values that are
given in the output.
Thank you,
Amber Wichowsky
University of Wisconsin-Madison
We are working on these complex survey models right now. We hope to be
able to release these models very soon. Stay tuned...
Kosuke
---------------------------------------------------------
Kosuke Imai Office: Corwin Hall 041
Assistant Professor Phone: 609-258-6601
Department of Politics eFax: 973-556-1929
Princeton University Email: kimai(a)Princeton.Edu
Princeton, NJ 08544-1012 http://imai.princeton.edu/
---------------------------------------------------------
On Mon, 10 Mar 2008, Bilal Khan wrote:
>
>
> Hi
>
> I need some help on Zelig. I have been trying to subscribe Zelig list but have not been successful. I hope you can help me with few problems in Zelig.
>
> First of all, I would like to know how to weight by a weight variable while building models in Zelig. Lots of survey data have weights and one uses weights while calculating quantities of interest however, I dont know how to use a weight variable while building models in Zelig.
>
> I would be looking forward to your reply. Thanks again for your kind help in this regard.
>
> Regards, Bilal Hassan Khan
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-
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/
I'm trying to run twosls. Neither the mi nor the weights command works.
1. "mi"
Here is the code I ran:
fml <- list(mu1 = civtotw3 ~ civtotw1, mu2 = civtotw2 ~ civtotw1 +
treat, inst = ~ civtotw1 + treat)
z.out <- zelig(formula = fml, data = mi(ds1, ds2, ds3, ds4, ds5),
model = "twosls")
It all runs without error, but when I run summary(z.out), I get this:
"Error in apply(coef1, 1, mean) : dim(X) must have a positive length"
But, if I run the command on each imputed data set individually, the
code above works.
2. "weights"
Here is the code I ran:
"Error in systemfit.control(...): unused argument(s) (weights = "weights")"
If I take out the "weights" command, the code works fine.
Thanks for the help!
-c
--
Casey A. Klofstad
University of Miami
Department of Political Science
Coral Gables, FL
klofstad(a)gmail.com
http://moya.bus.miami.edu/~cklofstad
-
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/
Hey all-
Based on a prior post, we found out that Zelig does not support
simulations with the "by" command. So, to address this, I'm trying to
do this "manually" using the subset command to select cases.
Unfortunately, this has also led to errors.
Here is what I did:
#select cases for each imputed data set
tds1 <- subset(ds1, civw1_q==2)
tds2 <- subset(ds2, civw1_q==2)
tds3 <- subset(ds3, civw1_q==2)
tds4 <- subset(ds4, civw1_q==2)
tds5 <- subset(ds5, civw1_q==2)
#run model with selected cases
z.out <- zelig(civtotw2 ~ treat + civtotw1 + dcode1 + dcode3 + dcode4
+ dcode5 + dcode6 + dcode7 + dcode8 + dcode9 + dcode10 + dcode11 +
dcode12 + dcode13 + dcode14 + dcode15 + dcode16, weights="weights",
data = mi(tds1, tds2, tds3, tds4, tds5), model = "ls")
#set values
x.untreat <- setx(z.out, treat = 0)
#generate expected values
untreat.out <- sim(z.out, x = x.untreat)
Ok, so everything runs as expected until this final step fails. The error is:
Error in mvrnorm(num, mu = coef(object), Sigma = vcov(object)) :
incompatible arguments
Traceback says:
7: stop("incompatible arguments")
6: mvrnorm(num, mu = coef(object), Sigma = vcov(object))
5: param.lm(object[[i]], num = numM, bootstrap = bootstrap)
4: param(object[[i]], num = numM, bootstrap = bootstrap)
3: MIsimulation(object, num, prev, bootstrap, bootfn = bootfn, x = x,
x1 = x1, ...)
2: sim.setx.MI(z.out, x = x.untreat)
1: sim(z.out, x = x.untreat)
What am I missing here? One thing to note is that the sizes of the
data sets differ by a few cases. This is becuase the number of cases
where "civw1_q==2" differs based on the imputed values. Could that be
the issue?
Thanks much,
-c
--
Casey A. Klofstad
University of Miami
Department of Political Science
Coral Gables, FL
klofstad(a)gmail.com
http://moya.bus.miami.edu/~cklofstad
-
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/
great, thanks Will! We will give it a try.
Gary
On Sun, 2 Mar 2008, Will Lowe wrote:
> OK. The following is not pleasant, but appears to work and is easily
scriptable.
Organize the source into separate files and _two_ master files. As in the
previous example let the separate files be:
---------- firstbit.tex ----------
\section{First Section}\label{sec:1}
The first section's text. There will be more text in section~\ref{sec:2}.
---------- secondbit.tex ----------
\section{Second Section}\label{sec:2}
The second section's text. There was more text in section~\ref{sec:1}.
----------
In the first master file, use \input to create a whole document, like this:
--------- main-whole.tex ----------
\documentclass{article}
\begin{document}
\input{firstbit}
\input{secondbit}
\end{document}
------------
Compile as usual to make the whole document. Now turn to the other master
file. It is just like the file above but uses \include, like this:
--------- main-part.tex ----------
\documentclass{article}
\begin{document}
\include{firstbit}
\include{secondbit}
\end{document}
----------
And compile it. For reasons best known to TeX this will not create the same
output when compiled: there will be a page break after each included file.
Throw away the superfluously-spaced pdf output and insert
\includeonly{secondfile}
just before the \begin{document} and compile again. The result should be a
document containing only the contents you want, but with the cross
references and other numbering working right.
\includeonly takes comma-separated filenames if you want more than one
section to stand alone. This works because \include gives each included
file its own aux files (and adds a page break) whereas \input does neither.
That should allow you the flexibility to pull out particular sections
irrespective of whether they happen to start on a new page.
Will
--------------------
Thanks Will. This is helpful. I think we need one more step tho. Instead
of outputting pages 7-10, say, as a separate document, we want to output the
contents of a \chapter or \section as a separate document. any idea how to
do that? and, as you recognize, the solution has to be scriptable given how
often we do builds.
Gary
On Sun, 2 Mar 2008, Will Lowe wrote:
On 2 Mar 2008, at 2:50, Gary King wrote:
unfortunately, running latex another time doesn't help; we just haven't yet
figured out how to both have the latex referencing working properly and the
parts compiled separately. its a bit complicated with vignettes and all.
we're looking into it.
You could cheat and simply pull the relevant vignette pages out of the
larger document. Acrobat will do this sort of thing, but here's a
scriptable solution using the pagesel.sty package:
---------------
\documentclass{article}
\usepackage[2]{pagesel} %% just output page 2, or [2-7], etc.
%% For the old school
%% \documentstyle[selectp]{article}
%% \outputonly{2}
\begin{document}
\section{First Section}\label{sec:1}
The first section's text. There will be more text in section~\ref{sec:2}.
\newpage
\section{Second Section}\label{sec:2}
The second section's text. There was more text in section~\ref{sec:1}.
\end{document}
---------------
To make the \ref and \label bits work properly, first _comment out_ the
\usepackage statement and compile until the references work (that's the
complete document done), then _uncomment_ the \usepackage statement, and
compile again (that's section 2 only done). The second (and subsequent)
runs use the .aux files from the first part.
Clearly this should be scripted, but I assume you already have a makefile or
somesuch that can trigger the preprocessing sequence, move the output pdf
files, etc.
Apologies if you've already considered this route,
Will
Gary
On Sun, 2 Mar 2008, Emilio Luque wrote:
> Dear all,
> > Wouldn't the question marks in Zelig's Installation PDF section calls >
mean
> that it needs another LaTeX run?
> > Best,
> Emilio
> > --
> Emilio Luque
> Dir. Investigación IUED
> [C/Juan del Rosal, 10, Fac. Psicología, Despacho 0.17, 913986685]
> Prof. Medio Ambiente y Sociedad; Director Adj. Postgrado en Juventud y
> Sociedad
> [Dep. Sociología II, C/Obispo Trejo, s/n, Despacho 3.14, 913988354]
> UNED 28040 Madrid (España)
> > ATACD EU Project partner: http://atacd.net
Thanks Will. This is helpful. I think we need one more step tho.
Instead of outputting pages 7-10, say, as a separate document, we want to
output the contents of a \chapter or \section as a separate document.
any idea how to do that? and, as you recognize, the solution has to be
scriptable given how often we do builds.
Gary
On Sun, 2 Mar 2008, Will Lowe wrote:
>
> On 2 Mar 2008, at 2:50, Gary King wrote:
>>
>> unfortunately, running latex another time doesn't help; we just haven't yet
>> figured out how to both have the latex referencing working properly and the
>> parts compiled separately. its a bit complicated with vignettes and all.
>> we're looking into it.
>>
>
> You could cheat and simply pull the relevant vignette pages out of the larger
> document. Acrobat will do this sort of thing, but here's a scriptable
> solution using the pagesel.sty package:
>
> ---------------
>
> \documentclass{article}
> \usepackage[2]{pagesel} %% just output page 2, or [2-7], etc.
>
> %% For the old school
> %% \documentstyle[selectp]{article}
> %% \outputonly{2}
>
> \begin{document}
> \section{First Section}\label{sec:1}
> The first section's text. There will be more text in section~\ref{sec:2}.
>
> \newpage
>
> \section{Second Section}\label{sec:2}
> The second section's text. There was more text in section~\ref{sec:1}.
>
> \end{document}
>
> ---------------
>
> To make the \ref and \label bits work properly, first _comment out_ the
> \usepackage statement and compile until the references work (that's the
> complete document done), then _uncomment_ the \usepackage statement, and
> compile again (that's section 2 only done). The second (and subsequent) runs
> use the .aux files from the first part.
>
> Clearly this should be scripted, but I assume you already have a makefile or
> somesuch that can trigger the preprocessing sequence, move the output pdf
> files, etc.
>
> Apologies if you've already considered this route,
>
> Will
>
>
>
>> Gary
>>
>> On Sun, 2 Mar 2008, Emilio Luque wrote:
>>
>> > Dear all,
>> >
>> > Wouldn't the question marks in Zelig's Installation PDF section calls
>> > mean
>> > that it needs another LaTeX run?
>> >
>> > Best,
>> > Emilio
>> >
>> > --
>> > Emilio Luque
>> > Dir. Investigación IUED
>> > [C/Juan del Rosal, 10, Fac. Psicología, Despacho 0.17, 913986685]
>> > Prof. Medio Ambiente y Sociedad; Director Adj. Postgrado en Juventud y
>> > Sociedad
>> > [Dep. Sociología II, C/Obispo Trejo, s/n, Despacho 3.14, 913988354]
>> > UNED 28040 Madrid (España)
>> >
>> > ATACD EU Project partner: http://atacd.net
>
>