The goal of geoFKF is to implement a kriging method for spatial functional data.
You can install the development version of geoFKF from GitHub using devtools
package.
# install.packages("devtools")
::install_github("gilberto-sassi/geoFKF") devtools
This is a basic example which shows you how to solve a common problem:
library(ggplot2)
library(geoFKF)
data("datasetCanada")
<- as.matrix(datasetCanada$m_data)
m_data <- as.matrix(datasetCanada$m_coord[, 1:2])
m_coord <- 18
pos <- !(seq_len(nrow(m_coord)) %in% pos)
log_pos <- m_coord[pos, ]
new_loc <- m_coord[log_pos, ]
m_coord <- m_data[, pos]
y_true <- m_data[, log_pos]
m_data
<- seq(from = -pi, to = pi, length.out = length(y_true))
x
<- geo_fkf(m_data, m_coord, new_loc, t = x)
fit
<- data.frame(x , y_true, y_est = fit$estimates)
df
ggplot(df) +
geom_line(aes(x, y_true), color = "red") +
geom_line(aes(x, y_est), color = "blue")