#################################################################
data(aemet)
names(aemet)
x=aemet$temp
y=apply(aemet$logprec$data,1,sum)
# Example 1: criteria selects the best FPC (recommended)
# kmax is a integer (maximum FPC to consider)
out1=fregre.pc.cv(x,y,8,criteria="AICc")
## Example 2: Three equivalent outputs
## using the functional data
# out2=fregre.pc.cv(x,y,8,criteria="SICc")
## using the FPC components (recommended)
# pc<-fdata2pc(x,8)
# out111=fregre.pc.cv(pc,y,criteria="SICc")
## using the FPC components
# out11=fregre.pc.cv(out1$fregre.pc$fdata.comp,y,criteria="SICc")
## Example 3: stepwise selection criteria (unrecommended)
## kmax is a sequence of integer
# out3=fregre.pc.cv(x,y,1:8,criteria="AICc")
# out4=fregre.pc.cv(x,y,1:8,criteria="SICc")Run the code above in your browser using DataLab