Title: | deltaGseg |
---|---|
Description: | Identifying distinct subpopulations through multiscale time series analysis |
Authors: | Diana Low, Efthymios Motakis |
Maintainer: | Diana Low <[email protected]> |
License: | GPL-2 |
Version: | 1.47.0 |
Built: | 2024-11-29 05:39:42 UTC |
Source: | https://github.com/bioc/deltaGseg |
This function automatically chooses a subset of breakpoints from all the estimated breakpoints of function splitTraj
chooseBreaks(breakpoints, numbreaks)
chooseBreaks(breakpoints, numbreaks)
breakpoints |
Numeric list, output from splitTraj. |
numbreaks |
Integer. Number of breakpoints to be returned per trajectory. Breakpoints chosen will be evenly spaced from those defined by splitTraj. |
None.
Returns a numeric list of breakpoints, one list per trajectory.
Diana H.P. Low, Efthimios Motakis
data(deltaGseg) all_breakpoints<-splitTraj(traj1) #default splits=15 (i.e. 16 segments). all_breakpoints chooseBreaks(all_breakpoints,numbreaks=3)
data(deltaGseg) all_breakpoints<-splitTraj(traj1) #default splits=15 (i.e. 16 segments). all_breakpoints chooseBreaks(all_breakpoints,numbreaks=3)
Choose evenly spaced breakpoints from a list of breakpoints.
signature(breakpoints="list",numbreaks="numeric")
Returns a sublist of breakpoints of length numbreaks
.
Diana H.P. Low, Efthimios Motakis
Wrapper for modified pvclust function.
clusterPV(object,bootstrap=500)
clusterPV(object,bootstrap=500)
object |
An object of class 'SegTrajectories'. |
bootstrap |
Integer. Number of bootstraps to run. |
This is a wrapper to call the pvclust function that has been modified to suit our deltaGseg computation.
Returns an object of class "pvclust". For use in clusterSegments
when running the pvclust option.
Diana H.P. Low, Efthimios Motakis
Shimodaira, H. (2004). Approximately unbiased tests of regions using multistep-multiscale bootstrap resampling, Annals of Statistics 32, 2616-2641.
data(deltaGseg) clusterPV(traj1.denoise)
data(deltaGseg) clusterPV(traj1.denoise)
Returns a pvclust values for object of class "SegTrajectories")
signature(object = "SegSeriesTrajectories")
Returns an object of class "pvclust".
Diana H.P. Low, Efthimios Motakis
None
#data(deltaGseg) #clusterPV(td2)
#data(deltaGseg) #clusterPV(td2)
The function does hierarchical clustering of the segmented (and joined) series by hclust and performs one of the "intervention" methods (see the respective parameter below) to identify subpopulations. The hierarchical clustering is performed by Euclidean distances using "average" linkage method.
clusterSegments(object, intervention = "groups",pv=NULL,graphics=NULL)
clusterSegments(object, intervention = "groups",pv=NULL,graphics=NULL)
object |
An object of class 'SegTrajectories' |
intervention |
intervention: Character. One of "groups","heights" or "pvclust". Option pvclust performs simple hierarchical clustering by hclust and then assesses the uncertainty in the clustering by the bootstrap probability values computed via multi-scale bootstrap resampling. Option "groups" asks the user to input the number of subpopulations we wants to identify (interactive). Option "heights" asks the user to interactively set a threshold T (a horizontal line on the tree plot) that defines the number of subpopulations. |
pv |
Supplied p-values for intervention=pvclust. See |
graphics |
Character vector. Optional parameter defining the colors for plotting (each color indicates a different subpopulation). Must be at least the length of total number of subpopulations defined. |
The algorithm offers several alternatives for subpopulation estimation that, ultimately, they lead to similar solutions. The user should first visualize the segmented data to get a rough idea of the possible subpopulations (plots generated by the algorithm). Option "pvclust" computes the hierarchical clustering tree with the p-values. The subpopulations are defined interactively by the user (point and click based on the R function identify()
; see help(identify)). Alternatively, option "groups" asks the user to input the number of subpopulations or define them interactively in option "height" (point and click at the desired height in the tree). The final plot shows the number of estimated subpopulations.
An object of class SegSeriesTrajectories.
Diana H.P. Low, Efthimios Motakis
Shimodaira, H. (2004) Approximately unbiased tests of regions using multistep-multiscale bootstrap resampling, Annals of Statistics, 32, 2616-2641.
## Not run: ## interactive! data(deltaGseg) traj1.ss<-clusterSegments(traj1.denoise, intervention = "groups") #define clusters by number of groups formed. ## End(Not run)
## Not run: ## interactive! data(deltaGseg) traj1.ss<-clusterSegments(traj1.denoise, intervention = "groups") #define clusters by number of groups formed. ## End(Not run)
Performs the function clusterSegments
on an object of class "SegTrajectories".
signature(object = "SegTrajectories")
Returns an object of class "SegSeriesTrajectories"
Diana H.P. Low, Efthimios Motakis
None
#data(deltaGseg) #st<-clusterSegments(dt)
#data(deltaGseg) #st<-clusterSegments(dt)
deltaGseg
Package: | deltaGseg |
Type: | Package |
Version: | 0.99.0 |
Date: | 2013-02-04 |
License: | GPL-2 |
Diana H.P. Low, Efthimios Motakis
Maintainer: Diana H.P. Low <[email protected]>
Zhou W., Motakis E., Fuentes G., Verma C.S. (2012) Macrostate identification from biomolecular simulations through time series analysis. J Chem Inf Model. 2012 Sep 24;52(9):2319-24. Epub 2012 Sep 5.
Dickey, D.A. and W.A. Fuller (1979), Distribution of the Estimators for Autoregressive Time Series with a Unit Root. Journal of the American Statistical Association, 74, p. 427-431.
Nason, G.P. (2008) Wavelet methods in Statistics with R. Springer, New York.
Auger, I. E.; Lawrence, C. E. Algorithms for the optimal identification of segment neighborhoods. Bull. Math.Biol. 1989, 51(1), 39-54.
Shimodaira, H. (2004) Approximately unbiased tests of regions using multistep-multiscale bootstrap resampling, Annals of Statistics, 32, 2616-2641.
D'Agostino R.B., Pearson E.S. (1973); Tests for Departure from Normality, Biometrika 60, 613-22.
This function computes Augmented Dickey-Fuller test for weak-stationarity and carries out segmentation and wavelets denoising.
denoiseSegments(object,seg_method="BinSeg",maxQ=15,fn=1,factor=0.8,thresh_level=TRUE,minobs=200)
denoiseSegments(object,seg_method="BinSeg",maxQ=15,fn=1,factor=0.8,thresh_level=TRUE,minobs=200)
object |
An object of class "Trajectories" or "TransTrajectories". (the output of functions |
seg_method |
Character. One of "SegNeigh" or "BinSeg". By default it performs the Segment Neighborhood (SegNeigh) method to find multiple changes in mean for data that is assumed to be normally distributed. The value returned is the result of finding the optimal location of up to Q changepoints using the log of the likelihood ratio statistic. Once all changepoint locations have been calculated, the optimal number of changepoints is decided using k*pen as the penalty function where k is the number of changepoints tested (k in (1,Q)). In very large series, the memory demanding "SegNeigh" can be replaced by "BinSeg"" (Binary Segmentation). The segmenation is performed only if the Augmented Dickey-Fuller test P-value is significant at alpha=0.05. If not, an error message appears indicating the need of series splitting or differentiation (see |
maxQ |
Integer. The maximum number of Q changepoints to be estimated. |
fn |
Integer. It specifies the degree of smoothness of the wavelet that you want to use in the decomposition. It takes values from 1 (coarsest/hard smoothing, i.e. Haar's step function) to 10 (finest/soft smoothing). Put simply, the fitted (wavelet denoised/estimated) data of segment q with fn=1 have lower variance than the fitted data of q under fn=10. The former data will resemble a step function over time while the latter will be much closer to the original data. |
factor |
Numeric. Between 0.6 and 1 used for re-scaling the denoising threshold. |
thresh_level |
Logical. If FALSE then a global threshold is computed on and applied to all scale levels. If TRUE a threshold is computed and applied separately to each scale level (for serious residuals autocorrelation). |
minobs |
Integer. The minimum number of observations a segment should consist of to be accepted |
An object of class "SegTrajectories"
Diana H.P. Low, Efthimios Motakis
Dickey, D.A. and W.A. Fuller (1979), Distribution of the Estimators for Autoregressive Time Series with a Unit Root, Journal of the American Statistical Association, 74, p. 427-431.
Nason, G.P. (2008) Wavelet methods in Statistics with R. Springer, New York.
Auger, I. E.; Lawrence, C. E. Algorithms for the optimal identification of segment neighborhoods. Bull. Math.Biol. 1989, 51(1), 39-54.
data(deltaGseg) traj1.denoise<-denoiseSegments(traj1.tr,seg_method="BinSeg",maxQ=15,fn=1,factor=0.8,thresh_level=TRUE,minobs=200)
data(deltaGseg) traj1.denoise<-denoiseSegments(traj1.tr,seg_method="BinSeg",maxQ=15,fn=1,factor=0.8,thresh_level=TRUE,minobs=200)
Performs the function denoiseSegments
on an object of either class "Trajectories" or "TransTrajectories" (classUnion="TrajORTransTraj").
signature(object = "Trajectories")
Returns an object of class "SegTrajectories"
signature(object = "TransTrajectories")
Returns an object of class "SegTrajectories"
Diana H.P. Low, Efthimios Motakis
None
#data(deltaGseg) #dt<-denoiseSegments(tt)
#data(deltaGseg) #dt<-denoiseSegments(tt)
This function generates the diagnostic plots of the wavelet denoising model residuals. The assumptions are that the residuals autocorrelation is not significant and that the residuals distribution is approximately normal or, at least, symmetric around 0. We provide plots and test to verify these assumptions (depends on R package fBasics).
diagnosticPlots(object, norm.test="KS",single.series = FALSE)
diagnosticPlots(object, norm.test="KS",single.series = FALSE)
object |
An object of class "SegSeriesTrajectories". |
norm.test |
Character. One of "KS", "Shapiro", "Agost". Test for residuals normality accepting "KS" (Kolmogorov Smirnov test with Lilliefors correction), "Shapiro"" (Shapiro test for normality) and "Agost"" (D'Agostino test for normality using the skewness and kurtosis of the data ; also gives the skewness and kurtosis p-values for the hypothesis that the respective estimated measures differ from the theoretical values under the normal distribution). |
single.series |
Logical. If FALSE (default) the residuals of each series are independently analyzed. |
The function outputs the standard autocorrelation plots for viewing the residuals autocorrelation, histograms for checking the normality assumptions and the respective P-values to test the normality assumption.
A series of plots with printed P-values for the autocorrelation and normality tests.
Diana H.P. Low, Efthimios Motakis
D'Agostino R.B., Pearson E.S. (1973); Tests for Departure from Normality, Biometrika 60, 613-22.
data(deltaGseg) diagnosticPlots(traj1.ss,norm.test="KS",single.series=TRUE)
data(deltaGseg) diagnosticPlots(traj1.ss,norm.test="KS",single.series=TRUE)
Performs the function diagnosticPlots
on an object of class "SegSeriesTrajectories".
signature(object = "SegSeriesTrajectories")
Returns histogram and acf plots of series
Diana H.P. Low, Efthimios Motakis
None
#data(deltaGseg) #diagnosticPlots(st)
#data(deltaGseg) #diagnosticPlots(st)
Accessor of Trajectories or TransTrajectories object to retrieve adf p-values.
getAVD(object)
getAVD(object)
object |
An object of class 'Trajectories' or 'TransTrajectories'. |
Returns a vector (of pvalues) for each trajectory defined in the object.
None.
Diana H.P. Low, Efthimios Motakis
data(deltaGseg) getAVD(traj1)
data(deltaGseg) getAVD(traj1)
getAVD
Returns numeric vector from the slot @avd in an object of class "Trajectories", or @tavd in an object of class "TransTrajectories."
signature(object = "Trajectories")
Numeric vector of length equal to series length.
signature(object = "TransTrajectories")
Numeric vector of length equal to series length.
getAVD
,parseTraj
,transformSeries
Accessor of TransTrajectories object to retrieve computed breakpoints.
getBreaks(object)
getBreaks(object)
object |
An object of class 'TransTrajectories'. |
None.
Returns a list (of numerical breakpoint values) for each trajectory defined in an object of class 'Trajectories'.
Diana H.P. Low, Efthimios Motakis
None
data(deltaGseg) getBreaks(traj1.tr)
data(deltaGseg) getBreaks(traj1.tr)
Returns a list from the @breakpoints slot for object of class "TransTrajectories")
signature(object = "SegSeriesTrajectories")
List of breakpoints per series after transformation of series data using transformSeries
Diana H.P. Low, Efthimios Motakis
None
#data(deltaGseg) #getBreaks(traj1.tr)
#data(deltaGseg) #getBreaks(traj1.tr)
Helper function to retrieve subpopulations and computes the intervals for each subpopulation after segmentation and clustering.
getIntervals(object)
getIntervals(object)
object |
An object of class 'SegSeriesTrajectories'. |
None.
Returns a list of subpopulations and the intervals.
Diana H.P. Low, Efthimios Motakis
None
data(deltaGseg) getIntervals(traj1.ss)
data(deltaGseg) getIntervals(traj1.ss)
Returns a list of subpopulations and the intervals of the segmented series.)
signature(object = "SegSeriesTrajectories")
Returns a list of subpopulations and the intervals of the segmented series from segmentationWithinSeries
Diana H.P. Low, Efthimios Motakis
None
#data(deltaGseg) #getIntervals(traj1.ss)
#data(deltaGseg) #getIntervals(traj1.ss)
Accessor of SegTrajectories or SegSeriesTrajectories object to retrieve segment matrix.
getSegments(object)
getSegments(object)
object |
Object of class "SegTrajectories"" or "SegSeriesTrajectories" |
A matrix with segment information including quantiles.
None.
Diana H.P. Low, Efthimios Motakis
None.
denoiseSegments
, clusterSegments
data(deltaGseg) segments<-getSegments(traj1.denoise)
data(deltaGseg) segments<-getSegments(traj1.denoise)
Returns a matrix from the @smatrix slot (for object of class "SegTrajectories") or @ssmatrix slot (for object of class "SegSeriesTrajectories")
signature(object = "SegSeriesTrajectories")
Matrix is a result of the function clusterSegments
signature(object = "SegTrajectories")
Matrix is a result of the function denoiseSegments
Diana H.P. Low, Efthimios Motakis
None
#data(deltaGseg) #getSegments(traj1.denoise)
#data(deltaGseg) #getSegments(traj1.denoise)
Accessor of Trajectories and TransTrajectories object to retrieve filename(s) used in trajectory computation.
getTNames(object)
getTNames(object)
object |
An object of class 'Trajectories' or 'TransTrajectories'. |
None.
Returns character vector of filenames.
Diana H.P. Low, Efthimios Motakis
None.
data(deltaGseg) getTNames(traj1)
data(deltaGseg) getTNames(traj1)
Returns a vector from the @filenames or @tfilenames slot.
Returns a vector of filename(s) values.
signature(object = "Trajectories")
Returns the original filenames of series read by parseTraj.
signature(object = "TransTrajectories")
Returns filenames generated by the transformSeries function if the originial series has been split into subseries. Subseries names are denoted by an underscore after the original names, eg. FILE1_1, FILE1_2.
Diana H.P. Low, Efthimios Motakis
None
#data(deltaGseg) #getTNames(traj1)
#data(deltaGseg) #getTNames(traj1)
Accessor of Trajectories or TransTrajectories object to retrieve trajectories.
getTraj(object)
getTraj(object)
object |
An object of class "Trajectories" or "TransTrajectories" |
None.
List of length equal to number of trajectories, each containing matrix with 2 columns. 1: time points, 2: free energy values.
Diana H.P. Low, Efthimios Motakis
None.
data(deltaGseg) alltrajectories<-getTraj(traj1)
data(deltaGseg) alltrajectories<-getTraj(traj1)
Returns a list of matrices from the @trajlist slot (for object of class "Trajectories") or @ttrajlist slot (for object of class "TransTrajectories")
signature(object = "Trajectories")
Returns the original trajectories used for computation.
signature(object = "TransTrajectories")
Returns the transformed trajectories generated by the function transformSeries
Diana H.P. Low, Efthimios Motakis
Reads in files with 2-column, space-separated numerical values containing 1:time points, 2:trajectory(free binding energies).
parseTraj(path = getwd(), files = NULL,fromfile=TRUE)
parseTraj(path = getwd(), files = NULL,fromfile=TRUE)
path |
Directory containing trajectory files. |
files |
Character vector of filenames to read. If not provided, will read all files in given directory and treat them as a set. Can also be used to read in variables if given as list. |
fromfile |
Logical. If set to FALSE, the files parameter will be used to read in variables. |
This is an initialization function for the deltaGseg package. It reads the trajectory files (input) and reports the a short description of the file, the Augmented Dickey-Fuller test p-values for each trajectory in the set and the data plot. The input files should be in tab delimited form with 2 columns: the first column contains the time points 1, 2, ..., T and the second the free binding energies at each time point.
A 'Trajectories' object.
Diana H.P. Low, Efthimios Motakis
None.
traj1<-parseTraj(path=system.file("extdata",package="deltaGseg"),files=c("D_GBTOT1","D_GBTOT2","D_GBTOT3")) traj1 #prints summary of traj1 object # using parseTraj for existing variables ## subtraj<-getTraj(traj1)[[1]] #extracts first trajectory in the above series traj2<-parseTraj(files=list(subtraj),fromfile=FALSE) traj2
traj1<-parseTraj(path=system.file("extdata",package="deltaGseg"),files=c("D_GBTOT1","D_GBTOT2","D_GBTOT3")) traj1 #prints summary of traj1 object # using parseTraj for existing variables ## subtraj<-getTraj(traj1)[[1]] #extracts first trajectory in the above series traj2<-parseTraj(files=list(subtraj),fromfile=FALSE) traj2
Plot "Trajectories" objects and customizes output.
signature(x = "Trajectories")
plot(object,name='all',breakpoints=NULL)
name
: Character. Name of sub-series, or if all
, plots the whole series.breakpoints
: List. Supply breakpoints generated by splitTraj
.
signature(x = "TransTrajectories")
plot(object,labelling=TRUE)
labelling
: Logical. Writes labels. May be turned off to prevent overcrowding of plot.
signature(x = "SegTrajectories")
plot(object)
signature(x = "SegSeriesTrajectories")
plot(object)
Plots (sub)series before and after transformation.
plotDiff(object,name=NULL)
plotDiff(object,name=NULL)
object |
An object of class 'TransTrajectories'. |
name |
Character. Name of (sub)series. |
None.
Diana H.P. Low, Efthimios Motakis
None
data(deltaGseg) plotDiff(simtraj.tr2,name="1_2")
data(deltaGseg) plotDiff(simtraj.tr2,name="1_2")
Plots differentiated (sub)series in object of class "TransTrajectories")
signature(object = "TransTrajectories")
Plots (sub)series before and after transformation.
Diana H.P. Low, Efthimios Motakis
None
#data(deltaGseg) #plotDiff(traj1.tr,'D_GBTOT3_1')
#data(deltaGseg) #plotDiff(traj1.tr,'D_GBTOT3_1')
pvals is the bootstrapped pvalues obtained via pvclust
for clusterSegments
data(deltaGseg)
data(deltaGseg)
class pvclust
internal
"SegSeriesTrajectories"
Objects of this class is a product of the clusterSegments
function.
Objects can be created by calls of the form new("SegSeriesTrajectories", ...)
.
ssmatrix
:Object of class "data.frame"
The output is a data.frame with the following information (in columns): the observed data ("observed"), the estimated, wavelet denoised data ("estimated"), the residuals of the estimation ("residuals"), the estimated subpopulations IDs ("subpopulations"), the series IDs/filenames ("seriesID")
ssparams
:Object of class "character"
Parameters used to run the clustering algorithm, clusterSegments
.
sparams
:Object of class "character"
Parameters used to run the segmentation algorithm, denoiseSegments
.
smatrix
:Object of class "matrix"
A matrix containing the preliminary results from segmentation/denoising for each (sub)series generated by transformSeries
. Each list element contains the following information in matrix form (in columns): the observed data (1st column), the estimated, wavelet denoised data (2nd column), the residuals of the estimation (3rd column), the starting/ending time points of each segment (4th/5th columns), the estimated segment IDs (6th column), the quantiles of the estimated data [minimum, 5%, 10%, 15%, ..., 95%, maximum] (from columns 7th to 27th) and the series IDs (28th column)
path
:Object of class "character"
Inherited from Trajectories-class
filenames
:Object of class "character"
Inherited from Trajectories-class
trajlist
:Object of class "list"
Trajectories. Inherited from Trajectories-class
avd
:Object of class "numeric"
adf p-values. Inherited from Trajectories-class
tmethod
:Object of class "character"
Transformation method. Inherited from TransTrajectories-class
breakpoints
:Object of class "list"
breakpoints, if used.
tavd
:Object of class "numeric"
adf p-values after transformation, if used. Inherited from TransTrajectories-class
ttrajlist
:Object of class "list"
Transformed trajectories. Inherited from TransTrajectories-class
tfilenames
:Object of class "character"
Transformed trajectories names. Inherited from TransTrajectories-class
ct
:Object of class "numeric"
Grouping information.
Class "SegTrajectories"
, directly.
Class "TransTrajectories"
, directly.
Class "Trajectories"
, directly.
In the code snippets below, x is a SegSeriesTrajectories object.
getTNames(x)
: Retrieves filenames from slot filenames
or tfilenames
depending on whether the series has been transformed.
getTraj(x)
: Retrieves trajectories list from slot trajlist
or ttrajlist
depending on whether the series has been transformed.
getBreaks(x)
: Retrives breakpoints (if any) from slot breakpoints
getAVD(x)
: Retrieves adf p-values from slot avd
or tavd
depending on whether the series has been transformed.
getSegments(x)
: Retrieves clustered segmentation data from slot smatrix
produced by clusterSegments
In the code snippets below, x is a SegSeriesTrajectories object.
diagnosticPlots(x)
: Generates the diagnostic plots of the wavelet denoising model residuals
getIntervals(x)
: Helper function to retrieve subpopulations and computes the intervals for each subpopulation after segmentation and clustering.
plot(x)
: Plots the final clustered segmentation data after clusterSegments
show(x)
: Displays summary of object, including inherited classes. This helps in recalling the analysis path taken to produce the current results.
Diana H.P. Low, Efthimios Motakis
SegTrajectories
, clusterSegments
showClass("SegSeriesTrajectories")
showClass("SegSeriesTrajectories")
"SegTrajectories"
Objects of this class is a product of the denoiseSegments
function.
Objects can be created by calls of the form new("SegTrajectories", ...)
.
sparams
:Object of class "character"
Parameters used to run the segmentation algorithm.
smatrix
:Object of class "matrix"
A matrix containing the preliminary results from segmentation/denoising for each (sub)series generated by transformSeries
. Each list element contains the following information in matrix form (in columns): the observed data (1st column), the estimated, wavelet denoised data (2nd column), the residuals of the estimation (3rd column), the starting/ending time points of each segment (4th/5th columns), the estimated segment IDs (6th column), the quantiles of the estimated data [minimum, 5%, 10%, 15%, ..., 95%, maximum] (from columns 7th to 27th) and the series IDs (28th column)
path
:Object of class "character"
Inherited from Trajectories-class
filenames
:Object of class "character"
Inherited from Trajectories-class
trajlist
:Object of class "list"
Trajectories. Inherited from Trajectories-class
avd
:Object of class "numeric"
adf p-values. Inherited from Trajectories-class
tmethod
:Object of class "character"
Transformation method. Inherited from TransTrajectories-class
breakpoints
:Object of class "list"
breakpoints, if used.
tavd
:Object of class "numeric"
adf p-values after transformation, if used. Inherited from TransTrajectories-class
ttrajlist
:Object of class "list"
Transformed trajectories. Inherited from TransTrajectories-class
tfilenames
:Object of class "character"
Transformed trajectories names. Inherited from TransTrajectories-class
Class "TransTrajectories"
, directly.
Class "Trajectories"
, directly.
In the code snippets below, x is a SegTrajectories object.
getTNames(x)
: Retrieves filenames from slot filenames
or tfilenames
depending on whether the series has been transformed.
getTraj(x)
: Retrieves trajectories list from slot trajlist
or ttrajlist
depending on whether the series has been transformed.
getBreaks(x)
: Retrives breakpoints (if any) from slot breakpoints
getAVD(x)
: Retrieves adf p-values from slot avd
or tavd
depending on whether the series has been transformed.
getSegments(x)
: Retrieves initial segmentation data from slot smatrix
produced by denoiseSegments
In the code snippets below, x is a SegTrajectories object.
clusterPV(x,bootstrap=500)
: Computes p-values to be used with method="pvclust"
in clusterSegments(x)
clusterSegments(x)
: clustering of segmented trajectories into similar groups.
plot(x)
: Plots the initial segmentation data after denoising by denoiseSegments
show(x)
: Displays summary of object, including inherited classes. This helps in recalling the analysis path taken to produce the current results.
Diana H.P. Low, Efthimios Motakis
showClass("SegTrajectories")
showClass("SegTrajectories")
show
~~~~ Methods for function show
~~
signature(object = "SegSeriesTrajectories")
signature(object = "SegTrajectories")
signature(object = "Trajectories")
signature(object = "TransTrajectories")
simulated trajectory for appendix example
data(deltaGseg)
data(deltaGseg)
class Trajectories
internal
simulated trajectory for appendix example
data(deltaGseg)
data(deltaGseg)
class Trajectories
internal
simulated trajectory for appendix example
data(deltaGseg)
data(deltaGseg)
class Trajectories
internal
splitTraj determines the breakpoints to split a given trajectory into a user specified number of segments. This analysis is performed for very long series (more than 20,000 time points) in order to avoid any memory allocation problems in R. Alternatively, it can be used for manual splitting of the series (see transformSeries
with method="override_splitting")
splitTraj(object, segsplits = rep(5,length(object@filenames)))
splitTraj(object, segsplits = rep(5,length(object@filenames)))
object |
An object of class "Trajectories". |
segsplits |
Numeric vector. The number of breakpoints. The length of segsplits must equal the number of trajectory series in the Trajectories object. Each value specifies the number of splits we want to impose in our long series in order to make it shorter. |
The output of the function is the estimated points that split the series into smaller sub-series. Typically, the plotted series and the estimated splits are further inspected using plots.
A numeric list of length equal to number of trajectory series, containing the breakpoints for each series.
Diana H.P. Low, Efthimios Motakis
None
data(deltaGseg) splitTraj(traj1)
data(deltaGseg) splitTraj(traj1)
Performs the function splitTraj
signature(object = "Trajectories")
Returns a list of breakpoints identified in the trajectory series.
Diana H.P. Low, Efthimios Motakis
None
#data(deltaGseg) #all_breakpoints<-splitTraj(traj1)
#data(deltaGseg) #all_breakpoints<-splitTraj(traj1)
traj1 is a sample trajectory series from the data files provided in the deltaGseg package
data(deltaGseg)
data(deltaGseg)
class Trajectories
internal
traj1.tr is the denoised trajectory after using denoiseSegments
data(deltaGseg)
data(deltaGseg)
class SegTrajectories
internal
traj1.ss is the clustered series after using clusterSegments
data(deltaGseg)
data(deltaGseg)
class SegSeriesTrajectories
internal
traj1.tr is the transformed trajectory after using transformSeries
data(deltaGseg)
data(deltaGseg)
class TransTrajectories
internal
"Trajectories"
Objects of this class is a product of the initialization function, parseTraj
.
Objects can be created by calls of the form new("Trajectories", ...)
.
path
:Object of class "character"
Directory where files were read from.
filenames
:Object of class "character"
Name of files read.
trajlist
:Object of class "list"
Trajectories.
avd
:Object of class "numeric"
adf p-values.
In the code snippets below, x is a Trajectories object.
getTNames(x)
: Retrieves filenames from slot filenames
.
getTraj(x)
: Retrieves trajectories list from slot trajlist
.
getBreaks(x)
: Retrives breakpoints (if any) from slot breakpoints
getAVD(x)
: Retrieves adf p-values from slot avd
.
In the code snippets below, x is a Trajectories object.
splitTraj(x)
: Computes likely breakpoints for the series.
transformSeries(x)
: Apply transformation functions for the series if series is not stationary, or to split long series after determining breakpoints with splitTraj
.
plot(x,name='all')
: Plots the trajectory series either individually, or combined.
show(x)
: Displays summary of object, including inherited classes. This helps in recalling the analysis path taken to produce the current results.
Diana H.P. Low, Efthimios Motakis
showClass("Trajectories")
showClass("Trajectories")
It transforms non-stationary series into weakly stationary (sub)series with three alternative methods (see parameter "methods").
transformSeries(object, method = "splitting", breakpoints = 1)
transformSeries(object, method = "splitting", breakpoints = 1)
object |
An object of class "Trajectories". |
method |
Character. One of "differentiation","override_splitting","splitting". See details. |
breakpoints |
Integer (for method="splitting") or numeric vector (for method="override_splitting"). See details. |
(i) method="differentiation": first differences B[t]-B[t-1] are calculated and the first differentiated series is used for further analysis (segmentation and clustering). This option is needed in special cases, only when the series exhibits a trend-like behavior that cannot be removed by splitting. The first differentiations with remove the trend completely (see Appendix in the manual).
(ii) method="splitting": the series are split by automatic data segmentation to subseries. This option divides a non-stationary series to a number of subseries that are weakly stationary;
(iii) method="override_splitting": the series are split into subseries by user-defined cut-offs obtained from the numerical output of the splitTraj function. This option is for long stationary series that cannot be analyzed due to memory limitations. It can be also used for manual splitting when "splitting" option is not satisfactory. Typically, "splitting"" and "override_splitting" generate new data files of subseries.
Determining breakpoints for method (i) "splitting": an integer specifying the number of split points. This number (a single value applied to all series) denotes the number of subseries that the original series should be divided into. (ii) "override_splitting": the parameter takes the exact values (time points coordinates) of split points (a list of length equal to the number of series; see manual). One can derive and manually insert these split points after inspecting the output of the splitTraj function (see manual). The user should select a few splits so that the original series is not divided into too many subseries (difficult to process because many new files are generated). Alternatively, function chooseBreaks automatically chooses a subset of breakpoints (not recommended to keep those without inspection)
An object of class "TransTrajectories".
Diana H.P. Low, Efthimios Motakis
Dickey, D.A. and W.A. Fuller (1979). Distribution of the Estimators for Autoregressive Time Series with a Unit Root. Journal of the American Statistical Association 74, 427-431.
parseTraj
,splitTraj
,chooseBreaks
data(deltaGseg) trans_series<-transformSeries(traj1,method='splitting',breakpoints=1)
data(deltaGseg) trans_series<-transformSeries(traj1,method='splitting',breakpoints=1)
Returns a matrix from the @smatrix slot (for object of class "SegTrajectories") or @ssmatrix slot (for object of class "SegSeriesTrajectories")
signature(object = "Trajectories")
Returns an object of class "TransTrajectories"
Diana H.P. Low, Efthimios Motakis
None
#data(deltaGseg) #breakpoints<-chooseBreaks(all_breakpoints,3) #tt<-transformSeries(traj1,breakpoints=breakpoints)
#data(deltaGseg) #breakpoints<-chooseBreaks(all_breakpoints,3) #tt<-transformSeries(traj1,breakpoints=breakpoints)
"TransTrajectories"
Object of this class is a product of the transformSeries
function.
Objects can be created by calls of the form new("TransTrajectories", ...)
.
tmethod
:Object of class "character"
Transformation method.
breakpoints
:Object of class "list"
breakpoints, if used.
tavd
:Object of class "numeric"
adf p-values after transformation.
ttrajlist
:Object of class "list"
Transformed trajectories.
difftraj
:Object of class "list"
Differentiated trajectories. These trajectories may be produced if transformSeries
was used with method="differentiation"
. The original trajectory will be kept in ttrajlist
its differentiated version (used only for computation, not presentation) will be stored in this slot. The plotting function plotDiff
enables the user to compare the original and differentated versions of the subseries.
tfilenames
:Object of class "character"
Transformed trajectories names.
path
:Object of class "character"
Inherited from Trajectories-class
filenames
:Object of class "character"
Inherited from Trajectories-class
trajlist
:Object of class "list"
Trajectories. Inherited from Trajectories-class
avd
:Object of class "numeric"
adf p-values. Inherited from Trajectories-class
Class "Trajectories"
, directly.
In the code snippets below, x is a TransTrajectories object.
getTNames(x)
: Retrieves filenames from slot tfilenames
.
getTraj(x)
: Retrieves trajectories list from slot ttrajlist
.
getBreaks(x)
: Retrives breakpoints (if any) from slot breakpoints
getAVD(x)
: Retrieves adf p-values from slot tavd
.
In the code snippets below, x is a TransTrajectories object.
denoiseSegments(x)
: denoising and initial segmentation of trajectory series.
plotDiff(x,name='diff_object_name')
: Plots the original and differentiated subseries (one at a time) if method="differentiation"
was used in transformSeries
plot(x)
: Plots the transformed series after transformSeries
show(x)
: Displays summary of object, including inherited classes. This helps in recalling the analysis path taken to produce the current results.
Diana H.P. Low, Efthimios Motakis
showClass("TransTrajectories")
showClass("TransTrajectories")