## Topic: Growth

### Topic Description:

Functions for analyzing tree growth, designed for the standard CTFS R Analytical Tables.

## File: growth/growth.r

 View File Source Download File No help file available

## Function: trim.growth

### Function Description: trim.growth

This is where growth rates are excluded. It is based on a linear model estimating the standard deviation of dbh measures (due to error, that is); the parameters slope and intercept define the linear relationship between this error deviation and dbh. Any case where the second dbh measure is more than 4 standard deviations below the first is marked false, meaning it will be excluded from growth measurements. The default values of slope and intercept are based on dbh remeasure tests done in both 1995 and 2000 at BCI. A line was fitted through the absolute dbh errors as a function of dbh in both years; the average slope and intercept is used here. The function also excludes any growth rate > 75 mm per yr, cases where the stemID changes, and if the POM changes by more than 5%. All parameters for excluding growth measures based on error can be adjusted: to include all measures, set maxgrow and err.limit to very high numbers, such as 10000; to include POM changes, set pomcut to a high number, such as 10; to include cases where stemID changed, set exclude.stem.change=FALSE. This function is usually only used inside the other growth functions. With exclude.stem.change==FALSE, keep all cases where stem changes, regardless of growth (it does not make sense to exclude a record based on growth when the growth is based on different stems). Note that trees are exclude if cens1\$dbh

### Function Arguments:

ArgumentDefault Value
cens1
cens2
time
slope0.006214
intercept.9036
err.limit4
maxgrow75
pomcut0.05
mindbh10
dbhunit'mm'
exclude.sTRUE

### Function Source:

trim.growth=function(cens1,cens2,time,slope=0.006214,intercept=.9036,err.limit=4,maxgrow=75,pomcut=0
.05,mindbh=10,dbhunit='mm', exclude.stem.change=TRUE)
{
if(dbhunit=='cm') intercept=intercept/10
stdev.dbh1=slope*cens1\$dbh+intercept

growth=(cens2\$dbh-cens1\$dbh)/time

bad.neggrow=which(cens2\$dbh<=(cens1\$dbh-err.limit*stdev.dbh1))
bad.posgrow=which(growth>maxgrow)

pomdiff=abs(as.numeric(cens2\$pom)-as.numeric(cens1\$pom))/as.numeric(cens1\$pom)

accept=rep(TRUE,length(cens1\$dbh))
accept[pomdiff>pomcut]=FALSE
accept[bad.neggrow]=FALSE
accept[bad.posgrow]=FALSE
accept[is.na(growth)]=FALSE

if(exclude.stem.change) accept[cens1\$stemID!=cens2\$stemID]=FALSE
# BAD MISTAKE INCLUDING THIS!! else accept[cens1\$stemID!=cens2\$stemID]=TRUE

accept[cens1\$dbh accept[is.na(cens1\$dbh) | is.na(cens2\$dbh) | cens2\$dbh<=0]=FALSE

return(accept)
}