Package 'geoFKF'

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

Help Index


Computing coefficients Fourier.

Description

This function computes minimum square estimates for Fourier coefficients.

Usage

coef_fourier(f, m)

Arguments

f

A time series to be smoothed.

m

Order of the Fourier polynomial. Default value is computed using the Sturge's rule.

Value

A vector with the fourier coefficients.

Examples

x <- seq(from = -pi, to = pi, by = 0.01)
y <- x^2 + rnorm(length(x), sd = 0.1)
v_coef <- coef_fourier(y)

Temperature datasets from Canada.

Description

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.

Usage

data("datasetCanada")

Format

A list with two entries: m_cood and m_data.

m_coord

a tibble with latitude, logitude and the name of stations.

m_data

a tibble where each column is the time series from a weather station.

Source

the CanadianWeather dataset from the R package fda.


Smoothed curve in Fourier Series.

Description

This function computes the smoothed curve using Fourier coefficients.

Usage

fourier_b(coef, x)

Arguments

coef

Fourier coefficients.

x

a time series to evaluate the smoothed curve.

Value

a time series with the smoothed curve.

Examples

v_coef <- rnorm(23)
fourier_b(v_coef)

Kriging method for Spatial Functional Data.

Description

geo_fkf implements the kriging method for spatial functional datasets.

Usage

geo_fkf(m_data, m_coord, new_loc, p, t = seq(from = -pi, to = pi, by = 0.01))

Arguments

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 [π,π][-\pi, \pi] to evaluate the estimate curve

Value

a list with three entries: estimates, Theta and cov_params

estimates

the estimate curve

Theta

weights (matrices) of the linear combination

cov_params

estimate σ2\sigma^2, ϕ\phi and ρ\rho

Examples

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)

Maximum likelihood estimate for σ2\sigma^2, ϕ\phi and ρ\rho.

Description

This function maximum likelihood estimate for σ2\sigma^2, ϕ\phi and ρ\rho in the random field model for the covariance.

Usage

log_lik_rf(m_coef, m_coord)

Arguments

m_coef

Matrix where each column is an observed vector

m_coord

Matrix where each observation contains the latitude and longitude

Value

Return a list with

par

A vector with the estimates of σ2\sigma^2, ϕ\phi and ρ\rho.

m_cov

A matrix of covariances of the estimates.

Examples

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.

Description

Log likelihood function for multivariate normal with spatial dependency.

Arguments

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;