Clustering Time Series While Resisting Outliers
calculates factor loadings of groupfactors
Adapts the object that contains PIC for all candidate C's and all subs...
When running the algorithm with a different number of observable varia...
Adds the current configuration (number of groups and factors) to df_re...
Adds several metrics to df_results.
Fills in df_pic: adds a row with the calculated PIC for the current co...
Calculates the PIC for the current configuration.
Helpfunction in create_true_beta() for the option beta_true_heterogene...
Function that returns for each candidate C the best number of groups a...
Calculates the error term Y - X*beta_est - LF - LgFg.
Helpfunction for update_g(). Calculates the errors for one of the poss...
Returns the estimated groupfactorstructure.
Calculate the true groupfactorstructure.
calculates factor loadings of common factors
Function to determine PIC (panel information criterium)
Function to calculate the first term of PIC (panel information criteri...
Calculates sum of squared errors, divided by NT
Calculates sigma2maxmodel
Helpfunction. Calculates part of the 4th term of the PIC.
Calculates VC², to determine the stability of the found number of grou...
Helpfunction used in update_g()
Calculates W = Y - X*beta_est. It is used in the initialization step o...
Calculates (the estimated value of) the matrix X*beta_est.
Calculates the product of X*beta_true .
Calculates Z = Y - X*beta_est - LgFg. It is used in the estimate of th...
Calculates Z = Y - X*beta_est - LF. It is used to estimate the groupfa...
Checks the rules for stopping the algorithm, based on its convergence ...
Function that puts individuals in a separate "class zero", when their ...
Function used in generating simulated data with non normal errors.
Creates an instance of DGP 2, as defined in if(!exists(".Rdpack.curref...
Creates beta_true, which contains the true values of beta (= the coeff...
Defines the candidate values for C.
Constructs dataframe where the rows contains all configurations that a...
Defines the set of combinations of group specific factors.
Returns a vector with the indices of the subsets. Must start with zero...
Defines the object that will be used to define a initial clustering.
Determines parameters of rho-function.
Helpfunction in estimate_beta() for estimating beta_est.
Help-function for return_robust_lambdaobject().
Helpfunction to shorten code: are common factors being estimated.
Helpfunction to shorten code: are group factors being estimated.
This function is a wrapper around the initialization and the estimatio...
Estimates beta.
Estimates common factor(s) F.
Estimates group factors Fg.
Solves a very specific issue with MacroPCA.
Function to evade floating point errors.
Fills in the optimized number of common factors for each C.
Fills in the optimized number of groups and group specific factors for...
Filters dataframe on the requested group specific factors configuratio...
Generates the true groupfactorstructure, to use in simulations.
Generate panel data Y for simulations.
Finds the first stable interval after the first unstable point. It the...
Defines the convergence speed.
Function that returns the final clustering, based on the estimated num...
Function which is used to have a dataframe (called "grid") with data (...
Helpfunction in robustpca().
Function with as input a dataframe. (this will be "Y" or "to_divide") ...
Removes NA's in LG (in function calculate_virtual_factor_and_lambda_gr...
Initialisation of estimation of beta (the coefficients with the observ...
Function that clusters time series in a dataframe with kmeans.
Initialises the estimation of the common factors and their loadings.
Initialises a dataframe which will contain the PIC for each configurat...
Initialises a dataframe that will contain an overview of metrics for e...
Initialises rc.
Initialises rcj.
Creates X (the observable variables) to use in simulations.
Wrapper around estimate_beta(), update_g(), and estimating the factors...
Function that returns the set of combinations of groupfactors for whic...
Wrapper around lmrob.
Makes a dataframe with the PIC for each configuration and each candida...
Makes a dataframe with information on each configuration.
Selects a subsample of the time series, and of the length of the time ...
Function to calculate the norm of a matrix.
Helpfunction in OF_vectorized3()
Calculates objective function for the classical algorithm: used in ite...
Wrapper of the loop over the subsets which in turn use the parallelise...
Plots expression(VC^2) along with the corresponding number of groups (...
Helpfunction: prepares object to perform robust PCA on.
RCTS
Randomly reassign individual(s) if there are empty groups. This can ha...
Restructures X (which is an 3D-array of dimensions (N,T,p) to a 2D-mat...
Calculates robust loadings
Function that uses robust PCA and estimates robust factors and loading...
Wrapper around the non-parallel algorithm, to estimate beta, group mem...
Scaling of X.
Helpfunction in update_g(), to calculate solve(FG x t(FG)) x FG
Shows the configurations for potential C's of the first stable interva...
Function that estimates group membership.
Calculates the group factor structure: the matrix product of the group...
Calculates objective function for individual i and group k in order to...
Robust Clustering of Time Series (RCTS) has the functionality to cluster time series using both the classical and the robust interactive fixed effects framework. The classical framework is developed in Ando & Bai (2017) <doi:10.1080/01621459.2016.1195743>. The implementation within this package excludes the SCAD-penalty on the estimations of beta. This robust framework is developed in Boudt & Heyndels (2022) <doi:10.1016/j.ecosta.2022.01.002> and is made robust against different kinds of outliers. The algorithm iteratively updates beta (the coefficients of the observable variables), group membership, and the latent factors (which can be common and/or group-specific) along with their loadings. The number of groups and factors can be estimated if they are unknown.