Description Usage Arguments Examples
View source: R/frequency_fns.R
Takes a spatial or spatio-temporal data set and returns spatial and temporal length scales by finding the maximum likelihood on a pre-specified grid. If the data is spatio-temporal a separable covariance structure is assumed.
1 2 | lscale_from_Matern(data, rho = 100, nu = 3/2, var = 1,
theta = seq(-0.99, 0.99, 0.33))
|
data |
a data frame with fields |
rho |
an array of spatial practical ranges to consider. |
nu |
an array of smoothness parameters to consider. |
var |
an array of marginal variances to consider |
theta |
an array of first-order auto-regressive parameters to consider in the model x_{t+1} = θ x_{t} + e_{t}. |
1 2 3 4 5 6 7 8 9 10 11 | var_true <- 1
kappa_true <- kappa_from_l(l=1700,nu=2)
X <- data.frame(x = 3000*runif(100), y = 3000*runif(100))
dd<- fields::rdist(X,X)
K <- Matern(r=dd,nu=2,var=var_true,kappa=kappa_true)
X$z <- t(chol(K)) %*% rnorm(nrow(X))
var_marg <- var(X["z"])
var_search <- 10^(seq(log10(var_marg/100),log10(var_marg*100),length=100))
rho_search=seq(100,4000,200)
lk_fit <- lscale_from_Matern(X,rho=rho_search,var=var_search,nu=c(2))
print(lk_fit$spat_df)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.