opttcm {heR.IndoorAir}R Documentation

Optimize a two-compartment model

Description

Function to optimize a two-compartment model's fit to observed time series data using the tcm function

Usage

opttcm(t, e, d, f, par, sel=NULL, plot=TRUE, opt=TRUE,
       method=c("GRID","NLM","Nelder-Mead","BFGS","CG","L-BFGS-B","SANN"),
       incr=NULL, upper=NULL, lower=NULL, control=list(), ...)

Arguments

t a vector containing the times where observations were made
e vector containing source indicators
d matrix of observed time series data, with concentrations down each row and time along columns
f model function, here tcm-
par vector containing the initial parameter values
sel a two-element vector with beginning and ending times specifying times to include in the fitting procedure
plot logical, whether to plot the results for each iteration
opt logical, whether to perform the optimization or simply print out the fit based on the input data
method the method used for optimization, see below
incr vector containing the parameter increments for GRID method
upper vector containing the largest possible parameter values for GRID method
lower vector containing the smallest possible parameter values for GRID method
control control parameters for various optimization methods, see below
... additional graphical parameters

Details

This function can make use of a number of optimization algorithms using the built-in opt or nlm R functions, or the local grid search method function optgrid. Please see the documentation for these functions for more information.

Note: For this function, the tcm model is executed with NA's removed in t and e combinations before removing model and data record combinations where d has NA's and before selecting the time range. Otherwise information in e can be lost.

Things to do: write a general version of this function to optimize any function, i.e., optfit.

Value

A list containing the final residuals, the number of points in the observed time series, the final fitted function values, and the final parameter values.

Author(s)

Neil E. Klepeis
nklepeis@uclink.berkeley.edu
http://socrates.berkeley.edu/~nklepeis

See Also

tcm, optgrid, optim, nlm


[Package heR.IndoorAir version 0.0.3 Index]