[Rd] Web site for MacOSX R-devel precompiled version

2016-09-29 Thread Marc Girondot via R-devel
From several years, I used this site http://r.research.att.com to get a 
precompiled version of macosx R-devol but the most recent version is 
frozen at the 18/8 build (r 71112).


Is there an alternative (except than compile myself !) ?

Thanks,

Marc

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


[Rd] Suggestion for optim() in stats package

2017-06-26 Thread Marc Girondot via R-devel

When optim() is used with method="BFGS", the name of parameters within
the vector are transmitted (see below, first example).

When method="Brent", the name of parameter (only one parameter can be
fitted with Brent method) is not transmitted. As there is only one, of
course, we know which parameter it is, but it makes things
non-consistent between methods.

It would be better that same convention is used for different method as
it will permit to make more general use of optim().

Marc

Tested in R-3.4.1

For example, here:

@@@
Method BFGS
@@@

# The names of values in par are transmitted
fitnorm_meansd<-function(par, val) {
   print(par)
   -sum(dnorm(x=val, mean=par["mean"], sd=par["sd"], log = TRUE))
}

val <- rnorm(100, mean=20, sd=2)
p<-c(mean=20, sd=2)
result<-optim(par=p, fn=fitnorm_meansd, val=val, method="BFGS")

The print(par) shows the named vector:
 > result<-optim(par=p, fn=fitnorm_meansd, val=val, method="BFGS")
mean   sd
   202
   mean sd
20.001  2.000
   mean sd
19.999  2.000
   mean sd
20.000  2.001
etc...

@@@
Method Brent
@@@

# The name of value in par is not transmitted

fitnorm_mean<-function(par, val) {
   print(par)
   -sum(dnorm(x=val, mean=par, sd=2, log = TRUE))
}

val <- rnorm(100, mean=20, sd=2)
p<-c(mean=20)
result<-optim(par=p, fn=fitnorm_mean, val=val, method="Brent", lower=10,
upper=30)


The print(par) does not show named vector:
 > result<-optim(par=p, fn=fitnorm_mean, val=val, method="Brent",
lower=10, upper=30)
[1] 17.63932
[1] 22.36068

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


[Rd] MASS:::dropterm.glm() and MASS:::addterm.glm() should use ... for extractAIC()

2017-07-09 Thread Marc Girondot via R-devel
Here is a change required from MASS:::dropterm.glm() and 
MASS:::addterm.glm().


Thanks

Marc


The stepAIC() function from package MASS uses extractAIC() to get the 
AIC from a model.

Several methods exist:
extractAIC.glm() for example, some in MASS packages and some in stats 
package.


The parameters for extractAIC() are:
fit, scale, k = 2, ...

The ... are not used in most of the extractAIC.xxx() methods, from 
example in stats:::extractAIC.glm() or MASS:::extractAIC.loglm() but its 
presence could be necessary if extractAIC() is changed to use for 
example to use AICc rather than AIC.


Within stepAIC(), extractAIC() uses always the ... parameter. So all is 
ok for that.


However, stepAIC() uses dropterm() or addterm().

Within MASS:::dropterm.glm() and MASS:::addterm.glm(), extractAIC() is 
also used but without the ... parameter.


It prevents to use new version of extractAIC() that could use this 
parameter.


The solution is simple:
In MASS:::dropterm.glm(), line 60 and MASS:::addterm.glm(), line 84:
aic <- aic + (extractAIC(object, k = k)[2L] - aic[1L])
must be changed to
aic <- aic + (extractAIC(object, k = k, ...)[2L] - aic[1L])

Other dropterm.xxx() and addterm.xxx() do not suffer this problem.

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


Re: [Rd] MASS:::dropterm.glm() and MASS:::addterm.glm() should use ... for extractAIC()

2017-08-23 Thread Marc Girondot via R-devel

Hi,
I have sent this message to this list the July, 7th. It was about a 
problem in MASS package.

Until now there is no change in the devel version.
As the problem occurs in a package and not in the R-core, I don't know 
if the message should have been sent here. Anyway, I have added a copy 
to Pr Ripley.

I hope it could have been fixed.
Sincerely
Marc

Le 09/07/2017 à 16:05, Marc Girondot via R-devel a écrit :
Here is a change required from MASS:::dropterm.glm() and 
MASS:::addterm.glm().


Thanks

Marc


The stepAIC() function from package MASS uses extractAIC() to get the 
AIC from a model.

Several methods exist:
extractAIC.glm() for example, some in MASS packages and some in stats 
package.


The parameters for extractAIC() are:
fit, scale, k = 2, ...

The ... are not used in most of the extractAIC.xxx() methods, from 
example in stats:::extractAIC.glm() or MASS:::extractAIC.loglm() but 
its presence could be necessary if extractAIC() is changed to use for 
example to use AICc rather than AIC.


Within stepAIC(), extractAIC() uses always the ... parameter. So all 
is ok for that.


However, stepAIC() uses dropterm() or addterm().

Within MASS:::dropterm.glm() and MASS:::addterm.glm(), extractAIC() is 
also used but without the ... parameter.


It prevents to use new version of extractAIC() that could use this 
parameter.


The solution is simple:
In MASS:::dropterm.glm(), line 60 and MASS:::addterm.glm(), line 84:
aic <- aic + (extractAIC(object, k = k)[2L] - aic[1L])
must be changed to
aic <- aic + (extractAIC(object, k = k, ...)[2L] - aic[1L])

Other dropterm.xxx() and addterm.xxx() do not suffer this problem.

__
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