stLL: Compute log likelihood for model

Description Usage Arguments Examples

View source: R/stLL.R

Description

Compute log likelihood for model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
stLL(
  stData,
  stFit,
  beta,
  sigmasq_y,
  sigmasq_r,
  sigmasq_eps,
  rho_y,
  rho_r,
  X = stData$X,
  Y = stData$Y,
  Z = stData$Z,
  coords.s = stData$coords.s,
  coords.r = stData$coords.r,
  coords.knots = stFit$coords.knots,
  miles = TRUE,
  sigmasq_r_eps
)

Arguments

stData

Object with class 'stData' containing data needed to fit this model. The data need only be manually entered if not using a stData object.

stFit

Object with class 'stFit' containing posterior parameter samples needed to composition sample the teleconnection effects and generate posterior predictions. The data needed from stFit need only be manually entered if not using a stData object.

beta

values of β at which to evaluate the likelihood

sigmasq_y

values of σ^2_w at which to evaluate the likelihood

sigmasq_r

values of σ^2_α at which to evaluate the likelihood

sigmasq_eps

values of σ^2_\varepsilon at which to evaluate the likelihood

rho_y

values of ρ_w at which to evaluate the likelihood

rho_r

values of ρ_α at which to evaluate the likelihood

X

[ns, p, nt] array of design matrices with local covariates

Y

[ns, nt] matrix with response data

Z

[nr, nt] matrix with remote covariates

coords.s

matrix with coordinates where responses were observed (lon, lat)

coords.r

matrix with coordinates where remote covariates were observed (lon, lat)

coords.knots

matrix with coordinates of knots for remote covariates (lon, lat)

miles

TRUE if distances should be computed in miles (kilometers otherwise)

sigmasq_r_eps

values of σ^2_{α_\varepsilon} at which to evaluate the likelihood

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(dplyr)
library(foreach)
library(itertools)

set.seed(2018)

data("coprecip")
data("coprecip.fit")
attach(coprecip)

ests = coef(coprecip.fit, burn = 50)

ll = stLL(stData = coprecip, stFit = coprecip.fit, 
          beta = matrix(ests$beta, ncol = 2), 
          sigmasq_y = ests$sigmasq_y, sigmasq_r = ests$sigmasq_r, 
          sigmasq_eps = ests$sigmasq_eps,
          rho_y = ests$rho_y, rho_r = ests$rho_r, 
          sigmasq_r_eps = 0)

jmhewitt/telefit documentation built on Feb. 9, 2020, 7:15 p.m.