stap_termination: Spatial-Temporal Exposure Termination-Maximization Estimates

Description Usage Arguments Value Examples

View source: R/stap_termination.R

Description

Spatial-Temporal Exposure Termination-Maximization Estimates

Usage

1
2
3
4
5
6
7
stap_termination(object, prob = 0.9, exposure_limit = 0.05,
  pars = NULL, regex_pars = NULL, max_value = NULL, ...)

## S3 method for class 'stapreg'
stap_termination(object, prob = 0.9,
  exposure_limit = 0.05, pars = NULL, regex_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.

regex_pars

An optional character vector of regular expressions to use for parameter selection. regex_pars can be used in place of pars or in addition to pars. Currently, all functions that accept a regex_pars argument ignore it for models fit using optimization.

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 two 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
## 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)

rstap documentation built on May 1, 2019, 9:21 p.m.