bootstrapTrack {celltrackR} | R Documentation |
Simulate Tracks via Bootstrapping of Speed and Turning Angle from a Real Track Dataset
Description
Returns a simulated dataset by sampling from the speed and turning angle distributions from an original track dataset (only in 2 or 3 dimensions)
Usage
bootstrapTrack(nsteps, trackdata)
Arguments
nsteps |
desired number of steps (e.g. 10 steps generates a track with 11 positions). |
trackdata |
a tracks object to extract speeds and turning angles from. |
Details
The number of dimensions is kept the same as in the original data (if data is 3D but
simulated tracks should be 2D, consider calling projectDimensions
on the input
data before supplying it to bootstrapTrack
). The time interval between "measurements"
of the simulated track equals that in the real data and is found via timeStep
.
The first step starts at the origin in a random direction, with a speed sampled from the
speed distribution to determine its displacement. All subsequent steps also have their
turning angles sampled from the turning angle distribution in the data.
Value
A data frame containing in cell track with nsteps
steps in
the same number of dimensions as the original data is returned.
## Generate bootstrapped tracks of the TCell data; compare its speed distribution to the ## original data (should be the same). T.bootstrap <- bootstrapTrack( 100, TCells ) step.speeds.real <- sapply( subtracks(TCells,1), speed ) step.speeds.bootstrap <- sapply( subtracks( T.bootstrap, 1), speed ) qqplot( step.speeds.real, step.speeds.bootstrap )