TimeSeriesAnalysis - Maple Programming Help

Home : Support : Online Help : Statistics and Data Analysis : Time Series Analysis Package : TimeSeriesAnalysis/LongestDefinedSubsequence

TimeSeriesAnalysis

 LongestDefinedSubsequence
 obtain a longest non-missing subsequence

 Calling Sequence LongestDefinedSubsequence(TS)

Parameters

 TS - TimeSeries object

Description

 • The LongestDefinedSubsequence command takes a time series and returns a longest contiguous subsequence of data where none of the data sets have missing values. For example, if TS is a TimeSeries object containing the following data:

$\mathrm{Matrix}\left(\left[\left[5.,3.,2.\right],\left[2.,Float\left(\mathrm{undefined}\right),4.\right],\left[Float\left(\mathrm{undefined}\right),5.,1.\right],\left[6.,2.,6.\right],\left[4.,4.,4.\right],\left[1.,3.,2.\right]\right]\right)$

then the 4th through 6th row of data will be returned. The value $Float\left(\mathrm{undefined}\right)$ is used to represent missing data. (Data for time series is converted to floating point data, so any input of type undefined is converted to $Float\left(\mathrm{undefined}\right)$ and subsequently considered missing.)

 • If there are multiple longest subsequences (of equal length), then LongestDefinedSubsequence returns an arbitrary one.

Examples

 > $\mathrm{with}\left(\mathrm{TimeSeriesAnalysis}\right):$

Consider the time series described above.

 > $\mathrm{ts}≔\mathrm{TimeSeries}\left(\mathrm{Matrix}\left(\left[\left[5.,3.,2.\right],\left[2.,Float\left(\mathrm{undefined}\right),4.\right],\left[Float\left(\mathrm{undefined}\right),5.,1.\right],\left[6.,2.,6.\right],\left[4.,4.,4.\right],\left[1.,3.,2.\right]\right]\right),\mathrm{headers}=\left["A","B","C"\right],\mathrm{frequency}=\mathrm{annual}\right)$
 ${\mathrm{ts}}{≔}\left[\begin{array}{c}{\mathrm{Time series}}\\ {\mathrm{A, B, C}}\\ {\mathrm{6 rows of data:}}\\ {\mathrm{2014 - 2019}}\end{array}\right]$ (1)
 > $\mathrm{GetData}\left(\mathrm{ts}\right)$
 $\left[\begin{array}{ccc}{5.}& {3.}& {2.}\\ {2.}& {Float}{}\left({\mathrm{undefined}}\right)& {4.}\\ {Float}{}\left({\mathrm{undefined}}\right)& {5.}& {1.}\\ {6.}& {2.}& {6.}\\ {4.}& {4.}& {4.}\\ {1.}& {3.}& {2.}\end{array}\right]$ (2)
 > $\mathrm{ldts}≔\mathrm{LongestDefinedSubsequence}\left(\mathrm{ts}\right)$
 ${\mathrm{ldts}}{≔}\left[\begin{array}{c}{\mathrm{Time series}}\\ {\mathrm{A, B, C}}\\ {\mathrm{3 rows of data:}}\\ {\mathrm{2017 - 2019}}\end{array}\right]$ (3)
 > $\mathrm{GetData}\left(\mathrm{ldts}\right)$
 $\left[\begin{array}{ccc}{6.}& {2.}& {6.}\\ {4.}& {4.}& {4.}\\ {1.}& {3.}& {2.}\end{array}\right]$ (4)

A second example.

 > $\mathrm{ts2}≔\mathrm{TimeSeries}\left(\left[2.1,\mathrm{undefined},2.5,2.4,\mathrm{undefined},\mathrm{undefined},3.2,2.4\right]\right)$
 ${\mathrm{ts2}}{≔}\left[\begin{array}{c}{\mathrm{Time series}}\\ {\mathrm{data set}}\\ {\mathrm{8 rows of data:}}\\ {\mathrm{2012 - 2019}}\end{array}\right]$ (5)
 > $\mathrm{ldts2}≔\mathrm{LongestDefinedSubsequence}\left(\mathrm{ts2}\right)$
 ${\mathrm{ldts2}}{≔}\left[\begin{array}{c}{\mathrm{Time series}}\\ {\mathrm{data set}}\\ {\mathrm{2 rows of data:}}\\ {\mathrm{2014 - 2015}}\end{array}\right]$ (6)
 > $\mathrm{GetData}\left(\mathrm{ldts2}\right)$
 $\left[\begin{array}{c}{2.50000000000000}\\ {2.40000000000000}\end{array}\right]$ (7)

Compatibility

 • The TimeSeriesAnalysis[LongestDefinedSubsequence] command was introduced in Maple 18.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 18, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.978769838809967, "perplexity": 2023.3481596508734}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-17/segments/1618039568689.89/warc/CC-MAIN-20210423070953-20210423100953-00001.warc.gz"}