fitCDF-methods: fitCDF

Description Usage Arguments Details Value Examples

Description

Caclulate apparent diffusion coefficient (Dcoef) for trajecotries by fitting displacementCDF.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
fitCDF((cdf, components=c("one","two","three"),
        start=list(
            oneCompFit=list(D=c(1e-3,2)),
            twoCompFit=list(D1=c(1e-3,2),D2=c(1e-3,2),alpha=c(1e-3,1)),
            threeCompFit=list(D1=c(1e-3,2),D2=c(1e-3,2),D3=c(1e-3,2),
                              alpha=c(1e-3,1),beta=c(1e-3,1))),
        t.interval=0.01,
        maxiter.search=1e3,
        maxiter.optim=1e3,
        output=F,
        seed=NULL)

Arguments

start

the start value for fitting.

t.interval

time interval for image aquisition. Default 0.01 sec.

maxiter.optim

maximum iteration in local optimization process. Default ot 1000.

cdf

cdf calculated from displacementCDF().

components

parameter specifying the number of components to fit.Currently support one to three components fit.

maxiter.search

maximum iteration in random search start value process. defual to 1000.

output

Logical indicaring if output file should be generated.

seed

Seed for random number generator. This makes each run easily repeatable. Seed will be automatically assigned if no seed is specified (default). The seed information is stored as an attribute of the returned object. The seed can also be output to a txt file when output=T.

Details

calculating Dceof by fitting displacementCDF.

Reducing the range can greatly increase the precision of the searching; alternatively, if the range are unavailable, increase the maxiter.search so more points will be searched through with the cost of computation time. maxiter.optim barely need to change, if it does not converge with default setting maxiter=1e3, most likely the problem is in the initial values.

Value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# compare folders
folder1=system.file("extdata","SWR1",package="smt")
folder2=system.file("extdata","HTZ1",package="smt")
trackll=compareFolder(c(folder1,folder2))
cdf=displacementCDF(trackll,dt=1,plot=F,output=F)

# specify ranges of parameter value of interest
fitCDF(cdf,components="two",
      start=list(
                twoCompFit=list(D1=c(1e-3,2),D2=c(1e-3,2),alpha=c(1e-3,1)))
                )

# repeat a fit
a=fitCDF(cdf,components="two",output=F)
b=fitCDF(cdf,components="two",output=F,seed=attr(a,"seed"))

# if result are identical
x=summary(a[[1]])
y=summary(b[[1]])
# formula records environment, exclude from the comparison
mapply(identical,x[names(x)!="formula"],y[names(y)!="formula"])

sheng-liu/smt documentation built on May 29, 2019, 9:22 p.m.