Last updated: 2025-10-14
Checks: 2 0
Knit directory: CPLASS/
This reproducible R Markdown analysis was created with workflowr (version 1.7.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 5f97658. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish
or
wflow_git_commit
). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .DS_Store
Ignored: data/.DS_Store
Untracked files:
Untracked: analysis/example_on_running-CPLASS.Rmd
Untracked: analysis/visualization_tools.Rmd
Untracked: code/CPLASS.R
Untracked: code/Fill_missing_data.R
Untracked: code/PENALTY.R
Untracked: code/csa_functions.R
Untracked: code/msd_functions.R
Untracked: code/plot_functions.R
Untracked: data/20PFS_and_PFL/
Untracked: data/sim13CKP/
Untracked: style.css
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown (analysis/functions.Rmd
) and HTML
(docs/functions.html
) files. If you’ve configured a remote
Git repository (see ?wflow_git_remote
), click on the
hyperlinks in the table below to view the files as they were in that
past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 5f97658 | Ldo3 | 2025-10-14 | Add custom CSS |
html | 5f97658 | Ldo3 | 2025-10-14 | Add custom CSS |
html | ef81878 | Ldo3 | 2025-10-14 | Build site. |
Rmd | 4a45b93 | Ldo3 | 2025-10-14 | wflow_publish(c("analysis/.")) |
Description
This function runs the Continuous Piecewise Linear Approximation with Stochastic Search (CPLASS) algorithm on a 2D data in the form of \((x_i,y_i)_{i=1}^n\) observed at time \((t_i)_{i=1}^n\) believed to follow a continuous piecewise linear regression model (Gaussian noise). It is used for detecting changes in velocity problem. CPLASS returns the time changes, the estimated parameters.
Usage
CPLASS(t,x, y,time_rate, lambda_r=1/30, iter_max = 5000, burn_in=500, s_cap=1, gamma=1.2, speed_pen=TRUE)
Arguments
Argument | Description |
---|---|
x | A vector containing the data sequence (Cargo locations in x-axis) |
y | A vector containing the data sequence (Cargo locations in y-axis) |
t | A vector containing time |
time_rate | Time step, e.g., 0.001, 0.01, 0.04, 0.05, 0.1, 1 |
lambda_r | the rate used in the proposal of a new vector of changepoints |
iter_max | The maximum number of iterations for running Metropolis-Hastings searching algorithm |
burn_in | The number of burn-in steps in MH search algorithm |
s_cap | The threshold for the output speed. If the inferred speed exceed
s_cap and the speed_pen is activated, then the
extra speed penalty will be introduced |
gamma | The power in the strengthened Schwarz Information Criterion (sSIC) |
speed_pen | If TRUE , adding the speed penalty to the penalty
function; if FALSE , we only use the linear penalty term
sSIC |
Output
A list of segment_inferred
and
path_inferred
will be returned after running the
algorithm.
segment_inferred
is a tibble containing 8
columnsColumns | Description |
---|---|
cp_times | The inferred change times |
durations | The inferred segment durations |
states | A binary vector labeling the state of the associated segments,
0 for stationary, 1 for motile. The labels are
created using the cut-off method with a threshold of 100nm/s |
speeds | The inferred segment speeeds |
vx | The inferred velocity with respect to x-axis |
vy | The inferred velocity with respect to y-axis |
path_inferred
is a tibble containing 6 columnsColumns | Description |
---|---|
t | The input time |
j | The label of time points corresponding to the labels of segments after using the cut-off method |
x | The observed data with respect to x-axis |
y | The observed data with respect to y-axis |
a | The inferred piecewise linear lines (anchor locations w.r.t x-axis) |
b | The inferred piecewise linear lines (anchor locations w.r.t y-axis) |
For running CPLASS on a collection of paths, we introduced the
function CPLASS_paths
.
Usage
CPLASS_paths(data, time_rate, PARALLEL = FALSE, lambda_r=1/30, iter_max = 5000, burn_in=500, s_cap=1, gamma=1.2, speed_pen=TRUE)
Arguments
Argument | Description |
---|---|
data | A list of paths where for each path we can specify \(t,x,y\) |
time_rate | Time step, e.g., 0.001, 0.01, 0.04, 0.05, 0.1, 1 |
PARALLEL | If TRUE , running parallel computing; if
FALSE , running sequentially |
lambda_r | the rate used in the proposal of a new vector of changepoints |
iter_max | The maximum number of iterations for running Metropolis-Hastings searching algorithm |
burn_in | The number of burn-in steps in MH search algorithm |
s_cap | The threshold for the output speed. If the inferred speed exceed
s_cap and the speed_pen is activated, then the
extra speed penalty will be introduced |
gamma | The power in the strengthened Schwarz Information Criterion (sSIC) |
speed_pen | If TRUE , adding the speed penalty to the penalty
function; if FALSE , we only use the linear penalty term
sSIC |
Output
A list of paths, in each path, there is a similar output with two
sublists segments_inferred
and path_inferred
as described in the CPLASS
function.