Re: [Rd] Numerics behind splineDesign

2012-08-01 Thread Bert Gunter
Well, I would first check the references given in the Help file!.
That's what they're for, no?  Hastie's book is likely to more complete
on the algebra, I think.

You might also be interested in the relevant chapters of Friedman,
Hastie, et. al "The Elements of Statistical Learning Theory," which
might be a gentler exposition of the math.

Of course, the code (or a suitable exposition of it, which may not
exist) is the ultimate reference.

-- Bert

On Tue, Jul 31, 2012 at 6:25 AM, Ben Bolker  wrote:
> Nathaniel Smith  pobox.com> writes:
>
>> I find myself needing to be able to reproduce the spline bases that R
>> computes when using ns() and bs() -- but without using R. Before I go
>> diving headfirst into the C code in
>> ./src/library/splines/src/splines.c, are there any simpler references
>> anyone might recommend?
>
>  [snip]
>
>   Some of this stuff *might* be in the "White Book" (Statistical
> Models in S, ed Chambers & Hastie (esp. chapter 7?)
>
>   Ben Bolker
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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


Re: [Rd] Numerics behind splineDesign

2012-08-01 Thread peter dalgaard

On Jul 31, 2012, at 15:46 , Bert Gunter wrote:

> Well, I would first check the references given in the Help file!.
> That's what they're for, no?  Hastie's book is likely to more complete
> on the algebra, I think.
> 
> You might also be interested in the relevant chapters of Friedman,
> Hastie, et. al "The Elements of Statistical Learning Theory," which
> might be a gentler exposition of the math.
> 
> Of course, the code (or a suitable exposition of it, which may not
> exist) is the ultimate reference.

Also check out the various web resources (Google for basis spline or B-spline). 
I don't recall the white book chapter, but it might be a little short on the 
algebraic details. Another Google point is "de Boor".  


> 
> -- Bert
> 
> On Tue, Jul 31, 2012 at 6:25 AM, Ben Bolker  wrote:
>> Nathaniel Smith  pobox.com> writes:
>> 
>>> I find myself needing to be able to reproduce the spline bases that R
>>> computes when using ns() and bs() -- but without using R. Before I go
>>> diving headfirst into the C code in
>>> ./src/library/splines/src/splines.c, are there any simpler references
>>> anyone might recommend?
>> 
>> [snip]
>> 
>>  Some of this stuff *might* be in the "White Book" (Statistical
>> Models in S, ed Chambers & Hastie (esp. chapter 7?)
>> 
>>  Ben Bolker
>> 
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 
> 
> -- 
> 
> Bert Gunter
> Genentech Nonclinical Biostatistics
> 
> Internal Contact Info:
> Phone: 467-7374
> Website:
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

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


[Rd] Package index help file question.

2012-08-01 Thread Damien Georges


Dear R developers,

I come to you because nobody was able to answer the following request yet.

I'm developing a release of BIOMOD package called biomod2
( https://r-forge.r-project.org/R/?group_id=302).

I'm writing my package helps files and I'm not really satisfied by the
visual results.

I would like to make subsections in the  package "function help index" file.

I would like for example to put all S4 object documentation link
together, then all the getters & setters functions.. and so on..

Do you know if it's possible to do it?
Is it possible to define by myself the html/00index.html file that will
be use to build my package index file?

If it's not possible, how could I add the alphabetic subsections that
exists in most of packages index help files without raising the 100 
functions' help files?

Thanks in advances,

Best,

Damien G.





[[alternative HTML version deleted]]

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


Re: [Rd] confusion over S3/S4 importing

2012-08-01 Thread Thomas Lumley
On Mon, Jul 30, 2012 at 7:12 AM, Ben Bolker  wrote:
>
>   Can anyone help me figure out the right way to import a method that is
> defined as S3 in one package and S4 in another?
>
>   Specifically:
>
>  profile() is defined as an S3 method in the stats package:
>
> function (fitted, ...)
> UseMethod("profile")
> 
> 
>
>  In stats4 it is defined as an S4 method:
>
>  stats4:::profile
> standardGeneric for "profile" defined from package "stats"
>
> function (fitted, ...)
> standardGeneric("profile")
> 
>
>In the bbmle package I want to define it as an S4 method:
>
>   setMethod("profile", "mle2", function (...) {...})
>
>   In the NAMESPACE file for bbmle I have
>
>  importFrom(stats4,profile)
>
>   However, in R 2.14.2 (which is I am currently trying to fix: I would
> like to try to allow for backward compatibility), I get
>
> library(bbmle)
> example(mle2) ## to create some fitted objects
> profile(fit)
> Error in UseMethod("profile") :
>   no applicable method for 'profile' applied to an object of class "mle2"
>
>  whereas stats4::profile(fit) works fine.
>
>   -- a similar issue occurs for coef.
>
>   I would have thought that importFrom() would allow package code to
> find the 'stats4' version of profile (and coef) before it found the
> 'stats' versions , but that doesn't seem to be the case.
>
>   Just for kicks I tried
>
> import(stats4)
>
>   which leads to warning messages but no improvements.
>
> If I add an explicit Depends: on stats4 that fixes the problem. I may be
> forced to do that, but I thought it was supposed to be a last resort and
> that I was *supposed* to be able to fix my problems by proper use of
> imports.

'Imports' won't be enough -- the whole point of a generic is that it's
visible to the user, which doesn't happen with imports.

   -thomas

-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland

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


Re: [Rd] Numerics behind splineDesign

2012-08-01 Thread Nathaniel Smith
Thanks everyone for the suggestions.

On Wed, Aug 1, 2012 at 2:39 PM, peter dalgaard  wrote:
>
> On Jul 31, 2012, at 15:46 , Bert Gunter wrote:
>
>> Well, I would first check the references given in the Help file!.
>> That's what they're for, no?  Hastie's book is likely to more complete
>> on the algebra, I think.

How embarrassing... the help files do cite the white book (only), and
I did check it of course, but it has no more details on how the basis
functions are computed than does the help file itself, and so I must
have forgotten about it when writing my email. Still, my apologies for
the confusion.

I'm not sure what you mean by "Hastie's book", though?

>> You might also be interested in the relevant chapters of Friedman,
>> Hastie, et. al "The Elements of Statistical Learning Theory," which
>> might be a gentler exposition of the math.
>>
>> Of course, the code (or a suitable exposition of it, which may not
>> exist) is the ultimate reference.
>
> Also check out the various web resources (Google for basis spline or 
> B-spline). I don't recall the white book chapter, but it might be a little 
> short on the algebraic details. Another Google point is "de Boor".

And indeed, it looks like the appendix to chapter 5 of Hastie,
Tibshirani, and Friedman (2008) has a short description of the de Boor
algorithm. Excellent. For the archives, this seems to be enough to
exactly implement spline.des/splineDesign, and if anyone else is
working in Python then it turns out that there is a more-or-less
undocumented implementation of this algorithm in
scipy.interpolate.splev.

Now I just have to grovel over the R code in ns() and bs() to figure
out how exactly they pick knots and handle boundary conditions, plus
there is some code that I don't understand in ns() that uses qr() to
postprocess the output from spline.des. I assume this is involved
somehow in imposing the boundary conditions...

Thanks again everyone for your help,
-- Nathaniel

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


Re: [Rd] Numerics behind splineDesign

2012-08-01 Thread peter dalgaard

On Aug 1, 2012, at 18:03 , Bert Gunter wrote:

> Inline...
> 
> On Wed, Aug 1, 2012 at 8:36 AM, Nathaniel Smith  wrote:
>> Thanks everyone for the suggestions.
>> 
>> On Wed, Aug 1, 2012 at 2:39 PM, peter dalgaard  wrote:
>>> 
>>> On Jul 31, 2012, at 15:46 , Bert Gunter wrote:
>>> 
 Well, I would first check the references given in the Help file!.
 That's what they're for, no?  Hastie's book is likely to more complete
 on the algebra, I think.
>> 
>> How embarrassing... the help files do cite the white book (only), and
>> I did check it of course, but it has no more details on how the basis
>> functions are computed than does the help file itself, and so I must
>> have forgotten about it when writing my email. Still, my apologies for
>> the confusion.
>> 
>> I'm not sure what you mean by "Hastie's book", though?
> 
> Ummm...  The following appears in the  ?bs man page. Why do you not
> see it? Are you perhaps being too "hasty" in your reading (heh-heh)?
> 
> References
> 
> Hastie, T. J. (1992) Generalized additive models. Chapter 7 of
> Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth
> & Brooks/Cole.

It's not Hastie's book, though It's his chapter in a book edited by 
Chambers and Hastie. 


-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

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


Re: [Rd] Package index help file question.

2012-08-01 Thread Duncan Murdoch

On 01/08/2012 10:10 AM, Damien Georges wrote:

Dear R developers,

I come to you because nobody was able to answer the following request yet.

I'm developing a release of BIOMOD package called biomod2
( https://r-forge.r-project.org/R/?group_id=302).

I'm writing my package helps files and I'm not really satisfied by the
visual results.

I would like to make subsections in the  package "function help index" file.

I would like for example to put all S4 object documentation link
together, then all the getters & setters functions.. and so on..

Do you know if it's possible to do it?
Is it possible to define by myself the html/00index.html file that will
be use to build my package index file?

If it's not possible, how could I add the alphabetic subsections that
exists in most of packages index help files without raising the 100
functions' help files?


There isn't any support for either of those things, but R is open 
source, so you might be able to do it.


The HTML index is created when the package is installed by the 
tools:::.writePkgIndices function, and is displayed by the tools:::httpd 
function.  You could modify either of those to either install or to just 
display something different.  Or more simply, you could write your own 
file and replace the 00Index.html file after your package is installed.


Duncan Murdoch

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