Dear Peter,
This requires an advanced programming trick which is beyond the Zelig
documentation, but we do a similar thing in this paper:
There is a replication
archive which contains an R code we used to implement something similar to
what you are trying to do. I hope this is helpful.
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
-----------------------------------------------------
On Wed, 9 May 2007, peter jameson wrote:
Hi Zeligers!
Using R 2.5 / Zelig 2.8
I have been looking at the zelig.pdf and R docs with regard to loops and vectors in
order
to run repeated models like the following:
z.out_myFile <- zelig(as.factor(Tumor_1_8) ~ Q1+Q2+Q3+Q4+Q5+Q6+Q7+Q8 , model =
"oprobit", data =
myFile)
mySummary_myFile <- summary(z.out_myFile)
Questions:
1.) I would like to run the model a number of times, each run would drop one of
the IV's to see the
effect
on the Residual Deviance.
2.) Similarly for the interaction terms, Q1*Q2 etc.
I could write out the code in longhand many times to achieve the outcome but as the
number of IV's
and interactions increases this would become tedious.
I would like to generalize some set of IV's like say myIVs <-
(Q1+Q2+Q3+Q4+Q5+Q6+Q7+Q8 )
The coding below won't work of course but I hope it illustrates my attempt to
increment the IV set.
In practice I would prefer to decrement the set ie drop one variable or interaction
at a time.
myIVs <- ("Q1")
for (i in 2:8) {
# add a variable
myIVs <- ( myIVs , "Q" & i )
# do something interesting with the model and collect the results
}
I have looked for help in the faq's and Zelig and R docs but it's not
clear how this may be done.
The docs appear to consider loops to be "ungood" in terms of speed and
efficiency and prefer
vectorization whenever possible.
Hope what I am trying to do is not too opaque!
Thank you for any advice!...cheers, Peter
________________________________________________________________________________________________________________________
Love Games? Gamesville is Waiting for You...
Free Online Games, Fat Cash $ Prizes
Plus Bingo, Solitaire, Poker & Much More!
target="_blank">http://www.gamesville.com
-
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/
________________________________________________________________________________________________________________________
Love Games? Gamesville is Waiting for You... Free Online Games, Fat Cash $ Prizes Plus
Bingo, Solitaire, Poker &
Much More!
http://www.gamesville.com
- 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/