Learn R Programming

eggCounts (version 2.4)

getPrior_mu: Get prior parameters from Gamma distribution

Description

Compute the shape and rate parameters from a Gamma distribution for \(\mu\) based on some prior belief about its cumulative distribution function.

Usage

getPrior_mu(x, px, y, py, s1 = 1, s2 = 0.001, plot = TRUE)

Value

Returns Gamma prior parameters for \(\mu\) and the printed argument to use in a fecr_stan() or a fec_stan() function call.

Arguments

x,px,y,py

numeric. Threshold of some prior belief about true epg. There is px probability that the true epg is below x, and there is py probability that the true epg is below y.

s1,s2

numeric. Starting values.

plot

logical. If TRUE, the prior distribution is plotted after parameters are found.

Author

Tea Isler
Craig Wang

Details

multiroot function from rootSolve package is used to compute the parameters.

Examples

Run this code
# there is 30% probability that the mean epg is less than 200 
# and 80% probability that the mean epg is less than 500
getPrior_mu(x = 200, px = 0.3, y = 500, py = 0.8)

Run the code above in your browser using DataLab