get_betas: Function to extract the estimates of the linear coefficients...

View source: R/get_betas.R

get_betasR Documentation

Function to extract the estimates of the linear coefficients from an HPR model

Description

Function to extract the estimates of the linear coefficients from an HPR model

Usage

get_betas(object = NULL, alpha = 0.05, var_names = NULL)

Arguments

object

The results object from a run of hpr for which a matrix Z was input.

alpha

The uncertainty level for the betas; the default is 0.05 (which corresponds to 95% credible intervals).

var_names

An optional character vector containing the variable names of the columns of Z.

Value

A dataframe with a row for each beta and columns:

Variable

the name of the variable, if var_names was used

Mean

the mean of the posterior samples of the beta

Median

the median of the posterior samples of the beta

Lower

the alpha/2 percentile of the posterior samples of the beta

Upper

the 1-alpha/2 percentile of the posterior samples of the beta

Examples

X <- as.matrix(dat$Day, ncol = 1)
y <- dat$Temperature
Z <- as.matrix(dat$Aberration, ncol = 1)

mymodel <- hpr(y = y, X = X, Z = Z, family = "gaussian", beta_dist = "cauchy")
mybetas <- get_betas(mymodel, var_names = c("Aberration"))


elizabethchase/HPR documentation built on May 7, 2023, 5:48 a.m.