Title: | 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>. |
Authors: | Gilberto Sassi [aut, cre] |
Maintainer: | Gilberto Sassi <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1 |
Built: | 2024-11-25 06:37:02 UTC |
Source: | CRAN |
This function computes minimum square estimates for Fourier coefficients.
coef_fourier(f, m)
coef_fourier(f, m)
f |
A time series to be smoothed. |
m |
Order of the Fourier polynomial. Default value is computed using the Sturge's rule. |
A vector with the fourier coefficients.
x <- seq(from = -pi, to = pi, by = 0.01) y <- x^2 + rnorm(length(x), sd = 0.1) v_coef <- coef_fourier(y)
x <- seq(from = -pi, to = pi, by = 0.01) y <- x^2 + rnorm(length(x), sd = 0.1) v_coef <- coef_fourier(y)
Temperature time series from 35 weather stations from Canada. This dataset
is a classic one and was used in famous package fda
. We have made a few
changes in this dataset.
data("datasetCanada")
data("datasetCanada")
A list with two entries: m_cood
and m_data
.
m_coord
a tibble
with latitude, logitude and the name
of stations.
a tibble
where each column is the time series from a
weather station.
the CanadianWeather
dataset from the R
package
fda
.
This function computes the smoothed curve using Fourier coefficients.
fourier_b(coef, x)
fourier_b(coef, x)
coef |
Fourier coefficients. |
x |
a time series to evaluate the smoothed curve. |
a time series with the smoothed curve.
v_coef <- rnorm(23) fourier_b(v_coef)
v_coef <- rnorm(23) fourier_b(v_coef)
geo_fkf
implements the kriging method for spatial functional datasets.
geo_fkf(m_data, m_coord, new_loc, p, t = seq(from = -pi, to = pi, by = 0.01))
geo_fkf(m_data, m_coord, new_loc, p, t = seq(from = -pi, to = pi, by = 0.01))
m_data |
a tibble where each column or variable is data from a station |
m_coord |
a tibble with two columns: latitude and longitude |
new_loc |
a tible with one observation, where the columns or variables are latitude and longitude |
p |
order in the Fourier Polynomial |
t |
a time series with values belonging to |
a list with three entries: estimates
, Theta
and
cov_params
the estimate curve
weights (matrices) of the linear combination
estimate ,
and
data("datasetCanada") m_data <- as.matrix(datasetCanada$m_data) m_coord <- as.matrix(datasetCanada$m_coord[, 1:2]) pos <- sample.int(nrow(m_coord), 1) log_pos <- !(seq_len(nrow(m_coord)) %in% pos) new_loc <- m_coord[pos, ] m_coord <- m_coord[log_pos, ] m_data <- m_data[, log_pos] geo_fkf(m_data, m_coord, new_loc)
data("datasetCanada") m_data <- as.matrix(datasetCanada$m_data) m_coord <- as.matrix(datasetCanada$m_coord[, 1:2]) pos <- sample.int(nrow(m_coord), 1) log_pos <- !(seq_len(nrow(m_coord)) %in% pos) new_loc <- m_coord[pos, ] m_coord <- m_coord[log_pos, ] m_data <- m_data[, log_pos] geo_fkf(m_data, m_coord, new_loc)
,
and
.This function maximum likelihood estimate for ,
and
in the random field model for the covariance.
log_lik_rf(m_coef, m_coord)
log_lik_rf(m_coef, m_coord)
m_coef |
Matrix where each column is an observed vector |
m_coord |
Matrix where each observation contains the latitude and longitude |
Return a list with
A vector with the estimates of ,
and
.
A matrix of covariances of the estimates.
data("datasetCanada") m_data <- as.matrix(datasetCanada$m_data) m_coord <- as.matrix(datasetCanada$m_coord[, 1:2]) p <- ceiling(1 + log2(nrow(m_data))) m_coef <- sapply(seq_len(nrow(m_coord)), function(i) { coef_fourier(m_data[, i], p) }) log_lik_rf(m_coef, m_coord)
data("datasetCanada") m_data <- as.matrix(datasetCanada$m_data) m_coord <- as.matrix(datasetCanada$m_coord[, 1:2]) p <- ceiling(1 + log2(nrow(m_data))) m_coef <- sapply(seq_len(nrow(m_coord)), function(i) { coef_fourier(m_data[, i], p) }) log_lik_rf(m_coef, m_coord)
Log likelihood function for multivariate normal with spatial dependency.
mCoef |
coefficient matrix. Each column is the coefficient from a curve; |
mDist |
distance matris; |
s2 |
variance from the covariance model; |
phi |
variance from the covariance model; |
rho |
variance from the covariance model; |