Yeah, that works. Thanks for solving the mystery.
Jon
2008/3/18, Ferdinand Alimadhi <falimadhi at iq.harvard.edu>:
The default value of "digits" option in R is 7
## clean R env.
getOption("digits")
[1] 7
1234567.34
[1] 1234567
12345.67
[1] 12345.67
When Zelig is loaded, it changes the value of "digits" option to 4 (see.
Zelig/R/load.first.R )
library(Zelig)
Loading required package:
MASS
Loading required package: boot
##
## Zelig (Version 3.1-0, built: 2007-06-12)
## Please refer to
http://gking.harvard.edu/zelig for full documentation
## or help.zelig() for help with commands and models supported by Zelig.
##
getOption("digits")
[1] 4
12.34
[1] 12.34
1234.56
[1] 1235
> ##Of course, you can change the
"digits" option
> options("digits" = 8)
> 12345.678
[1] 12345.678
thanks,
Ferdi
Jens Hainmueller wrote:
John,
This does look strange. Try to load MASS and boot separately and see if they
cause the same problem. If not, then it must be Zelig and I would contact
the maintainer of the package about this (Kosuke Imai).
I just replicated your example on my machine and I do get the same issue:
12000.22993
[1] 12000.23
library(Zelig)
Loading required package: MASS
Loading required package: boot
##
## Zelig (Version 3.1-0, built: 2007-11-30)
## Please refer to
http://gking.harvard.edu/zelig for full documentation
## or help.zelig() for help with commands and models supported by Zelig.
##
12000.22993
[1] 12000
options(digits=2)
12000.22993
[1] 12000
Jens
-----Original Message-----
From: gov2001-l-bounces at
lists.fas.harvard.edu
[mailto:gov2001-l-
bounces at
lists.fas.harvard.edu] On Behalf Of Jon Bischof
Sent: Tuesday, March 18, 2008 9:10 AM
To: gov2001-l at
lists.fas.harvard.edu
Subject: Re: [gov2001-l] zelig and decimals
Hey Jens,
It does on my computer, and detaching Zelig doesn't help. Look what
happens:
1033.52 #look it works!
[1] 1033.52
library(Zelig)
Loading required package: MASS
Loading required package: boot
##
## Zelig (Version 3.1-0, built: 2007-11-30)
## Please refer to
http://gking.harvard.edu/zelig for full
documentation
## or help.zelig() for help with commands and models supported by
Zelig.
##
Warning message:
package 'MASS' was built under R version 2.6.2
1033.52 #what is going on?
[1] 1034
detach(package:Zelig)
1033.52 #still not working
[1] 1034
options(scipen = 6) # controls scientific notation
options(digits = 2) # controls printed decimal places
1033.52 #still not working
[1] 1034
Unfortunately what you suggested doesn't help either. This is really
weird. Any ideas?
Jon
2008/3/18, Jens Hainmueller <jhainmueller at gmail.com>:
detach(package:Zelig)
does detach the package. Zelig doesn't do such rounding on my
machine:
z.out1$coef
(Intercept) gdp capmob trade
6.18129 -0.32360 1.42194 0.01985
Maybe check the digits settings:
options(scipen = 6) # controls scientific notation
options(digits = 1) # controls printed decimal places
hope this helps.
jens
-----Original Message-----
From: gov2001-l-bounces at
lists.fas.harvard.edu [mailto:gov2001-l-
> bounces at
lists.fas.harvard.edu] On Behalf Of Jon Bischof
> Sent: Tuesday, March 18, 2008 7:29 AM
> To: gov2001-l at
lists.fas.harvard.edu
> Subject: [gov2001-l] zelig and decimals
> Hi all,
> It appears that Zelig forces R to
round numbers fairly strictly
such
that 466.543 will always be 466, even if you try
to get R to keep
more
decimals. Why does Zelig do this? Is there a way
to turn this off
in
> Zelig or to detach the library?
> --
> Jon Bischof
> Graduate Student
> Department of Government
> Harvard University
_______________________________________________
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
--
Jon Bischof
Graduate Student
Department of Government
Harvard University
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
--
Ferdinand Alimadhi
Manager of Statistical Programming
Harvard University
The Institute for Quantitative Social Science
(617) 496-0187
falimadhi at
iq.harvard.edu
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
--
Jon Bischof
Graduate Student
Department of Government
Harvard University