Re: [Rd] a^b when a is large and b < 1 (64bit R on windows 7)

2011-11-22 Thread Martyn Byng
Hi,

The problem here appears to be due to 

  29: #define MAXNUM 1.7976931348623158E308

(from
http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/mingw/mingwex/math/cephe
s_mconf.h?annotate=1.5&cvsroot=src)

and

 468: if( x >= MAXNUM )
 469:{
 470: #if INFINITIES
 471:if( y > 0.0 )
 472:return( INFINITY );
(from
http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/mingw/mingwex/math/pow.c
?annotate=1.1.10.1&cvsroot=src)


And so on 64bit Windows R build
.Machine$double.xmax = MAXMUM from above.

This is kind of confirmed as 

(.Machine$double.xmax*(1 - .Machine$double.eps))^0.5

works as expected 

Martyn


-Original Message-
From: r-devel-boun...@r-project.org
[mailto:r-devel-boun...@r-project.org] On Behalf Of Bryan W. Lewis
Sent: 21 November 2011 23:47
To: Joris Meys
Cc: r-devel@r-project.org
Subject: Re: [Rd] a^b when a is large and b < 1 (64bit R on windows 7)

Although it does not solve the issue, the INF result is due to the
MinGW gcc math library on 64-bit Windows that R links to. One can
easily see this by compiling just machar.c and checking pow and sqrt
on xmax.

Note that on any platform the results are likely to be quite different
between pow and sqrt for edge case numerical examples.

For example, on a 32-bit Ubuntu box with R-2.14.0, I get:
x = .Machine$double.xmax
y = sqrt(x)
z = x^0.5
y-z
[1] 1.488566e+138


There is also a long discussion about this here:

http://sourceforge.net/mailarchive/forum.php?forum_name=mingw-users&max_
rows=25&style=nested&viewmonth=201104


--Bryan


On Mon, Nov 21, 2011 at 10:03 AM, Joris Meys 
wrote:
> Should have specified I only checked on Windows. So: On Windows 7
> 64bit, the R-32bit works fine, the R-64bit gives the behaviour Martyn
> reported.
>
> Cheers
> Joris
>
> On Mon, Nov 21, 2011 at 3:58 PM, Brian G. Peterson
 wrote:
>> On Mon, 2011-11-21 at 14:41 +, Martyn Byng wrote:
>>> I'm getting some strange behaviour when trying to use the power
>>> operator
>>> (a^b) when a is large and b is less than one:
>>>
>>> big <- .Machine$double.xmax
>>> big
>>> big^0.5
>>> sqrt(big)
>>>
>>> > big <- 1.797693134862315708384e+308
>>> > big^0.5
>>> [1] Inf
>>> > sqrt(big)
>>> [1] 1.340781e+154
>>>
>>>
>>> I'm guessing that this behaviour is not expected, or am I missing
>>> something about ^?
>>
>> On a recent Ubuntu 64bit install with R2.14.0 from the repositories,
I
>> get:
>>
>>> big <- .Machine$double.xmax
>>> big
>> [1] 1.797693e+308
>>> big^0.5
>> [1] 1.340781e+154
>>> sqrt(big)
>> [1] 1.340781e+154
>>
>> so it does seem to be specific either to your environment.
>>
>> --
>> Brian G. Peterson
>> http://braverock.com/brian/
>> Ph: 773-459-4973
>> IM: bgpbraverock
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
>
>
> --
> Joris Meys
> Statistical consultant
>
> Ghent University
> Faculty of Bioscience Engineering
> Department of Mathematical Modelling, Statistics and Bio-Informatics
>
> tel : +32 9 264 59 87
> joris.m...@ugent.be
> ---
> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


This e-mail has been scanned for all viruses by Star.\ _...{{dropped:12}}

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] R-devel Digest, Vol 105, Issue 22

2011-11-22 Thread Terry Therneau

On Tue, 2011-11-22 at 12:00 +0100, r-devel-requ...@r-project.org wrote:
> How are the package authors supposed to develop their own NAMESPACEd
> packages efficiently? And what are the directions R is taking in order
> to
> facilitate the development cycle?
> 

This is my strategy.
I have a separate directory "test.local" in my tree, not exported to
Rforge.  It has a Makefile which loads all the sources from ../R, copies
the C files from ../src and makes a local loadable S.so.  I then do all
my development there, without a name space.  I can overwrite functions,
trace, add browser() calls --- all the things you want to do --- with
standard semantics. I obviously don't "load" my package.
  
I think this is the simplest route.  Namespaces are a great idea, but
during testing I don't want all those protections.  It took me a half
hour to set up the Makefile; I've recouped that effort many times over.

Terry Therneau

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Generate Simulation

2011-11-22 Thread savina partheni
Hallo everybody,

I'm new in r and I"ll appreciate some help!

I have a matrix of nrow=30 and ncoll=54,and I would like to generate 50
simulations with tha same size of the matrix!!!That is to say that I want
to generate 50 matrices -for my 50 simulations - with the same dimensions!
I took my 1st matrix according to the formula that I want to implement:
D<-mean_m + U_i*mat_DELTA
mean_m:vector
U_I:vector
mat_Delta:matrix(54,30)

Here is the loop:
#Define Simulations(IS)
 #Define Time Step(IT)

vec_IS<-c(1:50)
vec_IT<-c(1:30)
mat_delta<-matrix(nrow=54, ncol=30)
mat_DELTA<-matrix(nrow=54, ncol=30)
mat_Yr_m<-matrix(nrow=54, ncol=30)
D<-matrix(nrow=30, ncol=54)
DELTA<-(matrix(nrow=30,ncol=54))*50

for (i in 1:length(vec_IS)){
for (j in 1:length(vec_IT)){
Yr_m<-rnorm(54,m=0,sd=1)
mat_Yr_m[,j]<-Yr_m
delta_i<-lower_m%*%mat_Yr_m[,j]
mat_delta[,j]<-as.vector(delta_i)
}
DELTA_1<-mat_delta[,1]
DELTA_2<-mat_delta[,2]-a_1*mat_delta[,1]
for (t in 3:length(vec_IT)){
mat_DELTA[,t]<-mat_delta[,t] - a_1*mat_delta[,t-1]
- a_2*mat_delta[,t-2]
}
mat_DELTA[,1]<-DELTA_1
mat_DELTA[,2]<-DELTA_2
for (k in 1:length(nmesh)){
mean_m<-as.numeric(vec_mean_col)
DELTA<-U_i*mat_DELTA
D<-mean_m + t(DELTA)
}

}

I want to implement this formula for 50 simulations!

any idea?

Thanks a lot!

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Generate Simulation

2011-11-22 Thread Joris Meys
Not to be rude, but I'd suggest you first read the posting guide for
the mailing lists again. The r-devel list is not meant to be used as a
help forum.

https://stat.ethz.ch/mailman/listinfo/r-devel

This said, look at ?replicate.

Cheers
Joris

On Tue, Nov 22, 2011 at 4:08 PM, savina partheni  wrote:
> Hallo everybody,
>
> I'm new in r and I"ll appreciate some help!
>
> I have a matrix of nrow=30 and ncoll=54,and I would like to generate 50
> simulations with tha same size of the matrix!!!That is to say that I want
> to generate 50 matrices -for my 50 simulations - with the same dimensions!
> I took my 1st matrix according to the formula that I want to implement:
> D<-mean_m + U_i*mat_DELTA
> mean_m:vector
> U_I:vector
> mat_Delta:matrix(54,30)
>
> Here is the loop:
> #Define Simulations(IS)
>  #Define Time Step(IT)
>
> vec_IS<-c(1:50)
> vec_IT<-c(1:30)
> mat_delta<-matrix(nrow=54, ncol=30)
> mat_DELTA<-matrix(nrow=54, ncol=30)
> mat_Yr_m<-matrix(nrow=54, ncol=30)
> D<-matrix(nrow=30, ncol=54)
> DELTA<-(matrix(nrow=30,ncol=54))*50
>
> for (i in 1:length(vec_IS)){
>        for (j in 1:length(vec_IT)){
>                Yr_m<-rnorm(54,m=0,sd=1)
>                mat_Yr_m[,j]<-Yr_m
>                delta_i<-lower_m%*%mat_Yr_m[,j]
>                mat_delta[,j]<-as.vector(delta_i)
>        }
>        DELTA_1<-mat_delta[,1]
>        DELTA_2<-mat_delta[,2]-a_1*mat_delta[,1]
>                for (t in 3:length(vec_IT)){
>                        mat_DELTA[,t]<-mat_delta[,t] - a_1*mat_delta[,t-1]
> - a_2*mat_delta[,t-2]
>                }
>                mat_DELTA[,1]<-DELTA_1
>                mat_DELTA[,2]<-DELTA_2
>                        for (k in 1:length(nmesh)){
>                        mean_m<-as.numeric(vec_mean_col)
>                        DELTA<-U_i*mat_DELTA
>                        D<-mean_m + t(DELTA)
>                }
>
>        }
>
> I want to implement this formula for 50 simulations!
>
> any idea?
>
> Thanks a lot!
>
>        [[alternative HTML version deleted]]
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Mathematical Modelling, Statistics and Bio-Informatics

tel : +32 9 264 59 87
joris.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] links to package vignettes on CRAN after R 2.14.0

2011-11-22 Thread Yihui Xie
Thanks so much! I thought I misunderstood something new in R 2.14.0.

Regards,
Yihui
--
Yihui Xie 
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



On Tue, Nov 22, 2011 at 1:29 AM, Kurt Hornik  wrote:
>> Yihui Xie writes:
>
>> Hi,
>> I noticed the links to my package vignettes on CRAN were gone after I
>> started using ./vignettes instead of ./inst/doc, as suggested by the
>> R-exts manual in R 2.14.0. For example,
>
>> http://cran.r-project.org/web/packages/formatR/index.html
>> http://cran.r-project.org/web/packages/Rd2roxygen/index.html
>
>> I have put %\VignetteIndexEntry in the Rnw file, but I do not
>> understand why CRAN does not create the link in the package webpage
>> any more. In the past, my vignettes were under ./inst/doc, and the
>> links appeared as expected.
>
> Should be fixed now.
>
> -k
>
>> Thanks!
>
>> Regards,
>> Yihui
>> --
>> Yihui Xie 
>> Phone: 515-294-2465 Web: http://yihui.name
>> Department of Statistics, Iowa State University
>> 2215 Snedecor Hall, Ames, IA
>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] (>= x.y.z) in Imports field is ignored

2011-11-22 Thread Hervé Pagès

Hi,

I have IRanges 1.13.8 installed:

  > sessionInfo()
  R Under development (unstable) (2011-11-21 r57721)
  Platform: x86_64-unknown-linux-gnu (64-bit)

  locale:
   [1] LC_CTYPE=en_CA.UTF-8   LC_NUMERIC=C
   [3] LC_TIME=en_CA.UTF-8LC_COLLATE=en_CA.UTF-8
   [5] LC_MONETARY=en_CA.UTF-8LC_MESSAGES=en_CA.UTF-8
   [7] LC_PAPER=C LC_NAME=C
   [9] LC_ADDRESS=C   LC_TELEPHONE=C
  [11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C

  attached base packages:
  [1] stats graphics  grDevices utils datasets  methods   base

  other attached packages:
  [1] IRanges_1.13.8 BiocGenerics_0.1.3

And, surprisingly, I have no problem installing a package that
requires IRanges >= 1.13.9 (thru the Imports field):

  hpages@rhino1:~/HTSeqGenie/svn> grep IRanges RNASeqGenie/DESCRIPTION
  Imports: BiocGenerics (>= 0.1.3), IRanges (>= 1.13.9),

  hpages@rhino1:~/HTSeqGenie/svn> R-2.15 CMD INSTALL RNASeqGenie
  * installing to library ‘/home/hpages/R-2.15/library’
  * installing *source* package ‘RNASeqGenie’ ...
  ** R
  ** inst
  ** preparing package for lazy loading
  ** help
  *** installing help indices
  ** building package indices ...
  *** tangling vignette sources ...
 ‘RNASeqGenie.Rnw’
  ** testing if installed package can be loaded

  * DONE (RNASeqGenie)

Thanks!
H.

--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpa...@fhcrc.org
Phone:  (206) 667-5791
Fax:(206) 667-1319

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel