Re: [R] Scriptable Integration

2012-02-10 Thread Hasan Diwan
Michael,
On 10 February 2012 18:11, R. Michael Weylandt
 wrote:
> I'm not quite sure what you mean, but perhaps this will help:
> spf <- splinefun(mydata$V2)
> splInt <- function(low, up) integrate(spf, low, up)$value

Sort of, I'm looking to get the nth order integral, where the only
thing I know about n is that it is greater than 1, but in practise
will be under 4. Something like:
spf <- rep(splinefun(myData$V2, times=(n-1))
splInt <- integrate(spf, min(myData$V2), max(myData$V3))

However, I can't seem to figure out how to get splinefun to evaluate
itself. Hope that's clearer and thanks for the help!
-- 
Sent from my mobile device
Envoyait de mon portable

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Scriptable Integration

2012-02-10 Thread R. Michael Weylandt
I'm not quite sure what you mean, but perhaps this will help:

library(splines)
mydata <- structure(list(V1 = c(1328565067, 1328565067.05, 1328565067.1,
1328565067.15, 1328565067.2, 1328565067.25), V2 = c(0.0963890795246276,
0.227296347215609, 0.240972698811569, 0.221208948983498, 0.230898231782485,
0.203282153087549), V3 = c(0.0245045248243853, 0.0835679411703579,
0.0612613120609633, 0.058568910563872, 0.0511868450318788, 0.0557714205674231
)), .Names = c("V1", "V2", "V3"), row.names = c(NA, 6L), class = "data.frame")

spf <- splinefun(mydata$V2)
splInt <- function(low, up) integrate(spf, low, up)$value

splInt(0, 1)

splInt(0, 2)

Michael

On Fri, Feb 10, 2012 at 6:34 PM, Hasan Diwan  wrote:
> My data:
>> dput(mydata)
> structure(list(V1 = c(1328565067, 1328565067.05, 1328565067.1,
> 1328565067.15, 1328565067.2, 1328565067.25), V2 = c(0.0963890795246276,
> 0.227296347215609, 0.240972698811569, 0.221208948983498, 0.230898231782485,
> 0.203282153087549), V3 = c(0.0245045248243853, 0.0835679411703579,
> 0.0612613120609633, 0.058568910563872, 0.0511868450318788, 0.0557714205674231
> )), .Names = c("V1", "V2", "V3"), row.names = c(NA, 6L), class = "data.frame")
>
> I'd like to apply an arbitrary number of integrations of the
> splinefunc from mydata$V2 and mydata$V3. Therefore, it should return a
> function. Anyone have any idea as to a package that allows this? Many
> thanks! -- H
> --
> Sent from my mobile device
> Envoyait de mon portable
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Scriptable Integration

2012-02-10 Thread Hasan Diwan
My data:
> dput(mydata)
structure(list(V1 = c(1328565067, 1328565067.05, 1328565067.1,
1328565067.15, 1328565067.2, 1328565067.25), V2 = c(0.0963890795246276,
0.227296347215609, 0.240972698811569, 0.221208948983498, 0.230898231782485,
0.203282153087549), V3 = c(0.0245045248243853, 0.0835679411703579,
0.0612613120609633, 0.058568910563872, 0.0511868450318788, 0.0557714205674231
)), .Names = c("V1", "V2", "V3"), row.names = c(NA, 6L), class = "data.frame")

I'd like to apply an arbitrary number of integrations of the
splinefunc from mydata$V2 and mydata$V3. Therefore, it should return a
function. Anyone have any idea as to a package that allows this? Many
thanks! -- H
-- 
Sent from my mobile device
Envoyait de mon portable

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.