Caclulate average residence time for trajecotries by fitting 1-CDF (survival distribution).

fitRT(trackll=NULL,x.max=30,N.min=1.5,t.interval=0.5,maxiter.search=1e3,
maxiter.optim=1e3,k.ns=FALSE)

Arguments

t.interval

time interval for image aquisition. Default 0.5 sec.

maxiter.optim

A positive integer specifying the maximum number of iterations allowed for nls.

trackll

trajectory list generated by createTrackll() and processing. if NULL, user will be prompted to enter the trackll name.

x.max

The maximum range of X axis, i.e. time, for the output plot. Default 30 sec.

N.min

The minimal duration of trajectory length in the unit of s econd, trajectories shorter than N.min will be filtered out. Default 1.5 sec.

k.ns

Logical indicate or numeric used to control fitting.

maxiter.search

A positive integer specifying the maximum number of iterations allowed for nls.

Value

  • On the Console output: Result of both one and two-component fit and parameters of goodness of the fit.

  • Plot: fitting curves will be plotted over the raw data, with the number of tracks and result of two-component fitting shown in the plot area.

Details

Calculating average residence time of particles by fitting 1-CDF (survival distribution) of its trajectorys.

Input track list (trackll) should be processed, merged trackll, the fitting will start right away after running the function. The maximum time range to be plotted can be set using x.max, this will not change the fitting result. The result of two-component fit will be shown on the plot as well as in the console. Fitting result is determined by the input trackll, and N.min (filtering of the trackll).

Examples

# Generate trackll, and process, # e.g. mask region of interest, merge tracks from multiple files. folder=system.file("extdata","HSF",package="sojourner") trackll=createTrackll(folder=folder, input=3)
#> #> Reading ParticleTracker file: HSF-Halo_1.csv ... #> #> alo_1 read and processed. #> #> Reading ParticleTracker file: HSF-Halo_2.csv ... #> #> alo_2 read and processed. #> #> Process complete.
trackll=maskTracks(folder,trackll)
#> Reading mask file HSF-Halo_1_MASK.tif #> Reading mask file HSF-Halo_2_MASK.tif #> #> All files masked.
trackll=mergeTracks(folder,trackll)
#> #> Merging of folder HSF complete.
# Fit the residence time of trackll fitRT(trackll=trackll,x.max=30,N.min=1.5,t.interval=0.5)
#> applying filter, min 3 max Inf
#> #> #> ==> One components fit for HSF #> Nonlinear regression model #> model: P ~ p1(t, k.s) #> data: parent.frame() #> k.s #> 0.3886 #> residual sum-of-squares: 0.1024 #> #> Number of iterations to convergence: 8 #> Achieved convergence tolerance: 3.299e-06 #> #> #> #> ==> Two components fit for HSF #> k.s k.ns alpha #> 1.1870605 0.1782179 0.5048948 #> #> Local optimization... #> #> Nonlinear regression model #> model: P ~ p3(t, k.s, k.ns, alpha) #> data: parent.frame() #> k.s k.ns alpha #> 0.8388 0.1462 0.6515 #> residual sum-of-squares: 0.006711 #> #> Number of iterations to convergence: 12 #> Achieved convergence tolerance: 1.49e-08 #>
#> $`One-Component Fit` #> Nonlinear regression model #> model: P ~ p1(t, k.s) #> data: parent.frame() #> k.s #> 0.3886 #> residual sum-of-squares: 0.1024 #> #> Number of iterations to convergence: 8 #> Achieved convergence tolerance: 3.299e-06 #> #> $`Two-Component Fit` #> Nonlinear regression model #> model: P ~ p3(t, k.s, k.ns, alpha) #> data: parent.frame() #> k.s k.ns alpha #> 0.8388 0.1462 0.6515 #> residual sum-of-squares: 0.006711 #> #> Number of iterations to convergence: 12 #> Achieved convergence tolerance: 1.49e-08 #>