| volvff | R Documentation |
An R-function for the variable form-factor volume model and a function for computing bias-corrected volumes augmented with parameter uncertainty from a model fitted using nlme.
volvff(dbh,h,theta=NA,logita=NA,lambda=NA,grad=TRUE)
predvff(data,mod,p=0.05,varMethod="taylor",biasCorr="none",nrep=500)
dbh |
vector of individual tree diameters, cm |
h |
vector of individual tree heights (m), of same length as |
theta, logita, lambda |
The parameters |
grad |
logical, whether the Jacobian needs to be returned in attribute "gradient" |
data |
A data set including variables |
mod |
A variable form-factor model fitted using |
p |
The probability used in constructiong the confidence intervals for
tree-level volumes and total volume.
Symmetric |
varMethod |
Either |
biasCorr |
Either |
nrep |
The number of replicates in the Monte Carlo simulation when
|
The variance-form-factor function is of form
v(D,H,a,\lambda)=\pi \frac{\exp(a)}{1+\exp(a)} R(D,H,\lambda)^2 H
where a is the logit-transformed form factor and R(D,H,\lambda)
is the stem radius at stump height, which is approximated using
R(D,H,\lambda)=w(H,\lambda)\frac{D}{2}+(1-w(H,\lambda))\frac{H}{H-B}\frac{D}{2}
where the weight is taken from the right tail of the logit transformation
w(H,\lambda)=2-2\frac{\exp\left( \frac{H-B}{\exp(\lambda)}\right)}{1+\exp\left( \frac{H-B}{\exp(\lambda)}\right)}
Parameter uncertainty is reported because the same realized errors are used always when a model based on certain model fitting data is used; therefore those errors behave in practice like bias. Variance for total volume is computed as sum of all elements of the variance-covariance matrix of prediction errors of the mean.
Function volvff returns a vector of tree volumes (in liters) that is of same length as
vector dbh. In addition, attribute grad returns the Jacobian, which is used
in nlme fitting for computing the derivatives of the model with respect to parameters,
and in approximating the parameter uncertainty when varMethod="taylor".
Function predvff returns a list with following objects
totvol |
Total volume of the trees of |
totvolvar |
The estimated variance of |
totvolci |
The estimated |
And attributes
trees |
A data frame of including tree-level volumes, their variance and 95% confidence intervals. |
varmu |
The variance-covariance matrix of prediction errors, taking into account theparameter uncertainty. |
Lauri Mehtatalo <lauri.mehtatalo@luke.fi>
Kangas A., Pitkanen T., Mehtatalo L., Heikkinen J. (xxxx) Mixed linear and non-linear tree volume models with regionally varying parameters
## Not run:
library(lmfor)
data(treevol)
treevol$formfactor<-treevol$v/volvff(treevol$dbh,treevol$h,logita=100,lambda=log(0.2))
treevol$logitff<-log((treevol$formfactor)/(1-(treevol$formfactor)))
ptrees<-treevol[treevol$species=="pine",]
mod.init<-lm(logitff~I(1/h)+h+dbh+I(h*dbh)+I(1/(h*dbh))+
dataset+dataset:dbh+dataset:h,data=ptrees)
mod<-nlme(v~volvff(dbh,h,logita=logita,lambda=lambda),
fixed=list(logita~I(1/h)+h+dbh+I(h*dbh)+I(1/(h*dbh))+dataset+
dataset:dbh+dataset:h+soil+temp_sum,
lambda~1),
random=logita~1|stand/plot,
start=c(coef(mod.init),rep(0,2),log(0.2)),
data=ptrees,
weights=varComb(varIdent(form=~1 |dataset),varPower()),
method="ML",
# control=list(msVerbose=TRUE),
# verbose=TRUE
)
pred1<-predvff(ptrees,mod,varMethod="simul",biasCorr="integrate")
pred1$totvol
pred1$totvolvar
pred1$totvolci
head(attributes(pred1)$trees)
pred2<-predvff(ptrees,mod,varMethod="taylor",biasCorr="twopoint")
pred2$totvol
pred2$totvolvar
pred2$totvolci
head(attributes(pred2)$trees)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.