mape_poisson: mape_poisson

Description Usage Arguments Value Examples

View source: R/mape_poisson.R

Description

mape_poisson

Usage

1
mape_poisson(df, a_prior, b_prior)

Arguments

df

data.frame object, containing at least column named 'x' containing non-negative integer values.

a_prior

positive numeric, giving prior parameter 'a', assuming Poisson parameter L ~ beta(a, b).

b_prior

positive numeric, giving prior parameter 'b', assuming Poisson parameter L ~ beta(a, b).

Value

numeric, maximum a-posteriori estimate (MAPE) of Poisson parameter L, assuming df$x ~ poisson(L), and L ~ beta(a, b).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Generate example data:
set.seed(31)
L = 5

# Number of experiments, i.e. rows in df:
numexps = 10

# Filling df with pseudo data; note the requisite column 'x':
df = data.frame('x' = rpois(numexps, L))

# Generating maximum a posteriori estimate (MAPE) solution for L:
L_fit = mape_poisson(df = df, a_prior = 1, b_prior = 1)

# Compare fitted values to known values:
cbind(L, L_fit)

alexandercoulter/DHBayes documentation built on Dec. 19, 2021, 12:29 a.m.