stap_termination: Spatial-Temporal Exposure Termination-Maximization Estimates

View source: R/stap_termination.R

stap_terminationR Documentation

Spatial-Temporal Exposure Termination-Maximization Estimates

Description

Spatial-Temporal Exposure Termination-Maximization Estimates

Usage

stap_termination(object, prob = 0.9, exposure_limit = 0.05,
  pars = NULL, max_value = NULL, ...)

## S3 method for class 'stapreg'
stap_termination(object, prob = 0.9,
  exposure_limit = 0.05, pars = NULL, max_value = NULL, ...)

Arguments

object

A fitted model object returned by one of the rstap modeling functions. See stapreg-objects.

prob

A number p (0 < p < 1) indicating the desired probability mass to include in the intervals. The default is to report 90% intervals (prob=0.9) rather than the traditionally used 95% (see Details).

exposure_limit

A number indicating the desired amount of exposure for which the function will return an estimate of distance/time. Note that the exposure_limit corresponds to spatial exposure and 1-temporal exposure.

pars

An optional character vector of parameter names.

max_value

by defuault the max_distance and/or time from the model's original input will be used to calculate the upper bound of possible terminating distances/times - the max_value can be used to specify a new value for this value.

...

Currently ignored.

Value

A matrix with three columns and as many rows as model parameters (or the subset of parameters specified by pars and/or regex_pars). For a given value of prob, p, the columns correspond to the lower and upper 100p% interval limits and have the names 100α/2% and 100(1 - α/2)%, where α = 1-p. For example, if prob=0.9 is specified (a 90% interval), then the column names will be "5%" and "95%", respectively.

Examples

## Not run: 
fit_glm <- stap_glm(formula = y ~ sex + sap(Fast_Food),
                   subject_data = homog_subject_data,
                     distance_data = homog_distance_data,
                     family = gaussian(link = 'identity'),
                     subject_ID = 'subj_id',
                     prior = normal(location = 0, scale = 5, autoscale = F),
                     prior_intercept = normal(location = 25, scale = 5, autoscale = F),
                     prior_stap = normal(location = 0, scale = 3, autoscale = F),
                     prior_theta = log_normal(location = 1, scale = 1),
                     prior_aux = cauchy(location = 0,scale = 5),
                     max_distance = max(homog_distance_data$Distance),
                     chains = CHAINS, iter = ITER,
                     refresh = -1,verbose = F)
terminal_points <- stap_termination(fit_glm, prob = .9, exposure_limit = 0.01)

## End(Not run)
## Not run: 
fit_glm <- stap_glm(formula = y ~ sex + sap(Fast_Food),
                   subject_data = homog_subject_data,
                     distance_data = homog_distance_data,
                     family = gaussian(link = 'identity'),
                     subject_ID = 'subj_id',
                     prior = normal(location = 0, scale = 5, autoscale = F),
                     prior_intercept = normal(location = 25, scale = 5, autoscale = F),
                     prior_stap = normal(location = 0, scale = 3, autoscale = F),
                     prior_theta = log_normal(location = 1, scale = 1),
                     prior_aux = cauchy(location = 0,scale = 5),
                     max_distance = max(homog_distance_data$Distance),
                     chains = CHAINS, iter = ITER,
                     refresh = -1,verbose = F)
terminal_vals <- stap_termination(fit_glm, prob = .9, exposure_limit = 0.01)

## End(Not run)


Biostatistics4SocialImpact/rstap documentation built on Aug. 1, 2022, 1:15 p.m.