Description
Kriging Method for Spatial Functional Data.
Description
A Kriging method for functional datasets with spatial dependency. This functional Kriging method avoids the need to estimate the trace-variogram, and the curve is estimated by minimizing a quadratic form. The curves in the functional dataset are smoothed using Fourier series. The functional Kriging of this package is a modification of the method proposed by Giraldo (2011) <doi:10.1007/s10651-010-0143-y>.
README.md
geoFKF
The goal of geoFKF is to implement a kriging method for spatial functional data.
Installation
You can install the development version of geoFKF from GitHub using devtools
package.
# install.packages("devtools")
devtools::install_github("gilberto-sassi/geoFKF")
Example
This is a basic example which shows you how to solve a common problem:
library(ggplot2)
library(geoFKF)
data("datasetCanada")
m_data <- as.matrix(datasetCanada$m_data)
m_coord <- as.matrix(datasetCanada$m_coord[, 1:2])
pos <- 18
log_pos <- !(seq_len(nrow(m_coord)) %in% pos)
new_loc <- m_coord[pos, ]
m_coord <- m_coord[log_pos, ]
y_true <- m_data[, pos]
m_data <- m_data[, log_pos]
x <- seq(from = -pi, to = pi, length.out = length(y_true))
fit <- geo_fkf(m_data, m_coord, new_loc, t = x)
df <- data.frame(x , y_true, y_est = fit$estimates)
ggplot(df) +
geom_line(aes(x, y_true), color = "red") +
geom_line(aes(x, y_est), color = "blue")