bCM {NitrogenUptake2016} | R Documentation |
Parameterize Box-Cox model for mass-height allometry (based on Lu et al. 2016)
bCM(dat, mass = "sample", height = "height_cm", lam.avail = c(-2,
-1.5, -1, -2/3, -1/2, -1/3, 0, 1/3, 1/2, 2/3, 1, 1.5, 2),
lam.only = FALSE)
dat |
dataframe with data |
mass |
mass column |
height |
height column |
lam.avail |
set of possible lambda values |
lam.only |
if TRUE, lambda is returned. If FALSE, model is returned |
if lam.only is FALSE, a model is returned. If lam.only is TRUE, lambda value is returned.
Lu, Meng, Caplan, Joshua S., Bakker, Jonathan D., Mozdzer, Thomas J., Drake, Bert G., Megonigal, J. Patrick, and Langley, J. Adam. 2016. Allometry data and equations for coastal marsh plants. Ecology. https://doi.org/10.1002/ecy.1600.
### get allometry model for each species
CSP <- plyr::dlply(allometry, c("spp"), bCM)
CSP.coef <- plyr::ldply(CSP, stats::coef)
### add lambda value
CSP.coef$lam <- plyr::ddply(allometry, c("spp"), function(df)
bCM(df, lam.only = TRUE))[, "V1"]