[R] Increase Decimal Accuracy?

2006-03-02 Thread Ann Hess
Is there any way to increase the decimal accuracy for probability 
distributions.  For example (in R):

 1-pchisq(90,5)
[1] 0

But in Maple, I find that the value is 0.67193x10-17.

I need to compare some really small p-values...is there a way to increase 
the decimal place accuracy beyond 1x10-16 (which seems to be the limit)?

Any help would be appreciated.

Ann

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] contrasts for lm

2005-12-07 Thread Ann Hess

I would like estimate a number of contrasts from a one-way ANOVA model.  I see 
that the lm command has a contrasts option, but I can't figure out how to use 
it!  Any help that can be offered would be greatly apreciated.

Here is my model statement:

Model-lm(log2PM~P+T+P*T)

where P has 16 levels, T(treatment) has 12 levels and I am interested in 
looking at different treatment comparisons.

Thanks!

Ann

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] .Random.seed

2003-10-16 Thread Ann Hess
I am writing a function for the purposes of a simulation.  Due to memory
problems, the function sometimes crashes.  In order to get around this
problem, I would like to include to be able to save the last seed, so I
can pick up with the next run of the simulation after a crash.  I am
having trouble understanding what is going on with .Random.seed!

For each run of the following function, a random uniform and the current
.Random.seed should be printed:

test-function(runs,seed){
   .Random.seed-seed
   for (i in 1:runs) {
print(i)
print(runif(1,0,1))
print(.Random.seed)}
   return(.Random.seed}

Consider the following input/output:
RNGkind(kind=Marsaglia-Multicarry)
 set.seed(20391)
 seed1-.Random.seed
 seed1
[1] 401 -1607331462  -462081869
 test(2,seed1)
[1] 1
[1] 0.4188851
[1] 401 -1607331462  -462081869
[1] 2
[1] 0.7713649
[1] 401 -1607331462  -462081869
[1] 401 -1607331462  -462081869
 seed1
[1] 401 -1607331462  -462081869
 test(2,seed1)
[1] 1
[1] 0.7293294
[1] 401 -1607331462  -462081869
[1] 2
[1] 0.8266798
[1] 401 -1607331462  -462081869
[1] 401 -1607331462  -462081869


The output from each call of the function seems to suggest that
.Random.seed is not changing (although different random uniforms are
generated each time).  The second call of the function doesn't match the
first call even though the same seed is used.

Can anyone explain what is happening here?  My goal is to save the last
seed so that I can use it to generate the next run of a simulation (after
a crash).

Thanks in advance!

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help