get_mle: Creates the simplist frequentist version of our method

View source: R/basic_functions.R

get_mleR Documentation

Creates the simplist frequentist version of our method

Description

For each regression, the MLE is used (i.e. the coefficients and residual standard error obtained from lm). This will only work when N > m (or lm will have issues), so call the function accordingly.

Usage

get_mle(datum, NNarray)

Arguments

datum

an N * n matrix, where each row corresponds to N replications for that location

NNarray

an n * m integer matrix giving the m nearest neighbors previous in the ordering (or outputting NAs if not available [i.e. there are not m previous points]) that are ordered from closest to furthest away. Required: m < N, m >= 2

Value

Sparse triangular matrix that is the Cholesky of the precision matrix Ω such that

Ω = U U'

Examples


#create fake data and fake neighbor matrix
datum <- matrix(rnorm(1e4), nrow = 10)
NNarray <- matrix(NA, nrow = 1e3, ncol = 100)
#can only use previous points in ordering (this is actually 
#impossible in low dimensional space like this is designed for)
for(i in 1:100){
  NNarray[(i + 1):1e3, i] <- i
}
#Return sparse Cholesky of the precision matrix
uhat <- get_mle(datum, NNarray)

katzfuss-group/NPvecchia documentation built on April 15, 2022, 2:23 a.m.