Type: | Package |
Title: | High-Dimensional Functional Time Series Analysis |
Version: | 1.0 |
Date: | 2025-01-18 |
Depends: | R (≥ 3.5.0), ftsa |
Imports: | methods |
LazyLoad: | yes |
ByteCompile: | TRUE |
Maintainer: | Han Lin Shang <hanlin.shang@mq.edu.au> |
Description: | Offers methods for visualizing, modelling, and forecasting high-dimensional functional time series, also known as functional panel data. Documentation about 'hdftsa' is provided via the paper by Cristian F. Jimenez-Varon, Ying Sun and Han Lin Shang (2024, <doi:10.1080/10618600.2024.2319166>). |
License: | GPL-3 |
NeedsCompilation: | no |
Packaged: | 2025-01-22 20:35:07 UTC; hanlinshang |
Author: | Han Lin Shang |
Repository: | CRAN |
Date/Publication: | 2025-01-24 13:10:02 UTC |
High-dimensional Functional Time Series Analysis
Description
Offers methods for visualizing, modelling, and forecasting high-dimensional functional time series, also known as functional panel data. Documentation about 'hdftsa' is provided via the paper by Cristian F. Jimenez-Varon, Ying Sun and Han Lin Shang (2024, <doi:10.1080/10618600.2024.2319166>).
Author(s)
Han Lin Shang [aut, cre] (<https://orcid.org/0000-0003-1769-6430>)
Maintainer: Han Lin Shang <hanlin.shang@mq.edu.au>
References
C. F. Jimenez-Varon, Y. Sun and H. L. Shang (2024) Forecasting high-dimensional functional time series: Application to sub-national age-specific mortality, Journal of Computational and Graphical Statistics, 33(4), 1160-1174.
C. F. Jimenez-Varon, Y. Sun and H. L. Shang (2024) Forecasting density-valued functional panel data, Australian and New Zealand Journal of Statistics, under minor revision.
Functional analysis of variance fitted by means.
Description
Decomposition by functional analysis of variance fitted by means.
Usage
FANOVA(data_pop1, data_pop2, year=1959:2020, age= 0:100,
n_prefectures=51, n_populations=2)
Arguments
data_pop1 |
It's a p by n matrix |
data_pop2 |
It's a p by n matrix |
year |
Vector with the years considered in each population. |
n_prefectures |
Number of prefectures |
age |
Vector with the ages considered in each year. |
n_populations |
Number of populations. |
Value
FGE_mean |
FGE_mean, a vector of dimension p |
FRE_mean |
FRE_mean, a matrix of dimension length(row_partition_index) by p. |
FCE_mean |
FCE_mean, a matrix of dimension length(column_partition_index) by p. |
Author(s)
Cristian Felipe Jimenez Varon, Ying Sun, Han Lin Shang
References
C. F. Jimenez Varon, Y. Sun and H. L. Shang (2023) “Forecasting high-dimensional functional time series: Application to sub-national age-specific mortality".
Ramsay, J. and B. Silverman (2006). Functional Data Analysis. Springer Series in Statistics. Chapter 13. New York: Springer
See Also
Examples
# The US mortality data 1959-2020 for two populations and three states
# (New York, California, Illinois)
# Compute the functional Anova decomposition fitted by means.
FANOVA_means <- FANOVA(data_pop1 = t(all_hmd_male_data),
data_pop2 = t(all_hmd_female_data),
year = 1959:2020, age = 0:100,
n_prefectures = 3, n_populations = 2)
##1. The funcional grand effect
FGE = FANOVA_means$FGE_mean
##2. The funcional row effect
FRE = FANOVA_means$FRE_mean
##3. The funcional column effect
FCE = FANOVA_means$FCE_mean
Functional time series decomposition into deterministic (from functional median polish of Sun and Genton (2012)), and functional residual components.
Description
Decomposition of functional time series into deterministic (from functional median polish), and functional residuals
Usage
One_way_Residuals(Y, n_prefectures = 51, year = 1959:2020, age = 0:100)
Arguments
Y |
The multivariate functional data, which are a matrix with dimension n by 2p, where n is the sample size and p is the dimensionality. |
n_prefectures |
Number of prefectures. |
year |
Vector with the years considered in each population. |
age |
Vector with the ages considered in each year. |
Value
A matrix of dimension n by p.
Author(s)
Cristian Felipe Jimenez Varon, Ying Sun, Han Lin Shang
References
C. F. Jimenez Varon, Y. Sun and H. L. Shang (2023) “Forecasting high-dimensional functional time series: Application to sub-national age-specific mortality", arXiv. \ Y. Sun and M. G. Genton (2012) “Functional median polish", Journal of Agricultural, Biological, and Environmental Statistics, 17(3), 354-376.
See Also
Examples
# The US mortality data 1959-2020, for one populations (female)
# and 3 states (New York, California, Illinois)
# first define the parameters and the row partitions.
# Define some parameters.
year = 1959:2020
age = 0:100
n_prefectures = 3
#Load the US data. Make sure it is a matrix.
Y <- all_hmd_female_data
# The results
# Compute the functional residuals.
FMP_residuals <- One_way_Residuals(Y, n_prefectures=3, year=1959:2020, age=0:100)
One-way functional median polish from Sun and Genton (2012)
Description
Decomposition by one-way functional median polish.
Usage
One_way_median_polish(Y, n_prefectures=51, year=1959:2020, age=0:100)
Arguments
Y |
The multivariate functional data, which are a matrix with dimension n by 2p, where n is the sample size and p is the dimensionality. |
year |
Vector with the years considered in each population. |
n_prefectures |
Number of prefectures. |
age |
Vector with the ages considered in each year. |
Value
grand_effect |
Grand_effect, a vector of dimension p. |
row_effect |
Row_effect, a matrix of dimension length(row_partition_index) by p. |
Author(s)
Cristian Felipe Jimenez Varon, Ying Sun, Han Lin Shang
References
C. F. Jimenez Varon, Y. Sun and H. L. Shang (2023) “Forecasting high-dimensional functional time series: Application to sub-national age-specific mortality", arXiv. \ Sun, Ying, and Marc G. Genton (2012) “Functional Median Polish", Journal of Agricultural, Biological, and Environmental Statistics 17(3), 354-376.
See Also
One_way_Residuals
, Two_way_median_polish
, Two_way_Residuals
Examples
# The US mortality data 1959-2020, for one populations (female)
# and 3 states (New York, California, Illinois)
# first define the parameters and the row partitions.
# Define some parameters.
year = 1959:2020
age = 0:100
n_prefectures = 3
#Load the US data. Make sure it is a matrix.
Y <- all_hmd_female_data
# Compute the functional median polish decomposition.
FMP <- One_way_median_polish(Y,n_prefectures=3,year=1959:2020,age=0:100)
# The results
##1. The funcional grand effect
FGE <- FMP$grand_effect
##2. The funcional row effect
FRE <- FMP$row_effect
Functional time series decomposition into deterministic (from functional median polish from Sun and Genton (2012)), and time-varying components (functional residuals).
Description
Decomposition of functional time series into deterministic (from functional median polish), and time-varying components (functional residuals)
Usage
Two_way_Residuals(Y, n_prefectures, year, age, n_populations)
Arguments
Y |
A matrix with dimension n by 2p. The functional data |
year |
Vector with the years considered in each population |
n_prefectures |
Number of prefectures |
age |
Vector with the ages considered in each year |
n_populations |
Number of populations |
Value
residuals1 |
A matrix with dimension n by p |
residuals2 |
A matrix with dimension n by p |
rd |
A two dimension logic vector that proves that the decomposition sum up to the data |
R |
A matrix with the same dimension as Y. This represent the time-varying component in the decomposition |
Fixed_comp |
A matrix with the same dimension as Y. This represent the deterministic component in the decomposition |
Author(s)
Cristian Felipe Jimenez Varon, Ying Sun, Han Lin Shang
References
C. F. Jimenez Varon, Y. Sun and H. L. Shang (2023) "Forecasting high-dimensional functional time series: Application to sub-national age-specific mortality".
Sun, Ying, and Marc G. Genton (2012). "Functional Median Polish". Journal of Agricultural, Biological, and Environmental Statistics 17(3), 354-376.
See Also
Examples
# The US mortality data 1959-2020, for two populations
# and three states (New York, California, Illinois)
# Column binds the data from both populations
Y = cbind(all_hmd_male_data, all_hmd_female_data)
# Decompose FTS into deterministic (from functional median polish)
# and time-varying components (functional residuals).
FMP_residuals <- Two_way_Residuals(Y,n_prefectures=3,year=1959:2020,
age=0:100,n_populations=2)
# The results
##1. The functional residuals from population 1
Residuals_pop_1=FMP_residuals$residuals1
##2. The functional residuals from population 2
Residuals_pop_2=FMP_residuals$residuals2
##3. A logic vector whose components indicate whether the sum of deterministic
## and time-varying components recover the original FTS.
Construct_data=FMP_residuals$rd
##4. Time-varying components for all the populations. The functional residuals
All_pop_functional_residuals <- FMP_residuals$R
##5. The deterministic components from the functional median polish decomposition
deterministic_comp <- FMP_residuals$Fixed_comp
Functional time series decomposition into deterministic (functional analysis of variance fitted by means), and time-varying components (functional residuals).
Description
Decomposition of functional time series into deterministic (by functional analysis of variance fitted by means), and time-varying components (functional residuals)
Usage
Two_way_Residuals_means(data_pop1, data_pop2, year, age, n_prefectures, n_populations)
Arguments
data_pop1 |
A p by n matrix |
data_pop2 |
A p by n matrix |
year |
Vector with the years considered in each population. |
n_prefectures |
Number of prefectures |
age |
Vector with the ages considered in each year. |
n_populations |
Number of populations. |
Value
residuals1 |
A matrix with dimension n by p. |
residuals2 |
A matrix with dimension n by p. |
rd |
A two dimension logic vector proving that the decomposition sum up the data. |
R |
A matrix of dimension as n by 2p. This represents the time-varying component in the decomposition. |
Fixed_comp |
A matrix of dimension as n by 2p. This represents the deterministic component in the decomposition. |
Author(s)
Cristian Felipe Jimenez Varon, Ying Sun, Han Lin Shang
References
C. F. Jimenez Varon, Y. Sun and H. L. Shang (2023) “Forecasting high-dimensional functional time series: Application to sub-national age-specific mortality".
Ramsay, J. and B. Silverman (2006). Functional Data Analysis. Springer Series in Statistics. Chapter 13. New York: Springer.
See Also
Examples
# The US mortality data 1959-2020, for two populations
# and three states (New York, California, Illinois)
# Compute the functional Anova decomposition fitted by means.
FANOVA_means_residuals <- Two_way_Residuals_means(data_pop1=t(all_hmd_male_data),
data_pop2=t(all_hmd_female_data), year = 1959:2020,
age = 0:100, n_prefectures = 3, n_populations = 2)
# The results
##1. The functional residuals from population 1
Residuals_pop_1=FANOVA_means_residuals$residuals1
##2. The functional residuals from population 2
Residuals_pop_2=FANOVA_means_residuals$residuals2
##3. A logic vector whose components indicate whether the sum of deterministic
## and time-varying components recover the original FTS.
Construct_data=FANOVA_means_residuals$rd
##4. Time-varying components for all the populations. The functional residuals
All_pop_functional_residuals <- FANOVA_means_residuals$R
##5. The deterministic components from the functional ANOVA decomposition
deterministic_comp <- FANOVA_means_residuals$Fixed_comp
Two-way functional median polish from Sun and Genton (2012)
Description
Decomposition by two-way functional median polish
Usage
Two_way_median_polish(Y, year=1959:2020, age=0:100, n_prefectures=51, n_populations=2)
Arguments
Y |
A matrix with dimension n by 2p. The functional data. |
year |
Vector with the years considered in each population. |
n_prefectures |
Number of prefectures |
age |
Vector with the ages considered in each year. |
n_populations |
Number of populations. |
Value
grand_effect |
grand_effect, a vector of dimension p |
row_effect |
row_effect, a matrix of dimension length(row_partition_index) by p. |
col_effect |
col_effect, a matrix of dimension length(column_partition_index) by p |
Author(s)
Cristian Felipe Jimenez Varon, Ying Sun, Han Lin Shang
References
C. F. Jimenez Varon, Y. Sun and H. L. Shang (2023) “Forecasting high-dimensional functional time series: Application to sub-national age-specific mortality".
Sun, Ying, and Marc G. Genton (2012) “Functional Median Polish", Journal of Agricultural, Biological, and Environmental Statistics, 17(3), 354-376.
See Also
Examples
# The US mortality data 1959-2020 for two populations and three states
# (New York, California, Illinois)
# Compute the functional median polish decomposition.
FMP = Two_way_median_polish(cbind(all_hmd_male_data, all_hmd_female_data),
n_prefectures = 3, year = 1959:2020, age = 0:100, n_populations = 2)
##1. The functional grand effect
FGE = FMP$grand_effect
##2. The functional row effect
FRE = FMP$row_effect
##3. The functional column effect
FCE = FMP$col_effect