[x_central, x_replicate, sigma_central, sigma_replicate, parameters, x_average, sigma_average, x_sample] = replicate_regression_core(t,y,sigma,r,tt,options) Bayesian replicate regression for single time series with multiple replicates DESCRIPTION Interpolation of multiple time series data from nr replicate experiments The regression functions are represented by linear combinations of basis functions (e.g. Fourier components) The expansion coefficients (=model parameters) given prior distributions and estimated by taking the posterior mode FUNCTION ARGUMENTS Each data point is a quadruple [t(i), y(i), sigma(i), r(i)] of - time point t(i) - measured value y(i) - standard deviation (error bar) sigma(i) - replicate label r(i) (values from 1,..,nr) In this script, the function arguments t, y, sigma, r are given as ROW vectors (or as matrices, where each row is treated separately) FUNCTION OUTPUTS Row vectors of regression curves: 'x_central' central regression curves 'x_average' regression curve averaged over replicates 'x_replicate' regression curves for the individual replicates and the corresponding uncertainties (row vectors): 'sigma_central', 'sigma_average', and 'sigma_replicate' 'parameters' is a structure array containing the estimated parameter values (to be used for statistical evaluation of the prior hyperparameters) 'x_fit' contains the replicate regression curves, evaluated at the point of original data points 'x_sample' is a vector of predicted data, obtained from a random sample from the posterior OPTIONS FOR THE ALGORITHM Detailed options are given the function argument 'p', a structure array with (optional) fields: options.basis : type of basis functions options.use_offset : (Boolean) flag for stating that there is a constant basis function options.remove_offset : (Boolean) flag for stating that the constant basis function should be removed options.n_comp : number of Fourier components (not including the constant offset) (sin and cos for the same wavenumber are counted as one component) options.t_jump : add (at the beginning) a component that yields a constant offset options.t_smooth : time constant for estimating production rates options.constant_before_start : set all basis functions to constant values for negative time values options.central_mode_mean : prior mean for Fourier coefficients alpha for central curve (vector; same values are used for for sin and cos) options.central_offset_mean : the same (scalar) for the constant basis function (default 1) options.central_jump_mean : the same (scalar) for the jump basis function (default 1) options.deviation_mode_mean : prior mean for Fourier coefficients beta for deviations from central curve options.deviation_offset_mean: the same, for the constant basis function (default 1) options.deviation_jump_mean : the same, for the jump basis function (default 1) options.central_mode_width : prior width for Fourier coefficients alpha for central curve (vector; same values are used for for sin and cos) options.central_offset_width : the same (scalar) for the constant basis function (default 1) options.central_jump_width : the same (scalar) for the jump basis function (default 1) options.deviation_mode_width : prior width for Fourier coefficients beta for deviations from central curve options.deviation_offset_width: the same, for the constant basis function (default 1) options.deviation_jump_width : the same, for the jump basis function (default 1) options.average_std : how is the uncertainty of the average curve computed? 'std_dev_mean': standard deviation of the mean 'curve_spread': standard deviation of the individual curves options.flag_draw_sample : Draw sample curve parameters and curve from the posterior options.flag_time_derivative : Compute time derivative curves The basis functions are adjusted to the final time interval [ta,tb](from tt) 'cos' : cosine function, zero slope at t=ta and t=tb 'sin' : sine function, zero value at t=ta and t=tb 'sin_half' : sine function, zero value at t=ta 'sin_horizontal' : sine function, zero value at t=ta, zero slope at t=tb 'cos+sin' : cosine and sine functions, no restriction 'polynomial' : polynomial function, zero value at t=ta 'exp' : exponentially relaxing functions (t<0 => f=0; t>0 => f = 1-exp(t/tau); The entire curves are shifted by a constant basis function This can be suppressed by setting options.use_offset = 0 For an example, see the m-file demo_replicate_regression_core Wolfram Liebermeister (2010)