Description Usage Arguments Details Value Author(s) References See Also Examples
This function allows to carry out prediction by Ordinary Kriging for function-value data by considering a Fourier or B-splines basis for smoothing the observed data set
1 2 3 4 |
new.coords |
an n x 2 matrix containing the coordinates of the new n sites where functional Kriging has to be done |
coords |
an s x 2 matrix containing the coordinates of the n sites where functional data are observed |
data |
an m x s matrix with values for the observed functions |
smooth.type |
a string with the name of smoothing method to be applied to |
nbasis |
a numeric value defining the number of basis functions used to smooth the discrete data set recorded at each site |
argvals |
a vector of argument values corresponding to the observations in matrix data |
lambda |
optional. Penalization parameter for smoothing the observed functions. |
cov.model |
a string with the name of the correlation function. Default is NULL, see |
fix.nugget |
logical, indicating whether the |
nugget |
value for the nugget parameter. |
fix.kappa |
logical, indicating whether the |
kappa |
value of the smoothness parameter. |
max.dist.variogram |
a numerical value defining the maximum distance considered when fitting the variogram. |
This function is a common sequence of the proposed process for doing Ordinary Kriging in the functional scenario, covers from the preparation of the original data and variogram estimation, unto data prediction.
Functional data object
This is an object of the class fd
it can be created using some functions like Data2fd
or smooth.basis
, take in count if a penalization parameter is going to be used.
Penalization parameter
The penalization parameter lambda
is used in both smoothing methods. When the selected smooth method is:
bsplines, the function which uses it is fdPar
fourier, the function which uses it is Data2fd
Functional data object
The function which creates the functional data object is determined based on the selected smooth method:
When it is bsplines, the functional data object must be created using two different functions, fdPar
and smooth.basis
in order to include the penalization parameter lambda.
When it is fourier, the functional data object is directly returned by Data2fd
because it includes the penalization parameter, the basis object, the argument values and the data, all at the same time.
A list with the following components:
coords |
a matrix containing the coordinates of the sites where functional data are observed. |
data |
a matrix with values for the observed functions. |
argvals |
a vector of argument values corresponding to the observations in matrix data |
nbasis |
a numeric value defining the number of basis functions used to smooth the discrete data set recorded at each site. |
lambda |
penalization parameter for smoothing the observed functions. |
new.coords |
matrix containing the coordinates of the new sites where functional Kriging has to be done. |
emp.trace.vari |
empirical trace-variogram. |
trace.vari |
choosed theoretical variogram model |
new.Eu.d |
distance matrix among sampling and new sites. |
functional.Kriging.weights |
functional Kriging weights. |
krig.new.data |
predicted values for the new sites. |
pred.var |
prediction variance. |
trace.vari.array |
vector of all fitted variogram models. |
datafd |
a functional data object containing a smooth of the data. |
Ramon Giraldo rgiraldoh@unal.edu.co,
Pedro Delicado pedro.delicado@upc.edu,
Jorge Mateu mateu@mat.uji.es.
Giraldo, R. (2009) Geostatistical Analysis of Functional Data. Ph.D. thesis. Universitat Politecnica de Catalunya.
Giraldo, R., Delicado, P. and Mateu, J. (2012) geofd: An R package for function-valued geostatistical prediction. Revista Colombiana de Estadistica. 35, 385-407.
l2.norm
for calculating L2 norm among functions, trace.variog
for functional empirical trace variogram calculation, fit.tracevariog
for fitting a variogram model in the funcional scenario.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | # First example: one site prediction using B-splines for smoothing
data(maritimes.avg)
data(maritimes.coords)
data(maritimes.data)
coord.cero <- matrix(c(-64.06, 45.79),nrow=1,ncol=2)
n<-dim(maritimes.data)[1]
argvals<-seq(1,n, by=1)
# Prediction by okfd
okfd.res<-okfd(new.coords=coord.cero, coords=maritimes.coords,
data=maritimes.data, nbasis=65, argvals=argvals,
fix.nugget=TRUE, kappa=0.7)
# Smoothed and predicted curves, and predicted site average values are plotted
plot(okfd.res$datafd, lty=1, col=8,
main="Smoothed", xlab="Day", ylab="Temperature (Degrees C)")
lines(okfd.res$argvals, okfd.res$krig.new.data,
col=1, lwd=2, type="l", lty=1,
main="Predictions", xlab="Day", ylab="Temperature (Degrees C)")
lines(maritimes.avg, type="p", pch=20,cex=0.5, col=2, lwd=1)
# Second example: multiple sites prediction using Fourier basis functions for smoothing
data(maritimes)
n<-dim(maritimes.data)[1]
argvals<-seq(1,n, by=1)
col1<-sample( (min(maritimes.coords[,1])*100):(max(maritimes.coords[,1])*100),
10, replace=TRUE)/100
col2<-sample( (min(maritimes.coords[,2])*100):(max(maritimes.coords[,2])*100),
10, replace=TRUE)/100
new.coords <- cbind(col1,col2)
# Prediction by okfd
okfd.res<-okfd(new.coords=new.coords, coords=maritimes.coords,
data=maritimes.data, smooth.type="fourier",
nbasis=65, argvals=argvals)
# The smoothed and predicted curves are plotted
par(mfrow=c(1,2))
plot(okfd.res$datafd, lty=1, col=8,
main="Smoothed", xlab="Day", ylab="Temperature (Degrees C)")
matplot(okfd.res$argvals, okfd.res$krig.new.data, col=1, lwd=1, type="l", lty=1,
main="Predictions", xlab="Day", ylab="Temperature (Degrees C)")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.