Re: [Rd] Multiplication (PR#8466)

2006-01-07 Thread George Casella
Thanks

Herve Pages wrote:

> Thomas Lumley wrote:
> 
>> On Fri, 6 Jan 2006, [EMAIL PROTECTED] wrote:
>>
>>  
>>
>>> hi - in version 2.1 the command
>>>
>>>   
>>>
 -2^2
 
>>>
>>> gives
>>>
>>> -4
>>>
>>> as the answer.  (-2)^2 is evaluated correctly.
>>>   
>>
>>
>> So is -2^2.  The precedence of ^ is higher than that of unary minus. 
>> It may be surprising, but it *is* documented and has been in S for a 
>> long time.
>>
>>
>> -thomas
>>  
>>
> No, it's not surprising. At least to me...
> In the country where I grew up, I've been teached that -x^2 means -(x^2)
> not (-x)^2 ;-)
> 
> H.
> 

-- 
George Casella  Phone: (352) 392-1941 Ext. 204
Distinguished Professor and Chair   Cell:  (352) 682-7210
Department of StatisticsFax:   (352) 392-5175
University of Florida   Email: [EMAIL PROTECTED]
P.O. Box 118545
Gainesville, FL 32611-8545

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


Re: [Rd] Multiplication (PR#8466)

2006-01-07 Thread casella
Thanks

Herve Pages wrote:

> Thomas Lumley wrote:
> 
>> On Fri, 6 Jan 2006, [EMAIL PROTECTED] wrote:
>>
>>  
>>
>>> hi - in version 2.1 the command
>>>
>>>   
>>>
 -2^2
 
>>>
>>> gives
>>>
>>> -4
>>>
>>> as the answer.  (-2)^2 is evaluated correctly.
>>>   
>>
>>
>> So is -2^2.  The precedence of ^ is higher than that of unary minus. 
>> It may be surprising, but it *is* documented and has been in S for a 
>> long time.
>>
>>
>> -thomas
>>  
>>
> No, it's not surprising. At least to me...
> In the country where I grew up, I've been teached that -x^2 means -(x^2)
> not (-x)^2 ;-)
> 
> H.
> 

-- 
George Casella  Phone: (352) 392-1941 Ext. 204
Distinguished Professor and Chair   Cell:  (352) 682-7210
Department of StatisticsFax:   (352) 392-5175
University of Florida   Email: [EMAIL PROTECTED]
P.O. Box 118545
Gainesville, FL 32611-8545

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


[Rd] minor build problem

2006-01-07 Thread Cyrus Harmon
I'm trying to build from the latest SVN sources on Mac OS X 10.4.3  
and I seem to be having a problem making the documentation.

When I do make install, i get the following:

([EMAIL PROTECTED]):~/src/R/r-devel/build-f95$ make install
make[1]: Nothing to be done for `front-matter'.
SVN-REVISION is unchanged
make[1]: Nothing to be done for `install'.
make[1]: Nothing to be done for `install'.
installing doc ...
/sw/bin/install: cannot stat `R.1': No such file or directory
make[1]: *** [install-man] Error 1
make: *** [install] Error 1

which is due to the fact that R.1 doesn't exist. When I try to make R. 
1 by going into docs and doing make svnonly, I get:

([EMAIL PROTECTED]):~/src/R/r-devel/build-f95/doc$ make svnonly
make[1]: `R.fe' is up to date.
help2man: can't get `--version' info from ../src/scripts/R.fe


When I try to run help2man manually I get:

([EMAIL PROTECTED]):~/src/R/r-devel/build-f95/doc$ perl  ../../R/tools/ 
help2man.pl --include=../../R/doc/R.aux --no-info --output=R.1 -- 
name="a language for data analysis and graphics" ../src/scripts/R.fe
help2man: can't get `--version' info from ../src/scripts/R.fe


If I try to get the version info from ../src/scripts/R.fe directly, I  
get:

([EMAIL PROTECTED]):~/src/R/r-devel/build-f95/doc$ ../src/scripts/R.fe -- 
version
Version 2.3.0 Under development (unstable) (2006-01-07 r37011)
Copyright (C) 2006 R Development Core Team

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License.  For more information about
these matters, see http://www.gnu.org/copyleft/gpl.html.


So that seems to work. There must be some problem parsing this  
output. Does have an idea why help2man is failing here?

Thanks,

Cyrus

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


Re: [Rd] minor build problem

2006-01-07 Thread Prof Brian Ripley
We know: this is due to a change in where the version is stored that 
someone did not check the consequences of. It will be fixed shortly (I am 
testing a fix right now).  Meanwhile,

make; make; make install

works.

On Sat, 7 Jan 2006, Cyrus Harmon wrote:

> I'm trying to build from the latest SVN sources on Mac OS X 10.4.3
> and I seem to be having a problem making the documentation.
>
> When I do make install, i get the following:
>
> ([EMAIL PROTECTED]):~/src/R/r-devel/build-f95$ make install
> make[1]: Nothing to be done for `front-matter'.
> SVN-REVISION is unchanged
> make[1]: Nothing to be done for `install'.
> make[1]: Nothing to be done for `install'.
> installing doc ...
> /sw/bin/install: cannot stat `R.1': No such file or directory
> make[1]: *** [install-man] Error 1
> make: *** [install] Error 1
>
> which is due to the fact that R.1 doesn't exist. When I try to make R.
> 1 by going into docs and doing make svnonly, I get:
>
> ([EMAIL PROTECTED]):~/src/R/r-devel/build-f95/doc$ make svnonly
> make[1]: `R.fe' is up to date.
> help2man: can't get `--version' info from ../src/scripts/R.fe
>
>
> When I try to run help2man manually I get:
>
> ([EMAIL PROTECTED]):~/src/R/r-devel/build-f95/doc$ perl  ../../R/tools/
> help2man.pl --include=../../R/doc/R.aux --no-info --output=R.1 --
> name="a language for data analysis and graphics" ../src/scripts/R.fe
> help2man: can't get `--version' info from ../src/scripts/R.fe
>
>
> If I try to get the version info from ../src/scripts/R.fe directly, I
> get:
>
> ([EMAIL PROTECTED]):~/src/R/r-devel/build-f95/doc$ ../src/scripts/R.fe --
> version
> Version 2.3.0 Under development (unstable) (2006-01-07 r37011)
> Copyright (C) 2006 R Development Core Team
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under the terms of the
> GNU General Public License.  For more information about
> these matters, see http://www.gnu.org/copyleft/gpl.html.
>
>
> So that seems to work. There must be some problem parsing this
> output. Does have an idea why help2man is failing here?
>
> Thanks,
>
> Cyrus
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [Rd] minor build problem

2006-01-07 Thread Simon Urbanek
Cyrus,

thanks for the report.

On Jan 7, 2006, at 1:41 PM, Cyrus Harmon wrote:

> I'm trying to build from the latest SVN sources on Mac OS X 10.4.3
> and I seem to be having a problem making the documentation.
>
> When I do make install, i get the following:
>
> ([EMAIL PROTECTED]):~/src/R/r-devel/build-f95$ make install
> make[1]: Nothing to be done for `front-matter'.
> SVN-REVISION is unchanged
> make[1]: Nothing to be done for `install'.
> make[1]: Nothing to be done for `install'.
> installing doc ...
> /sw/bin/install: cannot stat `R.1': No such file or directory
> make[1]: *** [install-man] Error 1
> make: *** [install] Error 1

Yes, if you run "make; make; make install" it goes away. It's a known  
problem caused by a recent change in the R start script and the fix  
should be committed shortly ...

Cheers,
Simon


[[alternative HTML version deleted]]

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


[Rd] confint/nls

2006-01-07 Thread Ben Bolker

   I have found some "issues" (bugs?) with nls confidence intervals ...
some with the relatively new "port" algorithm, others more general
(but possibly in the "well, don't do that" category).  I have
corresponded some with Prof. Ripley about them, but I thought I
would just report how far I've gotten in case anyone else has
thoughts.  (I'm finding the code in stats/nls.R and stats/nle-profile.R
quite dense & scary ...)
   All of this has been done with R-devel from 3 Jan 2006; the changes
that Prof. Ripley already made to allow confint.nls not to crash
when algorithm="port" are in R-devel, not R-patched.

   a synopsis of the problems with confint():

with a 1-parameter model (is confint not appropriate for 1-parameter
models? it doesn't say so in the docs [by the way, "normality" is
misspelled as "nornality" in ?confint]):

algorithm=default or plinear: get a complaint from qr.qty ('qr' and 
'y' must have the same number of rows)
port: "cannot allocate vector of size [large]" [caused by C code
looking for dims when they aren't there]

   2-parameter models:
default OK
port "cannot allocate vector"
plinear "Error in xy.coords"

3-parameter models are OK

   I can fix the 2-parameter port case by adding drop=FALSE in
appropriate places, but I wanted to check in just in case
there are better/more efficient ways than my slogging through
one case at a time ...

   apologies for the long message, but I am temporarily cut
off from any way to post these files to the web.

   cheers
 Ben Bolker

code that tests various combinations of numbers of parameters
and algorithms:
---
resmat = array(dim=c(3,2,3),
dimnames=list(npar=1:3,c("fit","confint"),c("default","plinear","port")))
resmat.fix <- resmat
## sim. values
npts=1000
set.seed(1001)
x = runif(npts)
b = 0.7
y = x^b+rnorm(npts,sd=0.05)
a =0.5
y2 = a*x^b+rnorm(npts,sd=0.05)
c = 1.0
y3 = a*(x+c)^b+rnorm(npts,sd=0.05)
d = 0.5
y4 = a*(x^d+c)^b+rnorm(npts,sd=0.05)

testfit <- function(model,start,alg) {
   tryfit <- try(fit <- 
nls(model,start=start,algorithm=alg,control=list(maxiter=200)))
   if (class(tryfit)!="try-error") {
 fitcode="OK"
 tryci <- try(confint(fit))
 if (class(tryci)!="try-error") {
   cicode="OK"
 } else cicode = as.character(tryci)
   } else {
 fitcode = as.character(tryfit)
 cicode="?"
   }
   c(fitcode,cicode)
}

m1 = c(y~x^b,y2~a*x^b,y3~a*(x+exp(logc))^b)
m2 = c(y2~x^b,y3~(x+exp(logc))^b,y4~(x^d+exp(logc))^b)
s1 = list(c(b=1),c(a=1,b=1),c(a=1,b=1,logc=0))
s2 = list(c(b=1),c(b=1,logc=0),c(b=1,logc=0,d=0.5))

for (p in 1:3) {
   resmat[p,,"default"] <- testfit(m1[[p]],start=s1[[p]],alg=NULL)
   resmat[p,,"port"] <- testfit(m1[[p]],start=s1[[p]],alg="port")
}

for (p in 1:3) {
   resmat[p,,"plinear"] <- testfit(m2[[p]],start=s2[[p]],alg="plinear")
}

print(resmat)
set.seed(1002)
example(nls,local=TRUE)

diffs:
--
*** /usr/local/src/R/R-devel/src/library/stats/R/nls.R  2006-01-07 
10:57:08.0 -0500
--- nlsnew.R2006-01-07 19:18:53.0 -0500
***
*** 266,277 
   gradSetArgs[[1]] <- (~attr(ans, "gradient"))[[2]]
   gradCall <-
   switch(length(gradSetArgs) - 1,
!call("[", gradSetArgs[[1]], gradSetArgs[[2]]),
!call("[", gradSetArgs[[1]], gradSetArgs[[2]], 
gradSetArgs[[2]]),
  call("[", gradSetArgs[[1]], gradSetArgs[[2]], 
gradSetArgs[[2]],
! gradSetArgs[[3]]),
  call("[", gradSetArgs[[1]], gradSetArgs[[2]], 
gradSetArgs[[2]],
! gradSetArgs[[3]], gradSetArgs[[4]]))
   getRHS.varying <- function()
   {
   ans <- getRHS.noVarying()
--- 266,277 
   gradSetArgs[[1]] <- (~attr(ans, "gradient"))[[2]]
   gradCall <-
   switch(length(gradSetArgs) - 1,
!call("[", gradSetArgs[[1]], gradSetArgs[[2]],drop=FALSE),
!call("[", gradSetArgs[[1]], gradSetArgs[[2]], 
gradSetArgs[[2]],drop=FALSE),
  call("[", gradSetArgs[[1]], gradSetArgs[[2]], 
gradSetArgs[[2]],
! gradSetArgs[[3]],drop=FALSE),
  call("[", gradSetArgs[[1]], gradSetArgs[[2]], 
gradSetArgs[[2]],
! gradSetArgs[[3]], gradSetArgs[[4]],drop=FALSE))
   getRHS.varying <- function()
   {
   ans <- getRHS.noVarying()
***
*** 331,337 
   else {
   vary
   }, envir = thisEnv)
!  gradCall[[length(gradCall)]] <<- useParams
if(all(useParams)) {
assign("setPars", setPars.noVarying, envir = thisEnv)
assign("getPars", getPars.noVarying, envir = thisEnv)
--- 331,337 
   else {
   vary
   }, envir = thisEnv)
!  gradCall[[length(gradCall)-1]] <<- useParams
if(all(useParams)) {
assign("setPars", setP