mainScreen: launches the main screen
Description
This function launches KarsTS main screen when the welcome screen is destroyed.It is used internally.
Usage
mainScreen()
mainScreen()
Author(s)
Marina Saez Andreu
Title: | An Interface for Microclimate Time Series Analysis |
---|---|
Description: | An R code with a GUI for microclimate time series, with an emphasis on underground environments. 'KarsTS' provides linear and nonlinear methods, including recurrence analysis (Marwan et al. (2007) <doi:10.1016/j.physrep.2006.11.001>) and filling methods (Moffat et al. (2007) <doi:10.1016/j.agrformet.2007.08.011>), as well as tools to manipulate easily time series and gap sets. |
Authors: | Marina Saez [aut, cre], David Benavente [ths], Soledad Cuezva [ths], Concepcion Pla [ctb] |
Maintainer: | Marina Saez <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.4.1 |
Built: | 2024-10-22 04:00:31 UTC |
Source: | https://github.com/cran/KarsTS |
An R code with a GUI for microclimate time series, with an emphasis on underground environments. 'KarsTS' provides linear and nonlinear methods, including recurrence analysis (Marwan et al. (2007) <doi:10.1016/j.physrep.2006.11.001>) and filling methods (Moffat et al. (2007) <doi:10.1016/j.agrformet.2007.08.011>), as well as tools to manipulate easily time series and gap sets.
KarsTS is a package for microclimate time series, with an emphasis on undergroung environments, such as caves. Microclimate research typically includes CO2 and Rn concentrations, temperature and humidity time series, amongst others. Many of these time series have a strong nonlinear behavior and they often contain significant gaps. KarsTS provides linear and non-linear analysis and filling methods, as well as tools to manipulate easily time series and gap sets.
The interface KarsTS is opened by running the function KarsTS
on the R or RStudio console. It has five menus: Time Series, Gap Sets, Analysis, Plots and Filling.
Time Series menu: time series basic manipulation (loading, saving, resampling, scaling, rounding, etc.).
Gap Sets menu: gap sets basic manipulation (loading, saving, selection, MCAR Little's test etc.). Gap sets manipulation allows to apply a filling method to a subset of gaps in a time series (for example, gaps smaller than a certain length).
Analysis menu: linear and non-linear analytic procedures (statistics, rolling statistics, loess decomposition,invariants, recurrence matrices, stationarity and linearity tests etc.).
Plots menu: tools for plotting recurrence matrices, time series, phase portraits, manual removal of points etc. It contains also analytic procedures with mainly graphical results (linear correlation, mutual information, false nearest neighbors etc.).
Filling menu: univariate and multivariate methods to fill missing values in time series (interpolation, ARIMA, random forest algorithm etc.).
See the User's Guide for more information.
Please, cite this package as:
Marina Saez (2018). KarsTS: An interface for microclimate time series analysis. R package version 2.2.
Marina Saez [aut, cre], David Benavente [ths], Soledad Cuezva [ths], Concepcion Pla [ctb]
Maintainer: Marina Saez <[email protected]>
This function opens a file containing information about KarsTS version
Marina Saez Andreu
This function creates time series of aggregated values.The user choses the inputs via interface: time series to aggregate, aggregation period, statistic, name for the output and NA treatment (see details).
The statistics available are: median, mean, minimum, maximum, standard deviation and sum. The NA treatment can be: ignore or propagate. In the first case, the statistic is computed using the observations available in the window, as long as the window is not completely missing.In the second case, incomplete windows are assigned NA.
A time series of aggregated values appears in the environment KTSEnv
Marina Saez Andreu
Time series need to have a homogeneous sampling period for most calculations.This function divides a time series in homogeneous-sampling-period pieces that contain either observations or NAs.This information allows to decide how to resample the time series. Note that it also provides a list of gaps.
Once chosen the time serie to analyze, KarsTS offers a list of possible sampling periods (time jumps in the time series), but a human decision is necessary to separate safely true sampling periods from gaps.Tipically, time jumps correspoding to sampling periods appear many times.
A table containing the aforementioned information appears on KarsTS output window.
Marina Saez Andreu
This function applies a set of gaps to a time series.
The new time series name is a combination of the original time series and the gap set names.
A new time series with NAs at the locations indicated by the gap set
Marina Saez Andreu
It is used to apply a Theiler's window to a matrix.
applyTheiler(RM, thW)
applyTheiler(RM, thW)
RM |
The recurrence matrix, in KarsTS format |
thW |
The window, in lags from the diagonal |
A recurrence matrix, in KarsTS format, where the diagonals from the main diagonal up to the distance given by the window have been removed.
Marina Saez Andreu
RM <- genRmExample(InKTSEnv = FALSE,plotRM = FALSE) RM1 <- applyTheiler(RM,10)
RM <- genRmExample(InKTSEnv = FALSE,plotRM = FALSE) RM1 <- applyTheiler(RM,10)
It checks for three types of compatibility: the initial dates are the same, the sampling period is the same and the final date is the same. It is used internally to check whether the inputs chosen by the user are appropiated.
are2TsTimeCompatible (TS1, TS2)
are2TsTimeCompatible (TS1, TS2)
TS1 |
A time series |
TS2 |
Another time series |
A logical vector, which is c(TRUE, TRUE, TRUE) when all the time compatibilty conditions are met.
Marina Saez Andreu
## Generate two time series TS1 <- genTSExample(InKTSEnv = FALSE) TS2 <- genTSExample(InKTSEnv = FALSE) ## Their times are identical timeComp <- are2TsTimeCompatible (TS1, TS2) timeComp ## We modifify the time of TS2. Now their starts are different, ## although they still have same sampling period and length TS2$time <- TS2$time + 1 timeComp <- are2TsTimeCompatible (TS1, TS2) timeComp
## Generate two time series TS1 <- genTSExample(InKTSEnv = FALSE) TS2 <- genTSExample(InKTSEnv = FALSE) ## Their times are identical timeComp <- are2TsTimeCompatible (TS1, TS2) timeComp ## We modifify the time of TS2. Now their starts are different, ## although they still have same sampling period and length TS2$time <- TS2$time + 1 timeComp <- are2TsTimeCompatible (TS1, TS2) timeComp
It checks for three types of compatibility: the initial dates are the same, the sampling period is the same and the length is the same. It is used internally to check whether the inputs chosen by the user are appropiated.
areTsGapTimeCompatible(TS1, GAP1)
areTsGapTimeCompatible(TS1, GAP1)
TS1 |
A time series |
GAP1 |
A gap set |
A logical vector, which is c(TRUE, TRUE, TRUE) when all the time compatibilty conditions are met.
Marina Saez Andreu
## Generate a time series TS <- genTSExample(InKTSEnv = FALSE) ## Generate a gap set consisiting of four gaps of 3 NAs each GS <- genGapExample(TS, 3, 4, InKTSEnv = FALSE) ## They are obviously compatible since we use TS to create GS timeComp <- areTsGapTimeCompatible (TS, GS) timeComp ## We modifify the time of TS. The initial dates are not compatible anymore, ## although the sampling period and the length remain untouched. TS$time <- TS$time + 1 timeComp <- areTsGapTimeCompatible (TS, GS) timeComp
## Generate a time series TS <- genTSExample(InKTSEnv = FALSE) ## Generate a gap set consisiting of four gaps of 3 NAs each GS <- genGapExample(TS, 3, 4, InKTSEnv = FALSE) ## They are obviously compatible since we use TS to create GS timeComp <- areTsGapTimeCompatible (TS, GS) timeComp ## We modifify the time of TS. The initial dates are not compatible anymore, ## although the sampling period and the length remain untouched. TS$time <- TS$time + 1 timeComp <- areTsGapTimeCompatible (TS, GS) timeComp
It checks for three types of compatibility: the initial dates are the same, the sampling period is the same and the length is the same. It is used internally to check whether the inputs chosen by the user are appropiated.
areTsRmTimeCompatible(TS1, RM1)
areTsRmTimeCompatible(TS1, RM1)
TS1 |
A time series |
RM1 |
A recurrence matrix |
A logical vector, which is c(TRUE, TRUE, TRUE) when all the time compatibilty conditions are met.
Marina Saez Andreu
This function fits an ARIMA model to a univariate time series and uses the model to feed a Kalman smoother, which is used to fill missing values in the time series. It is used through the ARIMA button in the Filling Menu.
This function input panel contains a button called "Estimate ARIMA parameters"; this button calls the function forecast::auto.arima to provide an automatic estimation of the ARIMA parameters.These parameters can also be directly introduced by the user. Optionally, the filling can be applied only to a set of gaps in the time series. If the time series does not contain any NAs, KarsTS will fit the ARIMA model anyway and return the parameters.
The filled time series appears in the environment susEnv
Marina Saez Andreu
This function fits an ARIMAX model to a time series and uses the model to feed a Kalman smoother, which is used to fill missing values in the time series. It is used through the ARIMAX button in the Filling Menu.
The only difference between this function and arimaKalman is that arimaXKalman allows the introduction of regressor variables in the model. See arimaKalman for more details.
The filled time series appears in the environment susEnv
Marina Saez Andreu
This function applies the function assign multiple times
assignMultiple(namesVector, valuesList, envir = KTSEnv)
assignMultiple(namesVector, valuesList, envir = KTSEnv)
namesVector |
A vector containing the names to be assigned |
valuesList |
The values to which the names will be assigned |
envir |
The environment |
Marina Saez Andreu
This function creates the buttons corresponding to the Time Series Menu
Marina Saez Andreu
This function creates the buttons corresponding to the Gap Set Menu
Marina Saez Andreu
This function creates the buttons corresponding to the Analysis Menu
Marina Saez Andreu
This function creates the buttons corresponding to the Plots Menu
Marina Saez Andreu
This function creates the buttons corresponding to the Filling Menu
Marina Saez Andreu
This functions checks whether there are any data sets (time series, gap sets or recurrence matrices) in the environment (KTSEnv). If it is the case, it launches a function.
checkIfAny(action = NULL, envirName = KTSEnv)
checkIfAny(action = NULL, envirName = KTSEnv)
action |
The function to be launched |
envirName |
The environment where the data sets are to be found |
Marina Saez Andreu
This functions checks whether there are any time series or gap sets in the environment (KTSEnv). If it is the case, it launches a function.
checkIfAnyGapOrTs(action = NULL, envirName = KTSEnv)
checkIfAnyGapOrTs(action = NULL, envirName = KTSEnv)
action |
The function to be launched |
envirName |
The environment where the data sets are to be found |
Marina Saez Andreu
This functions checks whether there are any time series and gap sets in the environment (KTSEnv). If it is the case, it launches a function.
checkIfAnyGapTs(action = NULL, envirName = KTSEnv)
checkIfAnyGapTs(action = NULL, envirName = KTSEnv)
action |
The function to be launched |
envirName |
The environment where the data sets are to be found |
Marina Saez Andreu
This functions checks whether there are any recurrence matrices in the environment (KTSEnv). If it is the case, it launches a function.
checkIfAnyRm(action = NULL, envirName = KTSEnv)
checkIfAnyRm(action = NULL, envirName = KTSEnv)
action |
The function to be launched |
envirName |
The environment where the data sets are to be found |
Marina Saez Andreu
This functions checks whether there are any recurrence matrices and time seriesin the environment (KTSEnv). If it is the case, it launches a function.
checkIfAnyRmTs(action = NULL, envirName = KTSEnv)
checkIfAnyRmTs(action = NULL, envirName = KTSEnv)
action |
The function to be launched |
envirName |
The environment where the data sets are to be found |
Marina Saez Andreu
This functions checks whether there are any time seriesin the environment (KTSEnv). If it is the case, it launches a function.
checkIfAnyTs(action = NULL, envirName = KTSEnv)
checkIfAnyTs(action = NULL, envirName = KTSEnv)
action |
The function to be launched |
envirName |
The environment where the data sets are to be found |
Marina Saez Andreu
In order to communicate the functions in an interface, it is often unavoidable to create global variables. This function cleans the global variables that are mere intermediate results of the prodecures.It is used internally
cleanEnvir(envir = KTSEnv)
cleanEnvir(envir = KTSEnv)
envir |
The environment where the intermediate objects are to be removed.It defaults to KTSEnv. |
Marina Saez Andreu
Checks whether there are any shared elements between two vectors.It is used internally
compareVecVec(VA, VB)
compareVecVec(VA, VB)
VA |
One vector |
VB |
Another vector |
A logical matrix showing the coincidences
Marina Saez Andreu
compareVecVec(1:10, 7:12) V1 <- c("Apples", "Strawberries","Watermelon") V2 <- c("Ananas", "Apples", "Strawberries", "Coconut") compareVecVec(V1,V2)
compareVecVec(1:10, 7:12) V1 <- c("Apples", "Strawberries","Watermelon") V2 <- c("Ananas", "Apples", "Strawberries", "Coconut") compareVecVec(V1,V2)
This function allows to perform a number of operations on the values of the time series.The operations currently available are: sum, multiplication, opposite, reciprocal and natural logarithm. It is used through the Operations button in the Analysis Menu
Opposite, inverse and logarithm can be applied simultaneously to N time series. The output consists of N output time series the names of which are assigned by default (original names plus Opp, Recip or Ln). On the contrary, the output of sum and multiplication is a single time series and the user must choose its name.
The output time series in the environment KTSEnv
Marina Saez Andreu
This function creates a check box on the main screen
createChb(labTitle = NULL, variableName = NULL, defaultVal = "0")
createChb(labTitle = NULL, variableName = NULL, defaultVal = "0")
labTitle |
A title for the check box |
variableName |
A name for the variable associated to the check box |
defaultVal |
Default value (defaults to not selected) |
A variable that will be passed to the corresponding OnOk function
Marina Saez Andreu
createChbChb: creates a two column check box on the main screen
createChbChb(ind, elements, prefix1 = NULL, prefix2 = NULL, envir = KTSEnv)
createChbChb(ind, elements, prefix1 = NULL, prefix2 = NULL, envir = KTSEnv)
ind |
Number of rows of the check box |
elements |
Row labels |
prefix1 |
A prefix to assign a name to the output variables (column 1) |
prefix2 |
A prefix to assign a name to the output variables (column 2) |
envir |
Enviroment to which the output variables will be assigned |
An output variable for each box. They are be passed to the corresponding onOk function
Marina Saez Andreu
This function creates an element in the input panel consisting of two columns: a check box and the corresponding text entries. It is used internally
createChbEntry(ind, elements, prefix = "scbValue", envir = KTSEnv, dCh = "0", dEn = "")
createChbEntry(ind, elements, prefix = "scbValue", envir = KTSEnv, dCh = "0", dEn = "")
ind |
Number of rows |
elements |
Row labels |
prefix |
A prefix to assign names to the output variables |
envir |
Environment (defaults to the environment KTSEnv) |
dCh |
Default value for the checkbox |
dEn |
Default value for the text entry |
Variables that will be passed to the corresponding OnOk function
Marina Saez Andreu
This function creates a cross recurrence matrix. It is used through the Cross Recurrence Matrix button in the Analysis Menu
The inputs are two time series representing similar variables (for example, two air temperature time series). They must have the same sampling period, although they can have different lengths. The matrix can be visualized by means of the Plot Cross Recurrence Matrix button in the Plots Menu
A cross recurrence matrix in the environment susEnv. Cross recurrence matrices are not symmetrical, therefore the entire matrix is stored (not only a triangle).
Marina Saez Andreu
Marwan,R., Romano, M.C., Thiel,M., Kurths,J.(2007): Recurrence plots for the analysis of complex systems. Physics Reports 438, 237-329.
This function creates a cross recurrence plot from a previously created cross recurrence matrix. It is used through the Plot Cross Recurrence Plot in the Plots Menu
Marina Saez Andreu
Marwan,R., Romano, M.C., Thiel,M., Kurths,J.(2007): Recurrence plots for the analysis of complex systems. Physics Reports 438, 237-329.
This function calculates and plots a distance matrix via interface.
A distance matrix is an unthresholded recurrence matrix.The norm can be Euclidean or Infinity.
Marina Saez Andreu
This function creates a radiobutton. It is used internally
createEachRb(labTitle = NULL, variable = NULL, panel = KTSEnv$subPanR4C1)
createEachRb(labTitle = NULL, variable = NULL, panel = KTSEnv$subPanR4C1)
labTitle |
A title for the check box |
variable |
The variable associated to the radiobutton |
panel |
The panel where the radiobutton is to be placed (defaults to the input panel in the main screen) |
A variable that will be passed to the corresponding OnOk function
Marina Saez Andreu
This function creates a text entry on the input panel (on the main screen)
createEntry(labTitle, textVariableName, defaultVal = "", font = KTSEnv$KTSFonts$T1)
createEntry(labTitle, textVariableName, defaultVal = "", font = KTSEnv$KTSFonts$T1)
labTitle |
The text entry title |
textVariableName |
The name of the variable associated to the text entry |
defaultVal |
Default value (empty entry) |
font |
Title font |
A variable that will be passed to the corresponding OnOk function
Marina Saez Andreu
This function creates a fixed amount of neighbours (FAN) recurrence matrix. It is used through the FAN Recurrence Matrix button in the Analysis Menu.
The FAN recurrence matrix can be created from an existing matrix; in this case, only the closest neighbors are kept.The FAN recurrence matrix can be created directly from a time series. In this case, the embedding dimension, delay, tolerance, Theiler's window and fixed amount of neighbours must be provided via interface. The matrix can be visualized by means of the FAN Recurrence Plot button in the Plots Menu. Note that FAN recurrence matrices are not symmetric.
Marina Saez Andreu
Marwan,R., Romano, M.C., Thiel,M., Kurths,J.(2007): Recurrence plots for the analysis of complex systems. Physics Reports 438, 237-329.
This function creates a recurrence plot from a previously created fixed amount of neighbors (FAN) recurrence matrix.
Marina Saez Andreu
Marwan,R., Romano, M.C., Thiel,M., Kurths,J.(2007): Recurrence plots for the analysis of complex systems. Physics Reports 438, 237-329.
This function creates a check box showing all the gap sets available. It is used internally
createGapChb(labTitle = "Gap sets", envir = KTSEnv)
createGapChb(labTitle = "Gap sets", envir = KTSEnv)
labTitle |
Title for the check box |
envir |
Environment |
Variables to be passed to the corresponding OnOk function
Marina Saez Andreu
This function creates a radiobutton showing all the gap sets available
createGapRb(labTitle = "Gap sets", envir = KTSEnv)
createGapRb(labTitle = "Gap sets", envir = KTSEnv)
labTitle |
Title for the check box |
envir |
Environment |
A variable to be passed to the corresponding OnOk function
Marina Saez Andreu
This function creates a joint recurrence matrix. It is used through the Joint Recurrence Matrix button in the Analysis Menu
The inputs are two time series. They must have the same sampling period. The shorter one will determine the size of the recurrence matrix. The matrix can be visualized by means of the Plot Joint Recurrence Matrix button in the Plots Menu
A joint recurrence matrix in the environment susEnv
Marina Saez Andreu
Marwan,R., Romano, M.C., Thiel,M., Kurths,J.(2007): Recurrence plots for the analysis of complex systems. Physics Reports 438, 237-329.
This function creates a joint recurrence plot from a previously created joint recurrence matrix. It is used through the Plot Joint Recurrence Plot in the Plots Menu
Marina Saez Andreu
Marwan,R., Romano, M.C., Thiel,M., Kurths,J.(2007): Recurrence plots for the analysis of complex systems. Physics Reports 438, 237-329.
This function creates a note on the input panel
createNote(labTitle = NULL, pady = c(10, 10))
createNote(labTitle = NULL, pady = c(10, 10))
labTitle |
Text |
pady |
Upper and lower margins |
Marina Saez andreu
This function creates the OK or NEXT button on the input panel.When the button is pressed the corresponding function is launched.
createOK(labTitle = "NEXT", action = NULL, width = 7, panel = KTSEnv$subPanR4C1)
createOK(labTitle = "NEXT", action = NULL, width = 7, panel = KTSEnv$subPanR4C1)
labTitle |
Usually, its values are "OK" or "NEXT" |
action |
Function that will be launched when the button is pressed. |
width |
Button width |
panel |
Panel were the button will be placed |
Marina Saez Andreu
This function creates N gaps of length M, randomly distributed through a time series. The inputs are the time series, the number of gaps and their length. It is used through the Random Gaps button in the Gap Sets menu.
The new gaps will not overlay previously existing gaps.
The function creates a gap set and applies it to a copy of the input time series.Both the gap set and the new time series appear in the environment susEnv.
Marina Saez Andreu
This function creates a random name consisting of a prefix and a random number from 10000 to 99999.It is used internally
createRandName(prefix = "panel")
createRandName(prefix = "panel")
prefix |
The prefix to which the random number will be added |
Marina Saez Andreu
createRandName("Rodrigo") createRandName("Rodrigo") createRandName("Diaz")
createRandName("Rodrigo") createRandName("Rodrigo") createRandName("Diaz")
This function creates a radio button
createRb(variable = NULL, dataVector = NULL, panel = KTSEnv$subPanR4C1)
createRb(variable = NULL, dataVector = NULL, panel = KTSEnv$subPanR4C1)
variable |
The variable to which the radiobutton is linked |
dataVector |
The names of the buttons |
panel |
The panel where to place the radiobutton (defaults to the main screen input panel) |
Marina Saez Andreu
This function creates a check box listing the recurrence matrices that exist in the environment KTSEnv.
createRmChb(labTitle = "Recurrence matrices", envir = KTSEnv)
createRmChb(labTitle = "Recurrence matrices", envir = KTSEnv)
labTitle |
Check box title |
envir |
Environment (defaults to KTSEnv) |
Variables that will be read in the corresponding onOk function
Marina Saez Andreu
This function creates a radiobutton listing the recurrence matrices that exist in the environment KTSEnv.
createRmRb(labTitle = "Recurrence matrices", envir = KTSEnv)
createRmRb(labTitle = "Recurrence matrices", envir = KTSEnv)
labTitle |
Radiobutton title |
envir |
Environment (defaults to KTSEnv) |
A variable that will be read in the corresponding onOk function
Marina Saez Andreu
This function creates a recurrence matrix. It is used through the Recurrence Matrix button in the Analysis Menu.
The inputs are a time series, the delay, the embedding dimension and a name for the output matrix. The matrix can be visualized by means of the Recurrence Plot button in the Plots Menu Note that there are specific buttons to create and plot cross and joint recurrence matrices.
The recurrence points are represented in a two-column data frame by their positions in the recurrence matrix. Only the upper triangle is stored.
Marina Saez Andreu
Marwan,R., Romano, M.C., Thiel,M., Kurths,J.(2007): Recurrence plots for the analysis of complex systems. Physics Reports 438, 237-329.
This function creates a recurrence plot from a previously created recurrence matrix.Note that there are specific buttons to create and plot cross and joint recurrence matrices. It is used through the Plot Recurrence Plot in the Plots Menu
Marina Saez Andreu
Marwan,R., Romano, M.C., Thiel,M., Kurths,J.(2007): Recurrence plots for the analysis of complex systems. Physics Reports 438, 237-329.
This function creates a gap between two dates chosen by the user.It is used through the Specific Gaps button in the Gap Sets menu.
The function creates a gap set and applies it to a copy of the input time series.Both the gap set and the new time series appear in the environment susEnv.
Marina Saez Andreu
This function creates a blank input panel on the main screen. It is used whenever is necessary to erase the elements of the input panel (title, check boxes, radiobutton etc.) and write new ones.It is used internally
Marina Saez Andreu
This function creates (on the input panel) a label that works as a second level title.It is used internally
createTitle(labTitle = "Title")
createTitle(labTitle = "Title")
labTitle |
The text of the title |
Marina Saez Andreu
This function creates (on the input panel) a label that works as a first level title.
createTITLE(labTitle = "TITLE", panel = KTSEnv$subPanR4C1)
createTITLE(labTitle = "TITLE", panel = KTSEnv$subPanR4C1)
labTitle |
Text of the title |
panel |
Panel where the title is to be written (defaults to the input panel on the main screen) |
Marina Saez Andreu
This function creates a check box listing the time series that exist in the environment KTSEnv.
createTsChb(labTitle = "Time series", envir = KTSEnv)
createTsChb(labTitle = "Time series", envir = KTSEnv)
labTitle |
Check box title |
envir |
Environment (defaults to KTSEnv) |
Variables that will be read in the corresponding onOk function
Marina Saez Andreu
This function creates a radiobutton listing the time series that exist in the environment KTSEnv.
createTsRb(labTitle = "Time series", variableName = "selTsP", envir = KTSEnv)
createTsRb(labTitle = "Time series", variableName = "selTsP", envir = KTSEnv)
labTitle |
Radiobutton title |
variableName |
Name of the variable to be assigned to the radiobutton |
envir |
Environment (defaults to KTSEnv) |
A variable that will be read in the corresponding onOk function
Marina Saez Andreu
This function creates a cumulated time series, that is, each point is the sum of all the previous values in the time series.It is particulary useful when the input time series has zero mean.It is used through the button Cumulative sum in the Time Series Menu
The cumulated time series
Marina Saez Andreu
A function to destroy KarsTS main screen. It is normally destroyed via interface.
destroyMainScreen()
destroyMainScreen()
Marina Saez Andreu
This function destroys KarsTS welcome screen. It is used through the button Start in the welcome screen.
Marina Saez Andreu
This function is used to study the determinism of a system, based on the number and length of the diagonal lines that contains the recurrence matrix that represents the system. It is used through the button Determinism in the Anaylisis menu.
The following outputs are written on KarsTS output window: recurrence rate, determinism, ratio and summary of the lengths of the diagonal lines. Besides, a new window containing a histogram of diagonal lines pops up.
Marina Saez Andreu
Marwan,R., Romano, M.C., Thiel,M., Kurths,J.(2007): Recurrence plots for the analysis of complex systems. Physics Reports 438, 237-329.
This function creates a new time series by differencing the input time series.It is used through the button differences in the Time Series Menu
The inputs are: time series, lag and center yes/not. In this context, center the time series means that the differenced time series will be interpolated, so that the output time series has same length and dates as the original time series.
The differenced time series
Marina Saez Andreu
This function uses the function nonlinearTseries::estimateEmbeddingDim to plot the invariants E1(d) and E2(d) (Cao,1997). E1(d) helps finding the embedding dimension of a scalar time series and E2(d) can distinguish stochastic from deterministic signals.It is used through the button E1d & E2d in the Plots Menu.
Marina Saez Andreu
Cao, L (1997): Practical method for determining the minimum embedding dimension of a scalar time series. Physica D: Nonlinear Phenomena, 110,1, pp. 43-50.
This function embeds a time series and adds NAs so that the embedded data have the same length as the original time series.It is used internally
embedData(TSData, embDim, embDelay)
embedData(TSData, embDim, embDelay)
TSData |
Values of the time series |
embDim |
Embedding dimension |
embDelay |
Delay |
A matrix of embedded data, with as many NAs as necessary so that it has the same length as the original time series.
Marina Saez Andreu
This function adds three lines of asterisks on the output panel.It is used to separate outputs of different functions.It is used internally
endingLines()
endingLines()
Marina Saez Andreu
This function is used to export time series, gap sets or recurrence matrices to csv or txt files. It is used through the button Export in the Time Series or Gap Sets menus.
All types of data sets can be exported both from the Time Series menu or from the Gap Sets menu.It is possible to export more than one time series to the same file; however, each gap set and recurrence matrix must be stored separatedly. The files are created in the woking directory.
Marina Saez Andreu
This function finds twin points in a recurrence matrix and uses them to fill adjacent missing values. Many points do not have twins, therefore it is unlikely that all the missing values are filled. It is used through the button twins in the Filling Menu
The inputs to this function are: the time series to fill (TSF), a recurrence matrix that represents the system (RM), the maximum distance (MD) and, optionally, the gap set to fill. A missing value is replaced by the median of its twin points. Case A: TSF was used to build RM. In this case, RM lacks information at the points to fill; therefore, it is necessary to find the twins of the adjacent points, that is, MD must be greater than 0. Case B: the system was reconstructed using other time series, that is, RM was calculated without TSF. In this case, it is possible to set MD to 0, although it can be greater than 0, as well.
The filled time series in susEnv and a summary of the procedure on the output window.
Marina Saez Andreu
This function identifies the format of a set of dates from a list of allowed formats.
findDateFormat(X, tz = NULL)
findDateFormat(X, tz = NULL)
X |
The date (given as a character string) |
tz |
The time zone |
The allowed formats are: "%m/%d/%Y %H:%M", "%Y/%m/%d %H:%M","%Y-%m-%d %H:%M" and "%m-%d-%Y %H:%M"
It returns the date format, ready to use in the funtion strptime. If the dates have different formats, the function returns "variousFormats". If the format is not one of the allowed ones, it returns "notAllowedformat".
Marina Saez Andreu
This function finds twin points (that is, identical columns) in a recurrence matrix.It is used internally
findTwins(recMat, pointsToFind = NULL)
findTwins(recMat, pointsToFind = NULL)
recMat |
The recurrence matrix |
pointsToFind |
The points (columns) whose twins are to be found (defaults to all) |
The function classifies the columns in families of twins and assigns an integer number to each family. The numbers are mere codes to identify the families and they do not have any meaning themselves.
A vector of integers. Each number represents a family of twins. Positions corresponding to columns with no twins are assigned NA. When the search of twins is limited to a subset of points, the uninteresting points are assigned NA also.
Marina Saez Andreu
Marwan,R., Romano, M.C., Thiel,M., Kurths,J.(2007): Recurrence plots for the analysis of complex systems. Physics Reports 438, 237-329.
# Generate time series and recurrence matrix res <- genRmExample(name = "SRM", InKTSEnv = FALSE, plotRM = FALSE) TS <- res$TS SRM <- res$newSimpRM # Find twins SRMTwins <- findTwins(SRM) # Interpretation example aFamily <- SRMTwins[which(is.finite(SRMTwins))][1] twinsInFamily <- which(SRMTwins == aFamily) TS[twinsInFamily,] # The values in TS are very similar # The columns in the recurrence matrix are identical, # although this cannot be observed directly # because of the way KarsTS stores recurrence matrices
# Generate time series and recurrence matrix res <- genRmExample(name = "SRM", InKTSEnv = FALSE, plotRM = FALSE) TS <- res$TS SRM <- res$newSimpRM # Find twins SRMTwins <- findTwins(SRM) # Interpretation example aFamily <- SRMTwins[which(is.finite(SRMTwins))][1] twinsInFamily <- which(SRMTwins == aFamily) TS[twinsInFamily,] # The values in TS are very similar # The columns in the recurrence matrix are identical, # although this cannot be observed directly # because of the way KarsTS stores recurrence matrices
This function plots embedding dimension vs false nearest neighbors using tseriesChaos::false.nearest and tseriesChaos::plot.false.nearest. It is used to find the minimum embedding dimension. It is used through the button FNN in the Plots Menu.
Marina Saez andreu
This function exports the function KarsTS::KarsTS. It is used internally.
functToExport()
functToExport()
Other objects documente here:
makeGlobal is a vector containing the variables to declare global.It is used internally.
KTSEnv is the environment where the loaded data sets are and it can be accesed directly from the R console. We reccomend to use KarsTS to manipulate the data sets; however, the user can handle them directly from R in order to apply functionalities not included in KarsTS. If that is the case, be careful to produce data sets with the right format; otherwise, KarsTS will not recognize them. See the User's Guide for more information.
Marina Saez Andreu
This function is used to fill gaps using a generalized additive model (gam) with tensor smoothing. It is used through the Multivariate Splines in the Filling Menu. Although the gam model is not necessarily a multivariate spline, the button has this name because we think is more familiar to the users.
The user selects the time series to fill and a set of predictor time series. The function fits a generalized linear model a gap and uses the model to fill the gap. This is done for every gap in the gap set. It is used through the Multivariate Splines in the Filling Menu. The user can choose a fixed d.f. regression spline or a penalized regression spline. It is also possible to choose any of the smoothing bases allowed by the function mgcv::te.
The filled time series in the environment KTSEnv and a summary of the results on the output window.
Marina Saez Andreu
This function identifies which gap sets have been checked from a check box
gapCheckedTF(prefix = "gcbValue", envir = KTSEnv)
gapCheckedTF(prefix = "gcbValue", envir = KTSEnv)
prefix |
A prefix to reconstruct the names that were assigned to the variables in the check box. |
envir |
The environment |
A logical vector
Marina Saez Andreu
This function identifies the gap sets currently loaded in the environment KTSEnv
gapDetect()
gapDetect()
A vector containing the names of the gap sets
Marina Saez Andreu
This function finds which gap the user selected to apply a filling method on it. If none was selected, it creates a gap set containing all the gap sets in the time series.
gapForSelMethod(selTsName, selTs, envir = KTSEnv)
gapForSelMethod(selTsName, selTs, envir = KTSEnv)
selTsName |
The time series name |
selTs |
The time series |
envir |
The environment |
A list containing the selected gap set name and the gap set. If the user did not select any gap set or there is no gap set in the environment, the function creates a gap set containing all the gaps in the time series. It is name is All plus the time series name.
Marina Saez Andreu
A function to generate a gap set example.It can be assigned to the KTSEnv environment.
genGapExample(timSer, lGaps, nGaps, name = "GS", InKTSEnv = TRUE)
genGapExample(timSer, lGaps, nGaps, name = "GS", InKTSEnv = TRUE)
timSer |
The time series where the gaps are generated |
lGaps |
The length of the gaps |
nGaps |
The number of gaps |
name |
A name for the gap set. It defaults to GS. When InKTSEnv is FALSE, the name is not necessary. |
InKTSEnv |
Assign to the environment KTSEnv (TRUE) or not (FALSE) |
The gap set
Marina Saez Andreu
A function to generate a recurrence matrix example. It can be assigned to the KTSEnv environment.
genRmExample(name = "SRM", InKTSEnv = TRUE, plotRM = FALSE)
genRmExample(name = "SRM", InKTSEnv = TRUE, plotRM = FALSE)
name |
A name for the recurrence matrix. When the local environment is used instead of KTSEnv, the name is still necessary for the recurrence plot title. |
InKTSEnv |
Assign the output to the KTSEnv (TRUE) or to the local environment (FALSE) |
plotRM |
Plot the recurrence matrix (TRUE) or not (FALSE) |
The recurrence matrix is calculated on a sinusoidal time series composed with a random walk. The embedding dimension is 2, the delay is 290 and the threshold is 20.
The recurrence matrix and the time series
Marina Saez Andreu
res <- genRmExample(name = "RMExample", InKTSEnv = FALSE, plotRM = FALSE) res$newSimpRM res$TS
res <- genRmExample(name = "RMExample", InKTSEnv = FALSE, plotRM = FALSE) res$newSimpRM res$TS
This function generates an example time series. The dates range from 2015 to 2016 and the sampling period is half an hour. The time series can be white noise or a random walk. It can be assigned to the KTSEnv environment.
genTSExample(stationary = TRUE, name = "TS", InKTSEnv = TRUE)
genTSExample(stationary = TRUE, name = "TS", InKTSEnv = TRUE)
stationary |
Generate white noise (TRUE) or a random walk (FALSE) |
name |
A name for the time series. It defaults to TS. When InKTSEnv is FALSE, the name is not necessary. |
InKTSEnv |
Assign to the environment KTSEnv (TRUE) or not (FALSE) |
The time series
Marina Saez Andreu
This function identifies objects of a class in an environment
getClassEnvir(classGet = "list", envir = KTSEnv)
getClassEnvir(classGet = "list", envir = KTSEnv)
classGet |
The class |
envir |
The environment |
A vector with the names of the objects
Marina Saez Andreu
This function allows to manually select points from a plot and get their coordinates. It is used through the button Get coordinates in the Plots menu.
This function has two steps. In the first place, it is necessary to select a time series and plot it. The plot appears on a pop-up window. Then, the user clicks on one or more points and they turn green. When the user presses the Write results button, a list of coordinates (time and value) appears on the output window.
Marina Saez Andreu
This function calculates the correlation probability of recurrence of two systems, given by their recurrece matrices.
getCRP(prob1, prob2, xLims, doPlot = FALSE, main = "plotTitle")
getCRP(prob1, prob2, xLims, doPlot = FALSE, main = "plotTitle")
prob1 |
Probability of recurrence of the first matrix |
prob2 |
Probability of recurrence of the second matrix |
xLims |
X range where the correlation probability will be calculated. The diagonals very close or very far from the main diagonal are usually discarded for estimating the CPR. |
doPlot |
Get a plot (TRUE) or not (FALSE) |
main |
Title for the plot |
Correlation probability of recurrence (CPR)
Marina Saez Andreu
Romano, M. C. (2004). Synchronization Analysis by Means of Recurrences in Phase Space, Universitat Postdam. Doctoral dissertation.
This function transforms a set of dates (given as character) to numeric after testing that their format is allowed by KarsTS.
getDelayCharTimes(initialTimes, tz = NULL)
getDelayCharTimes(initialTimes, tz = NULL)
initialTimes |
The dates |
tz |
The time zone |
A vector with the times in numeric form
Marina Saez Andreu
This function creates a fixed amount of neighbours (FAN) matrix via console from a time series. To create a FAN matrix via interface, see the function createFAN.
getFANRM2(selTs, embedDim, lagDelay, threshold, theilerWin, fan)
getFANRM2(selTs, embedDim, lagDelay, threshold, theilerWin, fan)
selTs |
A univarate time series in KarsTS format. |
embedDim |
The embedding dimension. |
lagDelay |
The delay (in lags). |
threshold |
The threshold. |
theilerWin |
The Theiler's window (in lags). |
fan |
The fixed amount of neighbours. |
In case you do not want to embed your time series, set embedDim to 1 and lagDelay to 0. If you do not want to apply a Theiler's window, set theilerWin to 0. The threshold will determine in the first place the number of neighbors of each point; then, the fixed amount of neighbours will determine how many of those are kept. For example, if a point A has 10 neighbors (according to the threshold) and the fan is 5, the point A will have 5 neighbors in the output matrix. However, if a point B has only 4 neighbors (according to the threshold), the number of neighbors of B in the output matrix will be 4. If you want a matrix with a truly fixed amount of neighbors, give the threshold a value high enough to render it useless.
A list containing the X and Y positions of the recurrent points in the FAN recurrence matrix.
Marina Saez Andreu
Marwan,R., Romano, M.C., Thiel,M., Kurths,J.(2007): Recurrence plots for the analysis of complex systems. Physics Reports 438, 237-329.
This function identifies which gaps remain in a time series after applying a filling method. It is used internally.
getGapsAfterFill(filledTS, selGap, envir = KTSEnv)
getGapsAfterFill(filledTS, selGap, envir = KTSEnv)
filledTS |
The filled time series |
selGap |
The gap set that was meant to be filled |
envir |
The environment |
It returns a list containing two data frames: one of them lists the remaining gaps and the other, the filled gaps.
Marina Saez Andreu
This function returns the greater negative difference in a time series (greater in absolute value). It is used internally.
getMaxNegSlope(timSerVals)
getMaxNegSlope(timSerVals)
timSerVals |
The time series (only the values, not the times) |
Marina Saez Andreu
This function returns the greater positive difference in a time series.It is used internally.
getMaxPosSlope(timSerVals)
getMaxPosSlope(timSerVals)
timSerVals |
The time series (only the values, not the times) |
Marina Saez Andreu
This function identifies the gaps existing in a time series and returns a table.It is used internally.
getNAsGaps(y)
getNAsGaps(y)
y |
The time series (only values, not times) |
A matrix listing the initial and final indices of each gap
Marina Saez Andreu
This function creates nGaps gaps of length lGaps in the time series timSer. It is used internally. The gaps do not overlay amongst them; they do not overlay pre-existing gaps either.
getNewGapsInd(timSer, lGaps, nGaps)
getNewGapsInd(timSer, lGaps, nGaps)
timSer |
The time series where the gaps will be created. |
lGaps |
The length of the gaps |
nGaps |
The number of gaps. |
A vector containing the indices of the gaps
Marina Saez Andreu
# Create time series TS <- genTSExample(InKTSEnv = FALSE)[1:50,] # Create 3 gaps of 7 NAs each gInd <- getNewGapsInd(TS, 7, 3) # Create time series duplicate and apply the gaps TS1 <- TS TS1$value[gInd] <- NA #Compare cbind(TS, TS1$value)
# Create time series TS <- genTSExample(InKTSEnv = FALSE)[1:50,] # Create 3 gaps of 7 NAs each gInd <- getNewGapsInd(TS, 7, 3) # Create time series duplicate and apply the gaps TS1 <- TS TS1$value[gInd] <- NA #Compare cbind(TS, TS1$value)
This function gets the relative root mean square error,the mean absolute error and bias error.
getOtherErrEstim(observed, predicted)
getOtherErrEstim(observed, predicted)
observed |
Observed values |
predicted |
Predicted values |
Marina Saez Andreu
This function calculates the probability of recurrence of a system, given by a recurrence matrix in KarsTS format. The RP is calculated for each diagonal (upper triangle).
getProTaos(RecMat, xlim = NULL, main = NULL, doPlot = TRUE)
getProTaos(RecMat, xlim = NULL, main = NULL, doPlot = TRUE)
RecMat |
A recurrence matrix in KarsTS format |
xlim |
X range of the plot. |
main |
Plot title |
doPlot |
Get the plot or not |
A list containing
Tao |
The diagonals where the RP was calculated |
Prob |
The RP for each diagonal |
Marina Saez Andreu
Romano, M. C. (2004). Synchronization Analysis by Means of Recurrences in Phase Space, Universitat Postdam. Doctoral dissertation.
This function is the core of the function createSimpleRm. It finds the recurrence points in a time series, possibly embedded.
getRecurrencePoints(timSer, embedDim, lagDelay, threshold)
getRecurrencePoints(timSer, embedDim, lagDelay, threshold)
timSer |
The time series |
embedDim |
The embedding dimension |
lagDelay |
The delay for the embedding (in lags) |
threshold |
The threshold |
Two points in the phase space are recurrent when the distance between them (infinite norm) is less than the threshold.
In a recurrence matrix the X positions read rightwards and the Y positions read upwards. Recurrence matrices are symmetric and their diagonal (line X = Y) cannot contain not-recurrent points. For this reason, only the upper triangle is stored.
A list containing the X and Y positions of the recurrent points in the recurrence matrix (upper triangle)
Marina Saez Andreu
# # Generate time series timSer <- genTSExample(stationary = FALSE, InKTSEnv = FALSE) graphics::plot(timSer) # # Calculate recurrence matrix RP <- getRecurrencePoints(timSer, 1, 0, threshold = 0.1) X <- RP$recPointsX Y <- RP$recPointsY # # Recurrence plot LT <- nrow(timSer) graphics::par(pty = "s") # Upper triangle graphics::plot(timSer$time[X], timSer$time[Y], cex = 0.3, col = 4, xlab = "", ylab = "") # Lower triangle graphics::points(timSer$time[Y], timSer$time[X], cex = 0.3, col = 4) # Diagonal graphics::points(1:LT, 1:LT, cex = 0.3, col = 4) graphics::par(pty = "m")
# # Generate time series timSer <- genTSExample(stationary = FALSE, InKTSEnv = FALSE) graphics::plot(timSer) # # Calculate recurrence matrix RP <- getRecurrencePoints(timSer, 1, 0, threshold = 0.1) X <- RP$recPointsX Y <- RP$recPointsY # # Recurrence plot LT <- nrow(timSer) graphics::par(pty = "s") # Upper triangle graphics::plot(timSer$time[X], timSer$time[Y], cex = 0.3, col = 4, xlab = "", ylab = "") # Lower triangle graphics::points(timSer$time[Y], timSer$time[X], cex = 0.3, col = 4) # Diagonal graphics::points(1:LT, 1:LT, cex = 0.3, col = 4) graphics::par(pty = "m")
This function calculates a certain statistic in centered sliding windows along a time series. The available statistics are: minimum, first quartile,median, mean, third quartile, maximum and standard deviation. Incomplete windows can be assigned NA (option tailsTS = FALSE); alternatively, the statistic can be calculated with the available values.
getRollStatistics(selTs, selTsName, slidingWin, tailsTS = FALSE, selStatisTF)
getRollStatistics(selTs, selTsName, slidingWin, tailsTS = FALSE, selStatisTF)
selTs |
The input time series |
selTsName |
The input time series name |
slidingWin |
The sliding window size |
tailsTS |
The action regarding the tails (TRUE or FALSE) |
selStatisTF |
A data frame containing seven columns. Each column corresponds to a statistic. When the user selects a statistic, its value is TRUE; otherwise, it is FALSE. |
For each selected statistic, the function creates a time series in the environment susEnv (for example, a time series of mean values).
Marina Saez Andreu
This function divides a time series in pieces with a single sampling period and either values or missing values. Internally, this function separates true missing values from missing values that are the result of the existence of different sampling periods in the time series. Note that KarsTS time series are regular; when a time series with different time steps is loaded, NAs are added to achieve regularity. It is used internally.
getSamPerTable(timSer, sampPer)
getSamPerTable(timSer, sampPer)
timSer |
The input time series |
sampPer |
A vector that contains the existing sampling periods. |
It returns a data frame listing all the pieces.
Marina Saez Andreu
This function is a simplified version of getSamPerTable for time series that have a single sampling period. It is used internally.
Marina Saez Andreu
This function gets the computer screen size.It is used internally.
getScreenSize()
getScreenSize()
The width and heigth of the screen are assigned to the enviroment susEnv.
Marina Saez Andreu
This function calculates the minimum, first quartile, median, mean, third quartile, maximum and standard deviation of a time series.It is used internally.
getStatistics(selTs)
getStatistics(selTs)
selTs |
The time series |
A vector containing the statistics values
Marina Saez Andreu
This function get the time steps existing in a time series and sorts them according to the number of times they appear (starting by the most repeated). It returns a table with this information.It is used internally.
getUniqueSampPer(timeSer)
getUniqueSampPer(timeSer)
timeSer |
The time series |
Marina Saez Andreu
This function performs a linear fit between observed and predicted values. The predicted values come from an artificial gap set that has been filled. When true missing values are imputed, it is impossible to estimate the goodness of the filling. It is used through the Check filling button in the Filling menu.
A summary of the fit in the output window and different plots in pop-up windows.
Marina Saez Andreu
This function transforms the output of the function groupIndices from indices to dates.It is used internally.
groupDates(rawIndices, TimSer)
groupDates(rawIndices, TimSer)
rawIndices |
The indices |
TimSer |
The time series to which the indices belong. |
Marina Saez Andreu
X <- sort(sample(1:50,25)) TS <- genTSExample(InKTSEnv = FALSE) groupIndices(X) groupDates(X, TS)
X <- sort(sample(1:50,25)) TS <- genTSExample(InKTSEnv = FALSE) groupIndices(X) groupDates(X, TS)
This function groups a set of sorted indices. For example: 1,2,3,50,100,101,102,103 would be grouped as follows: 1-3, 50, 100-103.It is used internally.
groupIndices(rawIndices)
groupIndices(rawIndices)
rawIndices |
The indices |
It returns a data frame. Each row corresponds to a group. The columns are: initial index, final index and group length.
Marina Saez Andreu
X <- sort(sample(1:50,25)) X groupIndices(X)
X <- sort(sample(1:50,25)) X groupIndices(X)
This function plots the histogram of a time series values. Its inputs are the time series and, optionally, the approximate number of bars. It is used internally through the button Histogram in the Plots menu
Marina Saez Andreu
This function estimates the correlation sum and dimension and the KS Entropy through the functions nonlinearTseries::corrDim and nonlinearTseries::sampleEntropy. It returns three plots: correlation sum, correlation dimension and sample entropy.The first two appear on the same pop-up window.It is used internally through the button Invariants in the Analysis menu.
Marina Saez Andreu
This function checks whether a set of dates format is correct according to KarsTS specifications.It is used internally.
isTimeAlright(timeCharacter, tz = KTSEnv$timeZone)
isTimeAlright(timeCharacter, tz = KTSEnv$timeZone)
timeCharacter |
A vector containg the dates as character. |
tz |
The time zone. |
Marina Saez Andreu
This function is used to launch KarsTS interface. This is the only function in the package that is called through the R command window. The rest are used internally or manipulated via interface.If the user closes the interface accidentally, this function can be simply run again.
KarsTS(skipWelcome = FALSE)
KarsTS(skipWelcome = FALSE)
skipWelcome |
When TRUE, the interface main screen appears directly |
Marina Saez Andreu
This function is used to study the laminarity of a system, based on the number and length of the vertical lines that contains the recurrence matrix that represents the system. It is used internally through the button Laminarity in the Anaylisis menu.
The following outputs are written on KarsTS output window: recurrence rate, laminarity, ratio and summary of the lengths of the vertical lines. Besides, a new window containing a histogram of vertical lines pops up.
Marina Saez Andreu
Marwan,R., Romano, M.C., Thiel,M., Kurths,J.(2007): Recurrence plots for the analysis of complex systems. Physics Reports 438, 237-329.
This function plots the autocorrelation and partial autocorrelation functions or the cross correlation function, depending on the number of input time series. It is used internally through the Linear correlation button in the Plots menu.
Marina Saez Andreu
This function runs a number of linearity tests using the functions surrogateTest and nonlinearityTest from package nonlinearTseries.It is used internally through the Linearity button in the Analysis menu.
Marina Saez Andreu
This function loads all types of data sets (time series, data sets and recurrence matrices). It generates two buttons: one is used to load R files and the other is used to import csv and txt files. The function automatically recognizes the type of data set, checks whether the format is right and places the data sets in the environment susEnv. It is used through the Load button in the Time Series or the Gap Sets menus.
Marina Saez Andreu
This function creates fonts for KarsTS and assign them to the environment susEnv.It is used internally.
loadKarsTSFonts()
loadKarsTSFonts()
Marina Saez Andreu
This function performs a loess smoothing using the function stats::loess. The user has to enter the time series and the alpha parameter. Optionally, the user can enter the control parameter and some predictor time series.It is used through the Loess smooth. button in the Analysis menu.
Marina Saez Andreu
This function launches KarsTS main screen when the welcome screen is destroyed.It is used internally.
mainScreen()
mainScreen()
Marina Saez Andreu
This function replaces each missing value by the mean (or median) of the values located in equivalent positions in the periods around. It is used through the button Mean Value in the Filling menu.
The user needs to enter the following inputs: time series, period, number of surrounding periods to consider, maximum number of iterations, minimum number of observations ar one side and statistic (median or mean). Note that the surrounding periods can have missing values also; they can even be completely missing.The method can be applied iteratively, although it is not advisable to use many iterations because filling missing values does not increases the real amount of information available. In case the missing values concentrate at one side, the filling might be biased. The minimum number of observations at one side is useful to discard these biased fillings.
The filled time series in the environment susEnv and a summary of the results on the output window.
Marina Saez Andreu
This function merges two or more time series and two or more gap sets. The time series cannot overlap and must have the same unique sampling period. The gap sets must coome from time series with the same initial date and sampling period.It is used through the button Merge of the Time Series or the Gap Sets menus.
The merged time series, the merged gap set or both.
Marina Saez Andreu
This function is used to fill missing values using the function missForest::missForest.The user must choose the input and output time series, the number of trees and the maximum number of iterations. It is used through the button MissForest in the Filling menu.
The filled time series in the environment KTSEnv and a summary of the results on the output window.
Marina Saez Andreu
This function computes the mode after removing missing values.
modeKTS(x)
modeKTS(x)
x |
The data |
Marina Saez Andreu
This function calculates the mutual information between two time series via interface.The core functions belong to the package infotheo
.
Marina Saez Andreu
This function computes the average mutual information using the function tseriesChaos::mutual and plots the result. As in the linear correlation button, the input can be one or two time series. It is used through the Mutual button in the Plots menu.
Marina Saez Andreu
This function applies a function to the elements of a vector so that the result for each element is located in a row in a matrix. It is used internally.
myApplyVector(FUN = NULL, dataVector = NULL, out.ncols = 1, ...)
myApplyVector(FUN = NULL, dataVector = NULL, out.ncols = 1, ...)
FUN |
the function to apply |
dataVector |
The vector to which elements apply the function |
out.ncols |
Number of columns for the output matrix |
... |
Further arguments to passed |
Marina Saez Andreu
exampleF <- function(X){c(X + 5, X*5)} myApplyVector(FUN = exampleF, dataVector = 1:10, out.ncols = 2)
exampleF <- function(X){c(X + 5, X*5)} myApplyVector(FUN = exampleF, dataVector = 1:10, out.ncols = 2)
This function is used to perform a linear model between observed and predicted values. It also prepares the outputs to be writen on the output window and plots different graphics.It is the core of the goodnessFilling function.
myLinModel(observed, predicted)
myLinModel(observed, predicted)
observed |
Observed values |
predicted |
Predicted values |
Marina Saez Andreu
This function is used to scale one or more variables with the possibility of removing the attributes from the base::scale output. It is also possible to perform a robust scaling using the median and the median absolute deviation instead of the mean and the standard deviation. It is used internally.
myScale(inputMatrix, scaleType = "Robust", outputType = c("outDef", "outList", "outNo"))
myScale(inputMatrix, scaleType = "Robust", outputType = c("outDef", "outList", "outNo"))
inputMatrix |
Matrix containing the variables to scale. |
scaleType |
Robust scaling or not |
outputType |
Three types of outputs: output as in base::scale, attributes removed but stored in a list and no attributes at all. |
Marina Saez Andreu
This function fills missing values in a time series by means of linear interpolation.It is used through the Linear button in the Filling menu.
The filled time series in the environment KTSEnv and a summary of the results on the output window.
Marina Saez Andreu
NAs4Resamp introduces NAs in a time series for upsampling, via interface.The user needs to provide the new sampling period in seconds.This function only introduces NAs, then they need to be filled (menu Filling methods).
The upsampled time series in KarsTS format.
Marina Saez Andreu
This function fills missing values in a time series by means of splines interpolation. It is used through the Splines button in the Filling menu.
The filled time series in the environment KTSEnv and a summary of the results on the output window.
Marina Saez Andreu
This function runs a number of normality tests using the functions uniNorm, mardiaTest and hzTest from package MVN. It is used through the Normality button in the Analysis menu.
Marina Saez Andreu
This function imports from other packages the functions that KarsTS needs.It is used internally.
packagesToImport()
packagesToImport()
Marina Saez Andreu
This function performs a principal component analysis using the function prcomp.It is used through the button PCA in the Analysis menu.
The punctuations as new time series in the environment KTSEnv. A summary on the output window, including the loadings and the variance explained.
Marina Saez Andreu
This function is used to plot one or more time series. They can be plotted using lines, points or both. The plot can appear on the plot window (main screen) or in a new window. In the second case, it is possible to select a part of the time series and plot it in another window.It is used through the Plot ts button in the Plots menu.
Marina Saez Andreu
This function verifies that the values of multiple text entries are valid.
readMultEntryvalues(nElements, prefix = "entValue", type = "character")
readMultEntryvalues(nElements, prefix = "entValue", type = "character")
nElements |
Number of entries |
prefix |
A prefix that has been previously used to name the variables associated to the entries. |
type |
The required type of element: character, integer or real. |
The text entry values transformed in integer or real if necessary. If the value is not valid the function returns NA.
Marina Saez Andreu
This function identifies the time series, gap sets and recurrence matrices present in the environment susEnv.It returns a list of data sets, which is assigned to susEnv so that it is accesible from all the package functions.
refreshDataSetsList(outp = TRUE)
refreshDataSetsList(outp = TRUE)
outp |
when outp = TRUE, it shows a summary of the data sets on the output window. |
The function is used internally every time a new data set is created in order to refresh the data set list. From this list, KarsTS extracts information every time it creates a check box or radiobutton of gap sets. Optionally, information about the data sets appears on the output window (when outp = TRUE ). This happens when the user runs the function by means of the button List in the Time Series or Gap Sets menus. In this case, the user gets to see the information.
It returns a list containing: the time series names, the number of time series, the gap sets names, the number of gap sets, the recurrence matrices names and the number of recurrence matrices.
Marina Saez Andreu
This function removes all types of data sets (time series, gap sets, recurrence matrices) from the environment susEnv. It is used through the button Remove in the Time Series or Gap Sets menus.
Marina Saez Andreu
This function checks whether a variable exists and removes it in case it does. It is used to clean KTSEnv from global variables created as by-products of the procedures. It is used internally.
removeIfExists(candidates, envir = KTSEnv)
removeIfExists(candidates, envir = KTSEnv)
candidates |
The names of the variables to remove. |
envir |
The environment |
Marina Saez Andreu
This function is used to remove from a time series a set of graphically selected points. It is useful to remove outliers.It is used through the Remove Points button in the Plots menu.
The points are actually removed from a copy of the time series, which is called by default timeSeriesName_pr. The points to remove are selected by dragging the mouse over them. All points within a radius are selected; the user can control this radius (or threshold) via interface.
A new time series where the selected points values have been replaced by NAs.
Marina Saez Andreu
This function is used to rename time series, gap sets or recurrence matrices. The data set with the original name is kept. It is used through the Rename button in the Time Series or the Gap Sets menus.
Marina Saez Andreu
This function identifies which time series have been checked from a check box.
rmCheckedTF(prefix = "rcbValue", envir = KTSEnv)
rmCheckedTF(prefix = "rcbValue", envir = KTSEnv)
prefix |
A prefix to reconstruct the names that were assigned to the variables in the check box. |
envir |
The environment |
A logical vector
Marina Saez Andreu
This function identifies the recurrence matrices currently loaded in the environment susEnv. It is used internally.
rmDetect()
rmDetect()
A vector containing the names of the recurrence matrices
Marina Saez Andreu
This function filters the slope (difference) outliers in a time series. It finds the greater outlier, it removes the value causing it and it tries to re-fill value by linear interpolation. Then the greater outlier in the modified time series is found and so on. It is used internally.
rmSlopeOutliers(tS = NULL, origMxPosSlope = NULL, origMxNegSlope = NULL, filling = NULL)
rmSlopeOutliers(tS = NULL, origMxPosSlope = NULL, origMxNegSlope = NULL, filling = NULL)
tS |
The time series |
origMxPosSlope |
The maximum allowed positive slope. Greater slopes are considered as outliers. |
origMxNegSlope |
The maximum allowed negative slope. Greater slopes (in absolute value) are considered as outliers. |
filling |
The positions in the time series corresponding to filled values(that is, not actual observations).When this argument is not null, the actual observations remain untouched whether if they cause outliers or not. |
The smoothed time series. The function stops when there are no more outliers or when it reaches 100000 iterations. This is a safety measure to avoid infinite loops.If the time series still contains outliers, run the function again.
Marina Saez andreu
This function gathers, via interface, the outputs that are necessary to run the function getRollStatistics. It is used through the button Rolling statistics in the Analysis menu.
Marina Saez Andreu
This function rounds the values of one or more time series to a number of decimal places or significant digits. When the user enters both, the significant digits option takes priority.It is used through the button Round in the Time Series menu.
The rounded time series in the environment KTSEnv.
Marina Saez Andreu
RPKTS:This function is used to calculate the recurrece probability via interface
When two time series are selected, KarsTS calculates their correlation probability of recurrence too.
Marina Saez Andreu
Romano, M. C. (2004). Synchronization Analysis by Means of Recurrences in Phase Space, Universitat Postdam. Doctoral dissertation.
This function saves all types of data sets (time series, gap sets or recurrence matrices) to one or more R files in the working directory. When various data sets are to be saved to the same file, the user must provide name; otherwise, the file bear the name of the data set.Through the button save in the Time Series or the Gap Sets menu.
Marina Saez Andreu
This function saves the contents of the output window to a txt file in the working directory.The file name is report plus the date of creation.Through the button Save report to txt file (lower part of the main screen).
Marina Saez Andreu
This function is used to scale or more time series. It handles the inputs and outputs of the myScale function.Through the button Scale in the Time Series menu.
Marina Saez Andreu
This function plots time series in a two dimensional or three dimensional phase space. The time series can be embedded so that the sum of the dimension of all time series is 2 or 3. Is is used through the Phase Portraits button in the Plots Menu.
Marina Saez Andreu
This function is used create a gap set from a time series. The new gap set contains the gaps that meet some criteria. The available criteria are: all gaps, minimum length, maximum length and specific gaps (selected from a list). The user can choose one or more criteria.Through the button Gap selection in the Gap Sets menu.
The criteria can be combined in two ways: a. (minimum length and maximum length) and specific gaps; b. (minimum length or maximum length) and specific gaps. When the user chooses only one length criterion, the combination must be the second (the first one would produce and empty gap).
A gap set gathering the required gaps.
Marina Saez Andreu
This function is used to cut a piece of time series, resample a time series or both. The user chooses the initial and final dates of the new time series and the resampling factor.The dates default to the original time series extremes and the resampling factor defaults to 1(no resampling). Through the Cut and resampling button in the Time Series menu.
Marina Saez Andreu
Some text entries in KarsTS consist of a list of values separated by commas. This function separates the values and checks whether they have the appropiate format.It is used internally
separateEntry(y, class1 = verifyIntEntry, class2 = verifyCharEntry, noValid = NA)
separateEntry(y, class1 = verifyIntEntry, class2 = verifyCharEntry, noValid = NA)
y |
The value to check |
class1 |
The class the first element should be |
class2 |
The class the second element should be |
noValid |
The output to return when the input is not valid |
This function is used inside the verifyDateEntry function, whic is used to verify if a date is correct. The function setCorrectDate verifies if the year, month, day, hour, minutes or seconds are correct. For example, the day has to be an integer between 1 and 31, the minutes and seconds must be integers between 0 an 59 etc.
setCorrectDate(x, type)
setCorrectDate(x, type)
x |
The element to test |
type |
The type of element: year, month, day, hour, minute or second |
The element if it is valid; NA otherwise.
Marina Saez Andreu
This function is used to change the working directory by means of the Set WD button on the main screen.
Marina Saez Andreu
This function is used to open a short help file through the Help button on KarsTS main screen. For further help, a User's Guide in pdf format is available.
Marina Saez Andreu
This function handles the inputs and outputs from function rmSlopeOutliers. It removes, one by one, points that produce abnormally steep slopes and replaces them by linear interpolation. The peaks are progresively filed down and the result is a smoothed time series. Usually, these outliers are caused by wrong measurements; filling missing values can produce them also.It is used through the button Rm slope Outliers in the Filling menu.
In the first step, the user must choose the time series to smooth and whether if the outliers must be removed from a filling or from the whole time series. In the second step, the user must provide the maximum positive and negative slopes or, alternatively, a reference time series from which calculate them. When the outliers are removed from a filling, the reference time series is the non-filled time series.
The smoothed time series. In order to avoid infinite loops, there is a maximum of 100000 iterations. If, by then, the time series has not been completely smoothed, it will necessary to apply the function again.
Marina Saez Andreu
This function runs a number of stationarity tests using the functions PP.test and Box.test from package stats and adf.test and kpss.test from package tseries.Through the Stationarity button in the Analysis menu.
Marina Saez Andreu
This function handles the inputs and outputs from the function getStatistics, which is used to calculate the statistics of a time series.Through the button Statistics in the Analysis menu.
A table on the output window.
Marina Saez Andreu
This function fills missing values in a time series by means of Stinemann's interpolation.Through the Stinemann's button in the Filling menu.
The filled time series in the environment KTSEnv and a summary of the results on the output window.
Marina Saez Andreu
This function performs a loess seasonal decomposition using the function stlplus::stlplus. Through the button Loess.decomp. in the Analysis menu.
The user enters via interface the time series, the period, the seasonal window, the trend window and the type of decomposition (additive or multiplicative). Optionally, the trend can be decomposed using more windows.
The trend, the seasonal and the irregular components.These bear the name of the original time series plus Tr, Sea and Rem, respectively. If the trend is further decomposed, the user must enter names for the output components.
Marina Saez Andreu
It applies a Theiler's window to a recurrence matrix via interface.
Marina Saez Andreu
This function identifies which time series have been checked from a check box. It is used internally.
tsCheckedTF(prefix = "scbValue", envir = KTSEnv)
tsCheckedTF(prefix = "scbValue", envir = KTSEnv)
prefix |
A prefix to reconstruct the names that were assigned to the variables in the check box. |
envir |
The environment |
A logical vector
Marina Saez Andreu
This function identifies the time series currently loaded in the environment susEnv It is used internally
tsDetect()
tsDetect()
A vector containing the names of the time series
Marina Saez Andreu
This function reads a variable coming from a text entry and checks whether it is character or not.It is used internally.
verifyCharEntry(x, noValid = "isNoValid")
verifyCharEntry(x, noValid = "isNoValid")
x |
The element to check |
noValid |
The output the function will return when the input is not character. |
One-character strings are not allowed.
Marina Saez Andreu
verifyCharEntry("Strawberry", noValid = "isNoValid") verifyCharEntry(235, noValid = "isNoValid") verifyCharEntry(235, noValid = NA)
verifyCharEntry("Strawberry", noValid = "isNoValid") verifyCharEntry(235, noValid = "isNoValid") verifyCharEntry(235, noValid = NA)
This function checks whether a date is valid or not.It has six inputs (seconds, minutes,hours,day,month and year); these come from a set of text entries.It is used internally.
verifyDateEntry(valSecs, valMins, valHour, valDay, valMonth, valYear)
verifyDateEntry(valSecs, valMins, valHour, valDay, valMonth, valYear)
valSecs |
Seconds |
valMins |
Minutes |
valHour |
Hour |
valDay |
Day |
valMonth |
Month |
valYear |
Year |
Marina Saez Andreu
This function reads a variable coming from a text entry and checks whether it is integer or not.It is used internally.
verifyIntEntry(x, noValid = "isNoValid")
verifyIntEntry(x, noValid = "isNoValid")
x |
The element to check |
noValid |
The output the function will return when the input is not character. |
Marina Saez Andreu
verifyIntEntry("Strawberry", noValid = "isNoValid") verifyIntEntry(235.6, noValid = NA) verifyIntEntry(235, noValid = NA) verifyIntEntry(0235, noValid = NA) verifyIntEntry(235.0, noValid = NA)
verifyIntEntry("Strawberry", noValid = "isNoValid") verifyIntEntry(235.6, noValid = NA) verifyIntEntry(235, noValid = NA) verifyIntEntry(0235, noValid = NA) verifyIntEntry(235.0, noValid = NA)
This function reads a variable coming from a text entry and checks whether it is real or not.It is used internally.
verifyRealEntry(x, noValid = "isNoValid")
verifyRealEntry(x, noValid = "isNoValid")
x |
The element to check |
noValid |
The output the function will return when the input is not character. |
Marina Saez Andreu
verifyRealEntry("Strawberry", noValid = "isNoValid") verifyRealEntry(235, noValid = NA) verifyRealEntry(0235, noValid = NA) verifyRealEntry(235.6, noValid = NA)
verifyRealEntry("Strawberry", noValid = "isNoValid") verifyRealEntry(235, noValid = NA) verifyRealEntry(0235, noValid = NA) verifyRealEntry(235.6, noValid = NA)
This function launches KarsTS welcome screen. It is used internally.
welcomeScreen()
welcomeScreen()
Marina Saez Andreu
This function plots a wind rose from directional data. The data must be in sexagesimal degrees. It is used through the button Wind Rose in the Analysis menu.
Marina Saez Andreu
This function is internally used when any of the filling methods that KarsTS offers is used. It writes on KarsTS output window information that is shared by all filling methods: which time series and gap set were to fill, which gaps were effectively filled and which remained empty. Filling-method-specific information is writen trhough other functions. It is used internally.
writeMethodSummary(filledNasTable, remainingNAsInGap, selTsName, selGapName, selGap)
writeMethodSummary(filledNasTable, remainingNAsInGap, selTsName, selGapName, selGap)
filledNasTable |
Table of filled gaps |
remainingNAsInGap |
Table of gaps that could not be filled. It does not include gaps whose filling was not attempted. |
selTsName |
Name of the time series that was filled. |
selGapName |
Name of the gap set that was meant to be filled |
selGap |
Gap set that was meant to be filled |
Marina Saez Andreu
This function writes a title on KarsTS output window. It is used internally.
writeMethodTitle(titleMethod)
writeMethodTitle(titleMethod)
titleMethod |
The text of the title |
Marina Saez Andreu