You can get any of these elements within each object by checking what's in
the object. So for example, you can do
names(z.out)
to see what are stored in z.out. You can do
names(summary(z.out))
to see what are stored in summary(z.out). After you find what you want,
all you need to do is to
z.out$hello
if "hello" is the name of the element in z.out
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 Thu, 3 May 2007, peter jameson wrote:
Dear Olivia,
Thank you very much for your kind assistance with my questions!
Your advice was excellent and I now have applied your coding suggestions and have my code
running
to send the coefficients, std errors and t-stats to .csv files. Your as.matrix function
did the trick nicely.
One more question: can a similar method be used to collect the Residual Deviance and AIC
values?
Ideally it would be helpful to be able to put these values adjacent to the t-values in my
.csv file as changes to
the
Residual Deviance and AIC values may be more informative than the t-values.
Your help is much appreciated, thank you again!
Cheers, Peter
---------[ ! Received Mail Content ]----------
Subject : Re: [zelig] Sending output to a .csv file
Date : Tue, 1 May 2007 19:02:10 -0400
From : "Olivia Lau" <olau(a)fas.harvard.edu>
To : "peter jameson" <dysgraphia2325(a)lycos.com>
Cc : zelig(a)lists.gking.harvard.edu
Dear Peter,
The easy way to just look at the coefficients is to transpose the matrix
before you write it out:
# Change this line
myCoeffs_myFile <- z.out_myFile$coefficients
# to
myCoeffs_myFile <- t(as.matrix(z.out_myFile$coefficients))
# Then verify that there's just one row in the output by doing
dim(myCoeffs_myFile)
# Then write to your CSV file:
write.csv(myCoeffs_myFile, ..., row.names = FALSE, col.names = TRUE, ...)
# where ... represent the options you had before (e.g, only row.names and
col.names changes)
# This writes out each simulation or set o! f coefficents as a row.
# When you read it back in, you will need t o transpose it to get sims x
coef:
coefs <- t(read.table(...))
To write out the standard errors, t-stats, etc, it's tricker because each
set of output is a matrix. You need something like (I make no claims that
the code below will work out of the box, but it should with minor
tweaking):
summ <- summary(z.out_myFile)$coef
# Define a vector of file names
files <- c("C:/coefs.csv", "C:/ses.csv",
"C:/tstats.csv")
for (i in 1:3) {
tmp <- t(summ[,i])
write.table(tmp, file = files[i], row.names = FALSE, col.names = TRUE,
...)
}
In the first run, again verify that tmp has one row and many columns using
dim(tmp).
Good luck,
Olivia
________________________________________________________________________________________________________________________
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/
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options: