R/CCBetaRegression.R

#' Perform the beta regression used to demonstrate the relationship between
#' canopy cover and distance from the impoundment.
#'
#' @import betareg dplyr
#' @export

## Create LightData object by combining PlotData, containing densiometer data,
## with site type (lake versus river) data from ElevationData

CCBetaRegression <- function(){
  CreateDatasets()
  LightData$RegProp <- (LightData$CanopyProp *
                          (185 - 1) + 0.5) / (185) ## See Smithson + Verkulien 2006
  LightData$LogCode <- log(LightData$PlotCode)
  LightBetaReg <<- betareg(RegProp ~ LogCode + LakeRiver, data = LightData)
  LightData$Predict <- predict(LightBetaReg, newdata = LightData)
  LightData <<- LightData
  return(LightBetaReg)
}
mikemahoney218/BeaverForaging documentation built on May 8, 2019, 7:29 a.m.