get_coefs: Extract reported parameter estimates

View source: R/helpers.r

get_coefsR Documentation

Extract reported parameter estimates

Description

Return parameter estimates from a fitted model.

Usage

get_coefs(obj)

Arguments

obj

A fitted model as returned by one of fit_hawkes, fit_hawkes_cbf, fit_lgcp, fit_mlgcp, or fit_stelfi.

Value

A matrix of estimated parameters and standard errors returned by TMB::sdreport ("report").

See Also

fit_hawkes, fit_hawkes_cbf, fit_lgcp, fit_mlgcp, and fit_stelfi

Examples

## Hawkes
data(retweets_niwa, package = "stelfi")
times <- unique(sort(as.numeric(difftime(retweets_niwa, min(retweets_niwa),units = "mins"))))
params <- c(mu = 9, alpha = 3, beta = 10)
fit <- fit_hawkes(times = times, parameters = params)
get_coefs(fit)
## LGCP
if(requireNamespace("fmesher")) {
data(xyt, package = "stelfi")
domain <- sf::st_as_sf(xyt$window)
locs <- data.frame(x = xyt$x, y = xyt$y)
bnd <- fmesher::fm_as_segm(as.matrix(sf::st_coordinates(domain)[, 1:2]))
smesh <- fmesher::fm_mesh_2d(boundary = bnd, max.edge = 0.75, cutoff = 0.3)
fit <- fit_lgcp(locs = locs, sf = domain, smesh = smesh,
parameters = c(beta = 0, log_tau = log(1), log_kappa = log(1)))
get_coefs(fit)
}

cmjt/stelfi documentation built on Oct. 25, 2023, 2:53 p.m.