# 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
Run the code above in your browser using DataLab