\name{bandwidthCV} \alias{bandwidthCV} \title{Bandwidth cross-validation} \usage{ bandwidthCV(well, fileParser = readYeastGrower, getWellIds = getWellIdsTecan, bandwidths = seq(0.5 * 3600, 10 * 3600, length.out = 30), nFold = 10, nWell = 100, cutoff = 0.95, calibration = identity, scaleY = log2) } \arguments{ \item{well}{well dataframe. See \code{\link{wellDataFrame}}.} \item{fileParser}{Converts the file generated by the machine to proper R format. See \code{\link{readYeastGrower}} for details.} \item{getWellIds}{function or vector. If function its parameter is the return value of fileParser. It should return a vector containing the well ids (e.g. A01, A02, ...). You can set the well ids vector directly. See \code{\link{getWellIdsTecan}}.} \item{bandwidths}{vector of bandwidths to test on} \item{nFold}{\code{integer}. In how many parts is the sample divided for cross-validation?} \item{nWell}{\code{integer}. How many wells out of the well dataframe will be used for cross validation?} \item{cutoff}{\code{scalar} between 0 and 1. See details.} \item{calibration}{\code{function} or \code{list} of \code{functions}. If function, calibration is applied to all raw data. If list, the well dataframe must contain a column \code{machine}. Depending on that column the according function in the list is applied to the raw data. See details} \item{scaleY}{\code{function} applied to the calibrated data.} } \value{ list with entries \item{bandwidth}{"optimal" bandwidth} \item{well}{well dataframe} \item{bandwidths}{tested bandwidths} \item{err2}{squared error} \item{err2std}{Standard deviation of squared error} \item{muStd}{Standard deviation of max growth rate} \item{oneStdOfMini}{bandwidths within one std of best} } \description{ Perform cross-validation to detect optimal bandwidth } \details{ This function needs a few minutes time. The "optimal" bandwidth is the largest bandwidth which is in 95\% (cutoff parameter) of all cases within one standard deviation of the best bandwidth. This should make the derivative of the fitted curve more robust. The raw values from the machine might not be directly optical densities (OD), which is needed to infer doubling time. Calibration functions for each machine can be provided to map raw values into OD using the \code{calibration} parameter. } \examples{ folder <- system.file("extdata", package="cellGrowth") well <- wellDataFrame(file.path(folder, "plateLayout.txt"), file.path(folder,"machineRun.txt")) ## for a fast example, we use nWell = 1 here. Use a large number (default 100) for real life applications bw <- bandwidthCV(well, nWell=1) } \author{ Julien Gagneur and Andreas Neudecker }