[R] Functional data analysis - problems with smoothing

Peter Ehlers ehlers at ucalgary.ca
Fri Oct 23 16:18:30 CEST 2009


Ben,

  I lose my bet! Good thing my opinion is never worth more than $.02.

Looking at the code for smooth.spline() I see that, although 'argvals'
is the first argument to the function, the error message is generated
by the second argument. [** Spencer, is this intentional? **]

So, Ben, try str(rlz) or class(rlz) and see whether it conforms to
one of the structures described in ?smooth.basis.

  -Peter Ehlers

Benjamin Cheah wrote:
> Hi Peter and Spencer (and everyone else out there),
> 
> Thank you for your prompt reply to my post re. FDA - FYI - i'm very new to R and FDA. Currently half way through a biostats masters degree in Sydney, Australia! Absolutely loving it and I hope to include R computing on my future CV!
> 
> Just to clarify things:
> 
> When I entered what you suggested, this is what I obtained with my own dataset....
>> str(isi)
>  num [1:14] 1 1.5 2 2.5 3 3.5 4 5 7 10 ...
> 
> Similarly, for Jim Ramsay's dataset (chapter five of Use R book):
>> str(age)
>  num [1:31] 1 1.25 1.5 1.75 2 3 4 5 6 7 ...
> 
> Doesn't this mean that my data object, 'isi' is numeric?
> 
> Also, I was looking through Jim Ramsay's datasets - I'm fairly sure that my vector, 'isi' was similarly organised to his vector, 'age' in chapter 5 of his new Use R FDA book, so I'm fairly certain that the data is numeric.... but it obviously isn't....
> 
> Hope this email clarified things - apologies if it hasn't - still very new to the terminology and overall feel of R.....
> 
> The R user network is terrific! Thank you for caring!
> 
> Ben
> 
> 
> 
> 
> ________________________________
> From: Peter Ehlers <ehlers at ucalgary.ca>
> 
> Cc: R-help at r-project.org
> Sent: Fri, 23 October, 2009 5:07:15 PM
> Subject: Re: [R] Functional data analysis - problems with smoothing
> 
> The error message is pretty clear: regardless of what
> *you* think, R says that 'isi' is not numeric.
> 
> Are you sure that 'isi' is not a *factor* object?
> I'm willing to bet that it is.
> 
> Use str() to check your data.
> 
> -Peter Ehlers
> 
> Benjamin Cheah wrote:
>> Hi all,
>>
>> I'm having major issues with smoothing my functional data
>>
>> I'm referring to Jim Ramsay's
>> examples in his books. The following error message keeps appearing,
>> despite all my data being numeric.... can anyone kindly offer any suggestions?
>>
>> isi - vector of argument values - i.e. the independent variable of the curves
>> rlz - data array
>> TMSfdPar - functional data parameter.
>>
>>> TMSfdPar = fdPar(TMSbasis, 4, 0.01)
>>> TMSfdsmooth = smooth.basis(isi, rlz, TMSfdPar)
>> Error in smooth.basis(isi, rlz, TMSfdPar) : 'argvals' is not numeric.
>>
>> I don't understand why the error message keeps popping up. I've tried playing around with Jim Ramsay's datasets and I think my data is organised in a similar manner to his, so can't understand what's going on.... oh, the frustration!
>>
>> Thanks in advance,
>>
>> Ben
>> (the amateur R data analyst and statistician.....)
>>
>>
>>
>>       __________________________________________________________________________________
>>
>>
>>     [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at 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.
>>
>>
> 
> 
> 
>       __________________________________________________________________________________
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.
> 
>




More information about the R-help mailing list