Topic: Growth

Topic Description:

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



File: growth/growthfit.bin.r

View File Source Download File No help file available

Function: llike.linearbin.optim

Function Description: llike.linearbin.optim

This is for optim, a single function taking all parameters at once, including sd, to get single likelihood.

Function Arguments:

ArgumentDefault Value
param
x
y
predfunc
nomainpar
badpredpar
llikefunc
sdfunc
badsdpar
...

Function Source:


llike.linearbin.optim=function(param,x,y,predfunc,nomainpar,badpredpar,llikefunc,sdfunc,badsdpar,...
        ) {
extra=list(...)
if(is.null(extra$MINIMUM_SD)) MINIMUM_SD=0.00
else MINIMUM_SD=extra$MINIMUM_SD

predpar=param[1:nomainpar]
binparam=predpar[1:(nomainpar/2-1)]
sdpar=param[-(1:nomainpar)]

SD=sdfunc(x,sdpar)

if(length(which(SD<=MINIMUM_SD))>0) return(-Inf)
if(!is.null(badsdpar)) if(badsdpar(x,sdpar)) return(-Inf)


llike=llikefunc(testparam=predpar[1],allparam=predpar,whichtest=1,x=x,obs=y,model=predfunc,badpred=
        badpredpar,SD=SD)
total=sum(llike)
if(is.na(total)) browser()

return(total)
}