Package 'fiberLD'

Title: Fiber Length Determination
Description: Routines for estimating tree fiber (tracheid) length distributions in the standing tree based on increment core samples. Two types of data can be used with the package, increment core data measured by means of an optical fiber analyzer (OFA), e.g. such as the Kajaani Fiber Lab, or measured by microscopy. Increment core data analyzed by OFAs consist of the cell lengths of both cut and uncut fibres (tracheids) and fines (such as ray parenchyma cells) without being able to identify which cells are cut or if they are fines or fibres. The microscopy measured data consist of the observed lengths of the uncut fibres in the increment core. A censored version of a mixture of the fine and fiber length distributions is proposed to fit the OFA data, under distributional assumptions (Svensson et al., 2006) <doi:10.1111/j.1467-9469.2006.00501.x>. The package offers two choices for the assumptions of the underlying density functions of the true fiber (fine) lenghts of those fibers (fines) that at least partially appear in the increment core, being the generalized gamma and the log normal densities.
Authors: Natalya Pya Arnqvist[aut, cre], Sara Sjöstedt de Luna [aut], Konrad Abramowicz [aut]
Maintainer: Natalya Pya Arnqvist <[email protected]>
License: GPL (>= 2)
Version: 0.1-8
Built: 2024-12-13 06:32:10 UTC
Source: CRAN

Help Index


Fiber Length Determination

Description

fiberLD provides functions for estimating tree fiber (tracheid) length distributions in the standing tree based on increment core samples. Two types of data can be used with the package, increment core data measured by means of an optical fiber analyzer (OFA), e.g. such as the Kajaani Fiber Lab, or measured by microscopy. Increment core data analyzed by OFAs consist of the cell lengths of both cut and uncut fibres (tracheids) and fines (such as ray parenchyma cells) without being able to identify which cells are cut or if they are fines or fibres. The microscopy measured data consist of the observed lengths of the uncut fibres in the increment core. A censored version of a mixture of the fine and fiber length distributions is proposed to fit the OFA data, under distributional assumptions. The package offers two choices for the assumptions of the underlying density functions of the true fiber (fine) lenghts of those fibers (fines) that at least partially appear in the increment core, being the generalized gamma and the log normal densities.

Maximum likelihood estimation is used for estimating the model parameters for both the OFA analyzed data and the microscopy measured data. In addition a stochastic version of the expectation-maximization method is provided to fit the log normal model to the increment core data analyzed by OFAs. Details about methods and data can be found in references.

Details

Package: fiberLD
Type: Package
License: GPL (>= 2)

Author(s)

Sara Sjöstedt de Luna, Konrad Abramowicz, Natalya Pya Arnqvist

Maintainer: Natalya Pya Arnqvist<[email protected]>

References

Svensson, I., Sjöstedt de Luna, S., Bondesson, L. (2006). Estimation of wood fibre length distributions from censored data through an EM algorithm. Scandinavian Journal of Statistics, 33(3), 503–522.

Chen, Z. Q., Abramowicz, K., Raczkowski, R., Ganea, S., Wu, H. X., Lundqvist, S. O., Mörling, T., Sjöstedt de Luna, S., Gil, M.R.G., Mellerowicz, E. J. (2016). Method for accurate fiber length determination from increment cores for large-scale population analyses in Norway spruce. Holzforschung. Volume 70(9), 829–838.


Density functions of the fiber lengths

Description

Functions to get values of the density functions of the fiber length on three different scales: as observed in the increment core corresponding to cut and uncut fiber lengths in the core (dx.fibers), as true fiber lengths of the fibres that at least partially appear in the increment core (dy.fibers) and as the true fiber lengths in the standing tree (dw.fibers).

Usage

dx.fibers(x, par, r, model="ggamma")
  dy.fibers(x, par, model="ggamma")
  dw.fibers(x, par, r, model="ggamma")

Arguments

x

vector of fiber lengths

par

vector of parameters for fiber length distribution

r

radius of the increment core

model

either ggamma (default) or lognorm

Value

returns a vector of density values

Author(s)

Sara Sjöstedt de Luna, Konrad Abramowicz, Natalya Pya Arnqvist

See Also

dx.mixture, dy.mixture, dw.mixture

Examples

library(fiberLD)
 r <- 2.5
 par <- c(1.8,2.7,2.6)
 x <- seq(.01, 2*r-.01,length=100)
 f1 <- dy.fibers(x, par)
 plot(x,f1,type="l")

 f2 <- dx.fibers(x, par, r)
 f3 <- dw.fibers(x, par, r)

 ## the same functions can be used for plotting fine densities...
 par.fines <- c(-2, .5)
 x <- seq(0, 2,length=100)
 f1.fines <- dy.fibers(x, par.fines, model="lognorm")
 plot(x,f1.fines,type="l")
 
 ## getting the distribution in the tree that goes beyond the length 
 ## of the diameter, 2r ... 
 w <- seq(0,8,length=200)
 f5 <- dw.fibers(w,par,r) ## fiber density in the tree
 par.fines <- c(.06,1.5,3.3)
 f2.fines <- dw.fibers(w, par.fines,r)
 par(mfrow=c(1,2))
 plot(w,f5,type="l", main="fiber density")
 plot(w,f2.fines,type="l", main="fine density")

Density functions of the fiber length based on microscopy data

Description

Functions to get values of the density functions of the fiber length on three different scales based on microscopy data, being the uncut fibres in the core: the uncut fibres in the increment core (dx.fibers.micro), as true fiber lengths of those fibres that at least partially appears in the increment core (dy.fibers.micro) and as the true fiber lengths in the standing tree (dw.fibers.micro).

Usage

dx.fibers.micro(x, par, r, model="ggamma")
  dy.fibers.micro(x, par, model="ggamma")
  dw.fibers.micro(x, par, r, model="ggamma")

Arguments

x

vector of fiber length

par

vector of parameters for fiber length distribution

r

radius of the increment core

model

either ggamma (default) or lognorm

Value

returns a vector of density values

Author(s)

Sara Sjöstedt de Luna, Konrad Abramowicz, Natalya Pya Arnqvist

See Also

dx.fibers, dy.mixture

Examples

library(fiberLD)
 r <- 2.5
 par <- c(1.8,2.7,2.6)
 x <- seq(.01, 2*r-.01,length=100)
 f1 <- dy.fibers.micro(x, par)
 plot(x,f1,type="l")

 f2 <- dx.fibers.micro(x, par, r)

 ## getting the density in the tree that goes beyond the length 
 ## of the diameter, 2r,... 
 w <- seq(0,8,length=200)
 f3 <- dw.fibers.micro(w, par, r)
 plot(w,f3,type="l")

Mixture density functions of the cell lengths in the increment core

Description

Functions to get values of the mixture density functions of the cell lengths on three different scales: as observed in the increment core, i.e. cut or uncut fibers or fines (dx.mixture), as true cell lengths (fibers or fines) that at least partially appears in the increment core (dy.mixture) and as the true cell lengths (fines or fibres) in the standing tree (dw.mixture).

Usage

dx.mixture(x, par, r, model="ggamma")
  dy.mixture(x, par, model="ggamma")
  dw.mixture(x, par, r, model="ggamma")

Arguments

x

vector of cell length values

par

vector of mixture model parameters

r

radius of the increment core

model

either ggamma (default) or lognorm

Value

returns a vector of density values

Author(s)

Sara Sjöstedt de Luna, Konrad Abramowicz, Natalya Pya Arnqvist

See Also

dx.fibers, dy.fibers, dw.fibers

Examples

## Not run:  
 library(fiberLD)
 data(ofa) 
 r <- 2.5
 d <- fled(data=ofa,model="lognorm",r=r)
 x <- seq(0, 8,length=100)
 f1 <- dx.mixture(x=x, par=d$par,r=r, model="lognorm")
 plot(x,f1,type="l")

 w <- seq(0, 2*r+2,length=150)
 f2 <- dy.mixture(w, d$par, model="lognorm")
 f3 <- dw.mixture(w, d$par, 6, model="lognorm")
 plot(w,f3,type="l")

## End(Not run)

Fiber length determination

Description

This function estimates fiber (tracheid) and fine (e.g. ray parenchyma cells and other small particles) lengths distribution in standing trees based on increment cores (cylindric wood samples). The data from the increment cores contain uncut fiber, fibers cut once or twice (cut by the borer) as well as non-fiber cells so-called 'fines'. A censored version of a mixture of the fine and fiber length distributions is therefore proposed to fit the data. The function offers two choices for the underlying density functions of the true unobserved uncut lengths of the fines and fibers in the increment core such as generalized gamma and log normal densities. The parameters of the mixture models are estimated by log likelihood maximization. The routine calls an optim() or nlm() functions for optimization procedure with the possibility to use a supplied gradient function. Some parameters of the generalized gamma mixture model can be fixed (rather than estimated) at the given values.

Usage

fled(data=stop("No data supplied"), data.type="ofa", r=2.5, 
     model="ggamma", method="ML", parStart=NULL, fixed=NULL, 
    optimizer=c("optim","L-BFGS-B","grad"),lower=-Inf,upper=Inf,cluster=1,...)

Arguments

data

A numeric vector of cell lengths from increment cores.

data.type

type of data supplied: ”ofa” (default) measured by an optical fiber analyser, or measured by ”microscopy” (only the lengths of uncut fibers in the core).

r

radius of the increment core (default 2.5).

model

if model="ggamma" then the distributions of the true lengths of the fibers (fines) that at least partially appear in the increment core are assumed to follow generalized gamma distributions; if model="lognorm" then log normal distributions are assumed on those fiber (fine) lengths.

method

either "ML" (default) for the maximum likelihood method or "SEM" for a stochastic version of the EM algorithm. Note "SEM" works only with the log normal model and increment core data measured by an optical fiber analyzer ("ofa").

parStart

numerical vector of starting values of parameters (or fixed values for ggamma model when !is.null(fixed)). The parameter values of the generalized gamma model should be given in the following order,

(ϵ,bfines,dfines,kfines,bfibers,dfibers,kfibers)(\epsilon, b_{fines},d_{fines},k_{fines},b_{fibers},d_{fibers},k_{fibers}).

The parameter values of the log normal model are in the order

(ϵ,μfines,σfines,μfibers,σfibers)(\epsilon, \mu_{fines}, \sigma_{fines}, \mu_{fibers}, \sigma_{fibers}) (see Details below).

fixed

TRUE/FALSE vector of seven components used to tell which parameters of ggamma model to fix. These are fixed at the values given in the argument parStart). The positive values in parStart for non-fixed parameters are starting values for the optimiser, the negative or zero values indicate that no starting values are assumed. Note, fixing parameter values currently works only with 'optim'.

optimizer

numerical optimization method used to minimize 'minus' the loglikelihood function of the observed data: 'optim', 'nlm' or 'nlm.fd' (nlm is based on finite-difference approximation of the derivatives). If optimizer==”optim” then the second argument specifies the numerical method to be used in 'optim' (”Nelder-Mead”, ”BFGS”, ”CG”, ”L-BFGS-B”, ”SANN”. The third element of optimizer indicates whether the finite difference approximation should be used ('fd') or analytical gradient ('grad') for the 'BFGS', 'CG' and 'L-BFGS-B' methods. The default is optimizer=c("optim", "L-BFGS-B","grad").

lower, upper

Bounds on the parameters for the "L-BFGS-B" method. The order of the bounds values has to be the same as the order of the parStart. Note that these bounds are on the original rather than transformed scale of the parameters used for optimization.

cluster

either '0' for no parallel computing to be used; or '1' (default) for one less than the number of cores; or user-supplied cluster on which to do estimation. cluster can only be used with OFA analyzed data (a cluster here can be some cores of a single machine).

...

Further arguments to be passed to optim.

Details

The probability density function of the three-parameter generalized gamma distribution proposed by Stacy (1962) can be written as

f(y;b,d,k)=dbdkydk1exp[(y/b)d]/Γ(k),f(y;b,d,k) = d b^{-d k} y^{d k-1} \exp[-(y/b)^d] / \Gamma(k),

where b>0b > 0, d>0d > 0, k>0k > 0, and y>0y > 0.

The probability density function of the log normal distribution can be written as

f(y;μ,σ)=exp[(log(y)μ)2/(2σ2)]/(yσ2π),f(y;\mu, \sigma) =\exp[-(\log (y)-\mu)^2/(2\sigma^2)]/(y \sigma\sqrt{2\pi}),

where σ>0\sigma > 0 and y>0y > 0.

Value

cov.par

approximate covariance matrix of the estimated parameters.

cov.logpar

approximate covariance matrix of the transformed estimated parameters.

loglik

the log likelihood value corresponding to the estimated parameters.

model

model used

mu.fibers

estimated mean value of the fiber lengths in the standing tree.

mu.fines

estimated mean value of the fine lengths in the standing tree.

mu.cell

estimated mean value of the cell lengths in the standing tree.

prop.fines

estimated proportion of fines in the standing tree.

par

the estimated parameters on the original scale.

logpar

the estimated values of the transformed parameters.

termcode

an integer indicating why the optimization process terminated (see optim).

conv

indicates why the optimization algorithm terminated.

iterations

number of iterations of the optimization method taken to get convergence.

fixed

TRUE/FALSE vector denoting if a parameter of ggamma model is fixed or not.

n

number of observations

Warning

Fixing the parameters with the generalized gamma model may lead to unstable results of the optim method.

Note

The idea and some of the code for fixing parameters with optim() is due to Barry Rowlingson, October 2011.

Author(s)

Sara Sjöstedt de Luna, Konrad Abramowicz, Natalya Pya Arnqvist

References

Svensson, I., Sjöstedt de Luna, S., Bondesson, L. (2006). Estimation of wood fibre length distributions from censored data through an EM algorithm. Scandinavian Journal of Statistics, 33(3), 503–522.

Chen, Z. Q., Abramowicz, K., Raczkowski, R., Ganea, S., Wu, H. X., Lundqvist, S. O., Mörling, T., Sjöstedt de Luna, S., Gil, M.R.G., Mellerowicz, E. J. (2016). Method for accurate fiber length determination from increment cores for large-scale population analyses in Norway spruce. Holzforschung. Volume 70(9), 829–838.

Stacy, E. W. (1962). A generalization of the gamma distribution. Annals of Mathematical Statistics, 33(3), 1187–1192.

Examples

library(fiberLD)
## using microscopy data (uncut fiber lengths in the increment core)
data(microscopy)
dat <- microscopy[1:200]
m1 <- fled(data=dat,data.type="microscopy",model="ggamma",r=2.5) 
summary(m1)
plot(m1)

## and with log normal model...
m2 <- fled(data=dat,data.type="microscopy",model="lognorm",r=2.5)
summary(m2)
plot(m2)

## Not run:  
## using data measured by an optical fiber analyser
data(ofa) 
d1 <- fled(data=ofa,model="lognorm",r=2.5)
summary(d1)
plot(d1)
x11()
plot(d1,select=2,density.scale="uncut.core")

## change the model to generalized gamma
## and set lower and upper bounds on the parameters for 
## the "L-BFGS-B" method ... 
d2 <- fled(data=ofa,model="ggamma",r=2.5,lower=c(.12,1e-3,.05,rep(.3,4)),
      upper=c(.5,2,rep(7,5)),cluster=1) 
d2
summary(d2)
plot(d2,select=1)


## change "ML" default method to a stochastic version of the EM algorithm...
d3 <- fled(data=ofa,model="lognorm",r=2.5,method="SEM",cluster=0)
d3


## End(Not run)

Data of uncut fiber lengths in the increment core

Description

Simulated data of lengths of uncut fibers in the increment core (as measured by microscopy), under the assumption that the true lengths of those fibers that at least partially appear in the increment core follow a generalized gamma distribution with parameters par=c(2.4, 3.3, 1.5). Useful for illustrating the use of fled().

Usage

data(microscopy)

Format

microscopy is a vector of 300 fiber lengths simulated from the density

dx.fibers.micro(x, par, r=2.5, model="ggamma") with parameters par=c(2.4, 3.3, 1.5)


Example of increment core data

Description

Simulated data of cell lengths of both cut and uncut fines and fibres from an increment core (as measured by means of an optical fiber analyzer). The data were simulated from a censored version of a mixture of the fine and fiber length distributions under the assumption that the true lengths of those cells (fines and fibers) that at least partially appear in the increment core follow generalized gamma distributions. Useful for illustrating the use of fled(). The values of the parameters of the mixture density are par=c(0.32, 0.001, 0.2757,5.022, 2.4, 3.3, 1.5), and the radius of the core is r=2.5mm.

Usage

data(ofa)

Format

ofa is a vector of 3000 cell lengths simulated from the density

dx.mixture(x, par, r=2.5, model="ggamma") with parameters

par=c(0.32, 0.001, 0.2757, 5.022, 2.4, 3.3, 1.5).

References

Svensson, I., Sjöstedt de Luna, S., Bondesson, L. (2006). Estimation of wood fibre length distributions from censored data through an EM algorithm. Scandinavian Journal of Statistics, 33(3), 503–522.


FLED plotting

Description

The function takes a fled object produced by fled() and creates several density plots. When the data consists of cell lengths from the increment core measured by an optical fiber analyzer ("ofa"), the function creates a histogram of the given data values together with the estimated density of the mixture model and two separate plots of the estimated fiber and fine lengths densities in the standing tree. With a microscopy sample (consisting of the lengths of uncut fibers in the increment core) the function creates two plots, a histogram of the given data with the estimated density of lenghts of the uncut fibers in the increment core and the estimated fiber length density in the standing tree.

Usage

## S3 method for class 'fled'
plot(x,select=NULL, density.scale="tree", rvec=NULL, xlab=NULL,
                    ylab=NULL,  main=NULL, col=4, lwd=2,  ...)

Arguments

x

a fled object as produced by fled().

select

allows one plot to be selected for printing. e.g., if you just want the plot for the fiber length density set select=2. When 'NULL' (default) all three plots are plotted.

density.scale

one of three options which define the scale on which the fiber/fine length densities should be plotted: "tree" (default) plots the estimated densities of the fiber/fine lengths in the tree, "uncut.core" plots densities of cell lengths of those cells that at least partially appear in the increment core, "core" plots densities of the observed (cut or uncut) cell lengths in the increment core

rvec

values of cell lengths used to get estimates of densities.

xlab

If supplied then this will be used as the x label for all plots.

ylab

If supplied then this will be used as the y label for all plots.

main

Used as title for plots if supplied.

col

defines the color used for density plotting.

lwd

defines the line width.

...

other graphics parameters to pass on to plotting commands.

Value

The function generates plots.

Author(s)

Sara Sjöstedt de Luna, Konrad Abramowicz, Natalya Pya Arnqvist

References

Svensson, I., Sjöstedt de Luna, S., Bondesson, L. (2006). Estimation of wood fibre length distributions from censored data through an EM algorithm. Scandinavian Journal of Statistics, 33(3), 503–522.

Chen, Z. Q., Abramowicz, K., Raczkowski, R., Ganea, S., Wu, H. X., Lundqvist, S. O., Mörling, T., Sjöstedt de Luna, S., Gil, M.R.G., Mellerowicz, E. J. (2016). Method for accurate fiber length determination from increment cores for large-scale population analyses in Norway spruce. Holzforschung. Volume 70(9), 829–838.

See Also

fled

Examples

## see ?fled help files

Print a fiber length determination object.

Description

The default print method for a fled object.

Usage

## S3 method for class 'fled'
print(x,digits = max(3, getOption("digits") - 3),...)

Arguments

x, ...

fitted model objects of class fled as produced by fled().

digits

controls the number of digits printed in the output.

Details

Prints the model, type of data, estimated model parameters, optimized value of the minus log likelihood and number of observations supplied.

Author(s)

Sara Sjöstedt de Luna, Konrad Abramowicz, Natalya Pya Arnqvist


Summary for a fled fit

Description

Takes a fled object produced by fled() and produces various useful summaries from it.

Usage

## S3 method for class 'fled'
summary(object,...)

## S3 method for class 'summary.fled'
print(x,digits = max(3, getOption("digits") - 3),...)

Arguments

object

a fitted fled object as produced by fled().

x

a summary.fled object produced by summary.fled().

digits

controls the number of digits printed in the output.

...

other arguments.

Value

summary.fled produces the following list of summary information for a fled object.

fixed

is a logical vector for any model parameters that are fixed

n

number of observations

loglik

minimized minus log likelihood for the model

model

the model used

method

'ML' method used

data.type

type of data used

conv

indicates why the optimization algorithm terminated

p.table

table of model parameters

ss.table

table of summary statistics for cell lengths in the increment core

w.fine

table of summary statistics for fine lengths in the standing tree

w.fiber

table of summary statistics for fiber lengths in the standing tree

mean.w

expected value of the cell lengths in the standing tree

eps.tree

proportion of fines in the standing tree

se.eps.tree

standard error of eps.tree

Author(s)

Sara Sjöstedt de Luna, Konrad Abramowicz, Natalya Pya Arnqvist

References

Svensson, I., Sjöstedt de Luna, S., Bondesson, L. (2006). Estimation of wood fibre length distributions from censored data through an EM algorithm. Scandinavian Journal of Statistics, 33(3), 503–522.

Chen, Z. Q., Abramowicz, K., Raczkowski, R., Ganea, S., Wu, H. X., Lundqvist, S. O., Mörling, T., Sjöstedt de Luna, S., Gil, M.R.G., Mellerowicz, E. J. (2016). Method for accurate fiber length determination from increment cores for large-scale population analyses in Norway spruce. Holzforschung. Volume 70(9), 829–838.

See Also

fled

Examples

## see ?fled help files