shift_req: Calculate intake mean shift required to achieve a specified...

View source: R/shift_req.R

shift_reqR Documentation

Calculate intake mean shift required to achieve a specified prevalence

Description

This function calculates the shift in a habitual intake distribution required to achieve a user-specified target prevalence of inadequate intakes.

Usage

shift_req(
  ear,
  cv,
  target,
  shape = NULL,
  rate = NULL,
  meanlog = NULL,
  sdlog = NULL,
  plot = F
)

Arguments

ear

Estimated Average Requirement (EAR)

cv

Coefficient of variation (CV) of the EAR

target

Target prevalence (0-100): 0 percent inadequate to 100 percent inadequate

shape

Shape parameter for gamma distribution

rate

Rate parameter for gamma distribution

meanlog

Mean parameter for gamma distribution

sdlog

Standard deviation parameter for gamma distribution

plot

Boolean (TRUE/FALSE) indicating whether to plot the distributions relative to the EAR

Value

A list of the parameters for the intake distribution required to obtain the target prevalence

Examples

# Gamma-distribution examples
sev(ear=8.1, cv=0.1, shape=9.5, rate=1.3, plot=T)
shift_req(ear=8.1, cv=0.1, target=25, shape=9.5, rate=1.3, plot=T)
shift_req(ear=8.1, cv=0.1, target=10, shape=9.5, rate=1.3, plot=T)
shift_req(ear=8.1, cv=0.1, target=5, shape=9.5, rate=1.3, plot=T)

# Lognormal-distribution examples
sev(ear=8.1, cv=0.1, meanlog=1.9, sdlog=0.3, plot=T)
shift_req(ear=8.1, cv=0.1, target=25, meanlog=1.9, sdlog=0.3, plot=T)
shift_req(ear=8.1, cv=0.1, target=10, meanlog=1.9, sdlog=0.3, plot=T)
shift_req(ear=8.1, cv=0.1, target=5, meanlog=1.9, sdlog=0.3, plot=T)

cfree14/nutriR documentation built on Oct. 31, 2024, 6:27 p.m.