{'fraction_non_alphanumeric': 0.04028239202657807, 'fraction_numerical': 0.015521179401993355, 'mean_word_length': 4.227815468113976, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Time-Invariance Coefficients Tests with the Adaptive Multi-Factor Model

The purpose of this paper is to test the multi-factor beta model implied by the generalized arbitrage pricing theory (APT) and the Adaptive Multi-Factor (AMF) model with the Groupwise Interpretable Basis Selection (GIBS) algorithm, without imposing the exogenous assumption of constant betas. The intercept (arbitrage) tests validate both the AMF and the Fama-French 5-factor (FF5) model. We do the time-invariance tests for the betas for both the AMF model and the FF5 in various time periods. We show that for nearly all time periods with length less than 6 years, the beta coefficients are time-invariant for the AMF model, but not the FF5 model. The beta coefficients are time-varying for both AMF and FF5 models for longer time periods. Therefore, using the dynamic AMF model with a decent rolling window (such as 5 years) is more powerful and stable than the FF5 model.


Introduction
The purpose of this paper is to test the multi-factor beta model implied by the generalized arbitrage pricing theory (APT) of Jarrow and Protter (2016) [11], and recently tested by Zhu et al. (2020) [22], without imposing the exogenous assumption of constant betas. The assumption of time invariant beta coefficients in multi-factor models is an often employed one in the empirical literature, see Jagannathan et al. (2010) [10] and Harvey et al. (2016) [9] for reviews. In the paper by Zhu et al. (2020) [22], they address the restrictive nature of this assumption by estimating the model over a short time horizon -three years. For many applications, restricting the time horizon to such a short time period is problematic. Alternative approaches for fitting time varying betas over longer time horizons have been proposed and estimated, such as the conditional factor models. See paper Adrian et al. (2015) [1], Cooper & Maio (2019) [7], and Avramov & Chordia (2006) [2]. In contrast to these approaches, we show herein that this constant beta assumption can be avoided if we use the Adaptive Multi-Factor (AMF) model with the Groupwise Interpretable Basis Selection (GIBS) algorithm in a dynamic manner using a comparably short rolling window. This insight is a direct corollary of the generalized APT 1 .
Using the Adaptive Multi-Factor (AMF) model with the Groupwise Interpretable Basis Selection (GIBS) algorithm proposed in Zhu et al. (2020) [22], but fitting price differences instead of returns, we estimated a multi-factor model to stock prices over the time period 2007 -2018. Employing the collection of Exchange Traded Funds (ETFs) as potential factors, we use a high dimensional GIBS algorithm to select the factors for each company. No-arbitrage tests confirm the validity of the generalized APT. As a robustness check, we also show that the estimated model performs better than the traditional Fama-French 5-factor model. After this validation, we perform the time-invariance tests for the β coefficients for various time periods. At last we found that for time periods no more than 5 years, the beta coefficients are time-invariant for the AMF model. Using a dynamic AMF model with rolling window length no more than 5 years gives a good fit. The arbitrage test confirms the validity of the generalized APT's theory.
An outline for this paper is as follows. Section 2 presents the Generalized APT theory. Section 3 provides the estimation methodology. Section 4 provides the testing methodologiesp and results. Section 5 concludes.

The Generalized APT
Jarrow and Protter (2016) derive a testable multi-factor model over a finite horizon [0, T] in the context of a continuous time, continuous trading market assuming only frictionless and competitive markets that satisfy no-arbitrage and no dominance, i. e. the existence of an equivalent martingale measure. As in the traditional asset pricing models, adding a non-zero alpha to this relation (Jensen's alpha) implies a violation of the no-arbitrage condition.
The generalized APT uses linear algebra to prove the existence of an algebraic basis in the security's payoff space at some future time T. Since this is is a continuous time and trading economy, this payoff space is infinite dimensional. The algebraic basis at time T constitutes the collection of tradeable basis assets and it provides the multi-factor model for a security's price at time T. 2 The coefficients of the time T multi-factor model are constants (non-random). No-arbitrage, the existence of the martingale measure, implies that the arbitrage-free prices of the risky assets at all earlier dates t ∈ [0, T ) will satisfy the same factor model and with the same constant coefficients. Transforming prices into returns (dividing prices at time t + 1 by time t prices to get the return at t + 1), makes the resulting coefficients in the multi-factor model stochastic when viewed at time 0. However, this is not the case for the multi-factor model specified in a security's price (or price differences). The multi-factor model's beta coefficients in the security's price process are time-invariant.
The generalized APT is important for practice because it provides an exact identification of the relevant set of basis assets characterizing a security's realized (emphasis added) returns. This enables a more accurate risk-return decomposition facilitating its use in trading (identifying mispriced assets) and for risk management. Taking expectations of this realized return relation with respect to the martingale measure determines which basis assets are risk-factors, i.e. which basis assets have non-zero expected excess returns (risk premiums) and represent systematic risk. Since the traditional models are nested within the generalized APT, an empirical test of the generalized APT provides an alternative method for testing the traditional models as well.
Let B(t) denote the time tvalue of a money market account (mma) with initial value of 1 dollar at time 0, i.e.
where r 0 (k) is the default-free spot rate (the risk-free rate) from time k to time k + 1. Let A i (t) denote the market price of the i th stock at time t for i = 1, . . . , N c . To include cumulative cash flows and stock splits into the valuation methodology, we need to compute the adjusted price 3 Y i , which is reconstructed by the using the security's returns, after being adjusted for dividends and stock splits 4 : where A i (0) is the initial price and R i (k) its return over [k, k + 1].
2 An algebraic basis means that any risky asset's return can be written as a linear combination of a finite number of the basis asset returns, and different risky assets may have a different finite combination of basis asset explaining their returns. Since the space of random variables generated by the admissible trading strategies is infinite dimensional, this algebraic basis representation of the relevant risks is parsimonious and sparse. 3 This is sometimes called the gains process from investing in the security over [0, T ]. 4 These are the returns provided in the available data bases.
Let V j (t) be the adjusted price of the j th basis asset at time t for j = 1, . . . , N f . Here, the sources of the basis asset in our model are the Fama-French 5 factors and the Exchange-Traded Funds (ETF). We include within this set of risk-factors the mma. For notational simplicity, we let V 1 (t) = B(t).
Given this notation, the generalized APT implies the following multi-factor model for the i th security's time t price: where β i,j for all i, j are constants and˜ i (t) is an i.i.d. error term with zero mean and constant variance. The goal of our estimation is two-fold. First, we want to test to see whether expression (3) provides a good fit to historical stock price data. Second, we want to investigate whether the multi-factors coefficients β i,j 's are time-invariant. Given that prices are known to be autocorrelated, instead of estimating expression (3), we fit the first order price differences of this expression: For a given time period (t, T ), letting n = T − t + 1, p = N f we can rewrite the expression (3) using time series vectors as where V = (V 1 , V 2 , . . . , V p ) and . . .
Based on the generalized APT theory, we will estimate and test on the time-invariance of the β's using the Adaptive Multi-Factor (AMF) model with the Groupwise Interpretable Basis Selection (GIBS) algorithm [22] in the following sections.

The Estimation Methodology
This section gives the estimation and the testing methodology. We first specify the data used to estimate and to test the model. Then, we pick time periods with various lengths with a sufficient quantity of Exchange-Traded Funds (ETF) available. For each time period, we use the Groupwise Interpretable Basis Selection (GIBS) algorithm to estimate the Adaptive Multi-Factor (AMF) model. Within each time period, we propose several methods to test if the β's are constant. We will also compare the results for AMF with the benchmark Fama-French 5-Factor (FF5) model.

Data and Time Periods
We use the Exchange-Traded Funds (ETF) to select the basis assets to be included in the multi-factor model. For comparison to the literature and as a robustness test, we include the Fama-French 5 factors into this set 5 .
The data used in this paper consists of all the stocks and all the ETFs available in the CRSP (The Center for Research in Security Prices) database over the years 2007 -2018. We start in 2007 because prior the number of ETFs with a sufficient amount of capital (in other word, tradable) is limited, which makes it difficult to fit the AMF model.
To avoid the influence of market microstructure effects, we use a weekly observation interval. A security is included in our sample only if it has prices and returns available for more than 2/3 of all the trading weeks. This is consistent with the empirical asset pricing literature. Our final sample consists of over 4000 companies listed on the NYSE. To avoid a survivorship bias, we include the delisted returns (see Shumway (1997) [16] for more explanation). For each regression time period, we form the adjusted price using Equation (2).
We repeat our analysis on all sub-periods of 2007 -2018 (both ends inclusive, the same below) starting at Jan. 1st, ending at Dec. 31th, and with a length at least 3 years. This means we have 55 sub-periods in total, such as 2007 -2009, 2008 -2010, ..., 2008 -2018, 2007 -2018. We only use the time periods with length at least 3 years to ensure that there are sufficient observations to fit the models. As stated above, we use the weekly observations to avoid the market microstructure effects, so 3 years means n ≥ 156 observations in a regression.
The number of ETFs in our sample is large, slightly over 2000 by the end of 2018, i.e. the number of basis assets p 1 > 2000. The set of potential factors is denoted V j (1 ≤ j ≤ p 1 ). Since n = 156 < 2000 < p 1 for the 3-year time periods, high-dimensional statistical methods, including the GIBS algorithm, need to be used.

High-Dimensional Statistics and the GIBS Algorithm
This section provides a brief review of the high-dimensional statistical methodologies used in this paper, including the GIBS algorithm.
Let v d denote the standard l d norm of a vector, then Here the index set S is called the support of β, in other words, supp(β) = {i : Similarly, if X is a matrix instead of a vector, then X S are the columns of X indexed by S. Denote 1 n as a n × 1 vector with all elements being 1, J n = 1 n 1 n , andJ n = 1 n J n . I n denotes the identity matrix with diagonal 1 and 0 elsewhere. The subscript n is always omitted when the dimension n is clear from the context. The notation #S means the number of elements in the set S.
For any matrix M = {m i,j } n i,j=1 define the following terms Because of this high-dimension problem and the high-correlation among the basis assets, traditional methods fail to give an interpretable and systematic way to fit the Adaptive Multi-Factor (AMF) model. Therefore, we employ the Groupwise Interpretable Basis Selection (GIBS) algorithm proposed in the paper Zhu et al. (2020) [22] to select the basis assets set for each stock .
We give a brief review of the GIBS algorithm in this section. In the GIBS algorithm, a procedure using the Minimax-Linkage Prototype Clustering is employed to obtain lowcorrelated ETFs (denoted as U in the paper). The high-dimensional statistical methods (the Minimax-Linkage Prototype Clustering and LASSO) used in the GIBS algorithm can be found in Appendix A. The sketch of the GIBS algorithm is shown in the Table 1. The details of the GIBS algorithm can be found in the paper Zhu et al. (2020) [22].
For simplicity, denote V 1 (t) = B(t) as the money market account, and V 2 (t) as the market index. Most of the ETFs, ∆V i , are correlated with ∆V 2 , the market portfolio. Although this is not true for the other 4 Fama-French factors. Therefore, we first orthogonalize every other basis asset (excluding ∆V 1 and ∆V 2 ) to ∆V 2 . By orthogonalizing with respect to the market return, we avoid choosing redundant basis assets and increase the accuracy of the fitting. Note that for Ordinary Least-Square (OLS) regression, projection does not affect the estimation of ∆Ŷ , since it only affects the coefficients. However, in LASSO projection does affect the set of selected basis assets because it changes the magnitude of the coefficients before shrinking. Thus, we compute where P denotes the projection operator. Let Note that this is equivalent to the residuals after regressing other risk factors on ∆V 2 . The transformed ETF basis assets ∆V still contain highly correlated members. We first divide these basis assets into categories The list of categories with descriptions can be found in Appendix B. The categories are (1) bond/fixed income, (2) commodity, (3) currency, (4) diversified portfolio, (5) equity, (6) alternative ETFs, (7) inverse, (8) leveraged, (9) real estate, and (10) volatility.
Next, from each category we choose a set of representatives. These representatives should span the categories they are from, but also have low correlation with each other. This can be done by using the prototype-clustering method with a distance measure defined in Appendix A, which yield the "prototypes" (representatives) within each cluster (intuitively, the prototype is at the center of each cluster) with low-correlations.
Within each category, we use the prototype clustering methods previously discussed to find the set of representatives. The number of representatives in each category can be chosen according to a correlation threshold. This gives the sets Although this reduction procedure guarantees low-correlation between the elements in each D i , it does not guarantee low-correlation across the elements in the union D. So, an additional step is needed, in which is prototype clustering on D is used to find a low-correlated representatives set U . Note that U ⊆ D. Denote p 2 ≡ #U .
Recall that ∆V U means the columns of the matrix ∆V indexed by the set U . Since basis assets in ∆V U are not highly correlated, a LASSO regression can be applied. Therefore, we have that where U c denotes the complement of U . However, here we use a different λ as compared to the traditional LASSO. Normally the λ of LASSO is selected by cross-validation. However this will overfit the data as discussed in the paper Zhu et al. (2020) [22]. So here we use a modified version of the λ selection rule and set where λ 1se is the λ selected by the "1se rule". The "1se rule" provides the most regularized model such that the error is within one standard error of the minimum error achieved by cross-validation (see [8,17,20]). Therefore, the set of basis assets selected is Next, we fit an Ordinary Least-Square (OLS) regression on the selected basis assets, to estimateβ i , the OLS estimator from Since this is an OLS regression, we use the original basis assets ∆V S i rather than the orthogonalized basis assets ∆V S i . Note that supp(β i ) ⊂ S i . Since we are in the OLS regime, significance tests can be performed on β i . This yields the significant set of coefficients Note that the significant basis asset set is a subset of the selected basis asset set. In another words, A sketch of the GIBS algorithm is shown in Table 1. Recall that for an index set S ⊆ {1, 2, ..., p}, ∆V S i means the columns of the matrix ∆V indexed by the set S i .

The Groupwise Interpretable Basis Selection (GIBS) algorithm
Inputs: Stocks to fit ∆Y i and basis assets ∆V .
2. Divide the transformed basis assets ∆V into k groups C 1 , C 2 , · · · C k using a financial interpretation. 3. Within each group, use prototype clustering to find prototypes

The Intercept Test
We test the validity of the generalized APT by adding an intercept (Jensen's alpha) and testing if the intercept is non-zero. A non-zero intercept implies that the securities are mispriced (i.e. the rejection of the existence of an equivalent martingale measure). Formally, we add an intercept term α i to equation (16) and test the null hypothesis Since using price differences removes the intercept, the intercept test has to done using prices where 1 is an n × 1 vector with all elements 1, and S i are the basis assets selected by the GIBS algorithm in the AMF model, defined in Equation (15). For the FF5, the S i are the Fama-French 5-factors and the risk free rate.
Our initial idea was to fit an Ordinary Least-Square (OLS) regression on the selected basis assets for each company and then report the p-values for the significance of α i . However, we observed that the mma's value V 1 is highly correlated to the constant vector 1 because the risk-free rate is close to (or equal to) 0 for a long time. Therefore, including both 1 and V 1 in the regression leads to the inverse of a nearly-singular matrix, which gives unreliable results. In this case, since the correlation is so large, even projecting out 1 from V 1 does not solve this problem. So we used a two-step procedure instead. First, we estimate the OLS coefficient (β i ) S i from the the non-intercept model and calculate the estimation of residualŝ Then, we fit an intercept-only regression on the residualŝ and report the p-value for the significance of the intercept. Using this technique, we avoided the collinearity issue. The results show that for all time periods, for all stocks, we can not reject the null hypothesis in either AMF or FF5. In other words, there is no significant non-zero intercept for either AMF or FF5 for any time period and for any stock. This evidence provides a validation of the generalized APT and the use of the AMF and FF5 models.

Time-invariance Test in Linear Setting
For each time period, this section tests for the time-invariance of the multi-factors beta coefficients in a linear setting. For these tests we use the first order differences of the prices as described in equations (6) and (16). We use price differences to avoid autocorrelation and any non-stationarities in the price process. Here we only focus on the selected basis assets. In other words, we only test the time-invariance of β i,j where j ∈ S i and S i is the one defined in equation (15). Our null hypothesis for each stock i is that "H 0 : β i,j are time-invariant over the 4 years." Denote h = (h 1 , h 2 , ..., h n ) where h i = 0 for all rows related to first half of the time period and h i = 1 for all rows related to the second half of the time period. Testing for the significance of interaction of each basis asset with h is a way to test whether the coefficients are the same for the first and last two years. To be more specific, consider the regression model: Note that the sign " " means the element-wise multiplication for two vectors, and 1 n is the n × 1 vector with all its elements equal to 1. Here θ i,j = 0 indicates that β i,j is time-invariant during the time period. Our null hypothesis becomes H 0 : θ i,j = 0 for ∀j vs. H 1 : ∃j, such that θ i,j = 0.
An ANOVA test is employed to compare the model in equation (24) and (16). A p-value of less than 0.05 rejects the null hypothesis that the β i,j 's are all time-invariant. We also want to control for the False Discovery Rate (FDR) (see [3]). The Benjamini-Hochberg (BH) [3] FDR adjusting procedure does not account for the correlation between tests, while the Benjamini-Hochberg-Yekutieli (BHY) [4] FDR adjusting method does. Since we may have correlation between the basis assets, we use the BHY method to adjust the p-values into the FDR Q-values and then report the percentage of stocks with Q-values less than 0.05 in Figure 1. Figure 1 reports the percentage of stocks with time-varying beta using the timeinvariance test in a linear setting for each time period. The y-axis is the start year of each time period and the x-axis is the end year of the time period. The percentage in each grid is the percentage of stocks with FDR Q-threshold 0.05 in the ANOVA test comparing the models in Equation (24) and (16). The larger the percentage is, the darker the grid will be. The upper heatmap is the result for the AMF model, while the bottom heatmap is the result for the FF5 model.
In the heatmaps in Figure 1 (and same below), all elements on the k-th skew-diagonal (see definition in Equation (9)) correspond to time periods of the same length, which is k + 3 years. For example, the diagonal (0-th skew-diagonal) elements are related to the time periods with 3 years, the 1st skew-diagonal elements are of the time periods 4 years. Comparing the different skew-diagonals, we can see that the AMF model is very stable in all time periods less than 5 years. For most time periods no more than 5 years, only less than 5% companies has a least 1 time-varying β. In other words, for more than 95% of the companies, the β's in the AMF model are time-invariant. However, for FF5 model, even some 3-year time periods are not stable, such as 2007 -2009.
In the heatmaps in Figure 1 (and same below), all elements on the k-th skew-antidiagonal (see definition in Equation (10)) correspond to time periods with the same "midyear". For example, the 1st skew-anti-diagonal elements are all related to time periods centered in the mid week of 2012, with different time lengths. By comparing different skew-anti-diagonals, we can compare if the stability pattern are the same for different mid-years. For AMF model, we can see that the percentage for a fixed time length does not change much for different mid-years. For example, all time periods of 4 years has time-varying percent less then 5%, which does not change much for different mid-years. However, the stability of the β's for FF5 model depends highly on the mid-year, not just the length of the time period. FF5 is more volatile in the mid-years 2012 -2013 and 2008 -2009. FF5 can not capture the basis assets as accurately as the AMF, and the β's change significantly during the financial crisis.
In general, the AMF is more stable than the FF5, which can be seen in Figure 2. The table in Figure 2 is the difference between the two tables in Figure 1 (AMF -FF5). For most time periods, the grid is blue, meaning that the AMF model is more stable than FF5 by having less a percentage of companies with time-varying β's; sometimes the decrease is over 20%. FF5 is slightly more stable than AMF in only a few time periods, although both AMF and FF5 are quite stable, giving less than 5% of the companies with time-varying β's. AMF performs much better than FF5 in all other time periods when the FF5 is unstable.  In summary, AMF outperforms the FF5 in terms of the stability in two ways. First, for all time periods, AMF is more stable (or at least equally stable) than FF5, i.e. AMF either gives more stable β's than FF5, or gives equally stable β's if FF5 is also stable. Second, the stability of the AMF model for each time length is more robust across all mid-years as compared to FF5. The stability of the AMF model only depends on the length of the time period, and not the starting or ending year, while the stability of the FF5 model depends on the mid-year. This implies that the AMF performed well during the financial crisis.

Residual analysis
In this section we test if including more basis assets improves the fit in each time period. Since the number of ETFs increased over time, by focusing on the second half of the time period, we have more ETFs available compared to the beginning. We want to test if the newly introduced ETFs in the second half of the time period provides a better fit for the AMF model.
Formally, for a time period [t a , t b ], let t mid = (t a + t b )/2. We divide ∆Y i and ∆V into two parts, one for the time period [t a , t mid ) and the second for the time period [t mid , t b ).
We first derive the basis assets set S i in Equation (15) using the GIBS algorithm on the whole time period. Then, we fit an Ordinary Least-Square (OLS) regression on the second half and obtain the estimated coefficients (γ i ) S i . The residuals are We fit an AMF model with the GIBS algorithm again, using the residuals ∆ˆ i,b as our new dependent variables, using all the basis assets available for the time period [t mid , t b ), except for the basis assets already selected in S i . This AMF model on the residuals will provide another selected set of basis assets S i,b . If S i,b = ∅, we merge the two sets together Note that since we remove all the basis assets in S i in our GIBS fitting of the residuals, Continuing, we fit another OLS regression on the second half of the data using the basis assets S i,union Finally, we use an Analysis of Variance (ANOVA) test to compare the models in Equation (27) and Equation (30). For each time period, this test is performed on all stocks yielding a list of p-values. As before, we adjust for the False Discovery Rate (FDR) using the Benjamini-Hochberg-Yekutieli (BHY) [4] method and count the number of companies with FDR Q-values less than 0.05. The percentages are reported in Figure 3. Note that if for i-th stock the set S i,b = ∅, there will not be p-value for this stock since the two models in Equation (27) and (30) are the same. So this stock will not be counted as a company with a FDR Q-value less than 0.05. However, when presenting the percentage, we use the total count of companies available in that time period in the denominator. This generates more conservative percentages. For the FF5 model, S i is the FF5 5-factors and the risk free rate. All the remaining steps in the procedure are the same. The results for FF5 residuals provide a comparison. From Figure 3 we see that for all time periods, the second half gives a significantly better fit with the new basis assets for around 15% of the stocks in the AMF model. Comparing this result with Figure 1, although there are stocks that have constant β's, their risks can be better fitted using the new basis assets. This provides an interesting insight. More basis assets provides better fitting of the errors, although the affects of the old basis assets are still the same.   Figure 3. Each grid is the percentage in AMF model minus the percentage in FF5 model shown in Figure 3.
In summary, comparing the results for the AMF and FF5 residuals, it is clear that AMF uses more basis assets and leaves less information in the residuals than foes FF5. From Figure 4 we see that the percentage of stocks that are better fitted in the second half of the time period is always less for AMF than it is for FF5.

In-Sample and Out-of-Sample Goodness-of-Fit
This section reports the In-Sample and Out-of-Sample goodness-of-fit tests. Since the AMF selects more basis assets than the FF5, it is important to study overfitting. The results show that the AMF model is more powerful and less vulnerable to overfitting than is the FF5, because the AMF achieves a better in-sample Adjusted R 2 (see [18]) and a better Out-of-Sample R 2 (see [6]).
The Adjusted R 2 (see [18]) is a measure of goodness of fit similar to the normal R 2 but adjusted for the number of parameters to penalize on overfitting. The results are shown in Figure 5 and the difference of the Adjusted R 2 between AMF and FF5 is shown in Figure 6. It is clear that for all time periods, AMF increases the Adjsuted R 2 by around 0.1 compared to FF5, which is around a 0.1/0.25 = 40% increment.   Figure 5. Each grid is the difference of the mean Adjusted R 2 of the AMF model minus that of the FF5 model shown in Figure 5.
The Out-of-Sample R 2 (see [6]) is a measure of a model's prediction power. It can be used to check whether a model is overfitting. For each time period, we calculate the Out-of-Sample R 2 for AMF and FF5 for the half-year after the end of that period. The results are in Figure 7 and the differences of the Out-of-Sample R 2 between the two models are in Figure 8. We see that the prediction power of FF5 fades dramatically with time, while the prediction power of AMF is stable, and much better than the FF5. The Out-of-Sample R 2 for AMF is around 0.47, while that for FF5 is around 0.3 in early years and 0.2 in recent years. In recent years, the prediction power of the AMF model is almost twice as large as that of FF5. Therefore, it is clear that the basis assets selected by the AMF model are not overfitting, but achieving better in-sample and out-of-sample goodness-of-fit.

Time-invariance Test in Non-Linear GAM Setting
We can also test time-invariance based on thr non-linear Generalized Additive Model (GAM). This is a more strict test, since this tests not only for the time-invariance of the β's, but also their linearity. We first fit a Time-Varying Coefficient model as a special case of the Generalized Additive Model (GAM). The equation can be written as: where t is the time. Note that the only difference between Equation (31) and Equation (16) is the second allows the β's to be functions of time t. The GAM model estimate each β as a combination of splines or kernels with regard to t. This can be done by the gam() function in the R package mgcv. Next, we perform a variance analysis (ANOVA) test between the GAM model in Equation (31) and the linear model in Equation (16) where each β i are constants over time. This yields a p-value for each stock. As before, we adjust the p-values using the Benjamini-Hochberg-Yekutieli (BHY) [4] method to account for the False Discovery Rate (FDR). We report the percentage of stocks with Q-values less than 0.05 in Figure 9. Figure 9 reports the percentage of stocks with time-varying beta using the timeinvariance test in a non-linear GAM setting for each time period. The y-axis is the start year and the x-axis is the end year of each time period. The percentage in each grid is the percentage of stocks with FDR Q-threshold 0.05 in the ANOVA test that compares the models in Equation (31) and (16). The larger the percentage, the darker the grid will be. The upper heatmap is for the AMF model, while the bottom heatmap is for the FF5 model.
By comparing the different skew-diagonals, we see that both models are more stable in shorter time periods. The AMF outperforms the FF5 in all the time periods, as seen in Figure 10. Figure 10 gives the difference between the percentages across the two heatmaps in Figure 9 (AMF -FF5). All the grids are blue, indicating that AMF is more stable than FF5 in all time periods.
However, comparing the results from GAM and the results from the previous Section 4.2, for any time period and both AMF and FF5 models, more companies are shown to have time-varying β's in the GAM test, although the AMF still outperforms the FF5. This does not necessarily mean that the β's are time varying in all time periods, since it is easy for GAM to overfit, especially in shorter time periods. Indeed, the number of observations for 3 year time periods is n = 156. For the FF5 model, there are 5 basis assets. For the AMF model, there are more basis assets selected. For each basis asset, the GAM model selects some splines or kernels, say 10 splines, which can easily expand the dimension of parameters to p = 5 × 10 = 50, which is already too large for a regression with n = 156 observations. The number of parameters becomes too close to the number of observations. In addition, these new variables may be highly correlated, making the fitt more unstable. This can result in the GAM overfitting. Therefore, the testing based on the GAM model in this section is explorative. Considering this high-dimensional issue, penalization and constraints need to be introduced to traditional GAM for our application. This extension is left for future research.

Conclusion
The purpose of this paper is to test the multi-factor beta model implied by the generalized arbitrage pricing theory (APT) and the Adaptive Multi-Factor (AMF) model with the Groupwise Interpretable Basis Selection (GIBS) algorithm, without imposing the exogenous assumption of constant betas. The intercept (arbitrage) tests show that there is no significant non-zero intercepts in either AMF or FF5 model, which validates the 2 models. The in-sample and out-of-sample goodness-of-fit results show that AMF achieves both better in-sample adjusted R 2 and out-of-sample R 2 , indicating that AMF is more powerful in fitting and less vulnerable to overfitting.
We perform time-invariance tests for the β's for both the AMF and the FF5 models in various time periods. We show that the constant-beta assumption holds in the AMF model in all time periods with length less than 6 years and is quite robust regardless of the start year. However, even for short time periods, FF5 sometimes gives very unstable estimation, especially in financial crisis. This indicates that the AMF is more descriptive and it captures the basis assets that explain the market movements during the financial crisis. For time periods with length longer than 6 years, both AMF and FF5 fail to provide time-invariance β's. However, the β's estimate by the AMF is more time-invariant than the FF5 for nearly all time periods. This shows the superior performance of the AMF model. In summary, using the dynamic AMF model with a descent rolling window (such as 5 years) is more powerful and stable than is the FF5 model.

Appendix A Prototype Clustering and LASSO
This section describes the high-dimensional statistical methodologies used in the GIBS algorithm, including the prototype clustering and the LASSO. To remove unnecessary independent variables using clustering methods, we classify them into similar groups and then choose representatives from each group with small pairwise correlations. First, we define a distance metric to measure the similarity between points (in our case, the returns of the independent variables). Here, the distance metric is related to the correlation of the two points, i.e. d(r 1 , r 2 ) = 1 − |corr(r 1 , r 2 )| (32) where r i = (r i,t , r i,t+1 , ..., r i,T ) is the time series vector for independent variable i = 1, 2 and corr(r 1 , r 2 ) is their correlation. Second, the distance between two clusters needs to be defined. Once a cluster distance is defined, hierarchical clustering methods (see [12]) can be used to organize the data into trees. In these trees, each leaf corresponds to one of the original data points. Agglomerative hierarchical clustering algorithms build trees in a bottom-up approach, initializing each cluster as a single point, then merging the two closest clusters at each successive stage. This merging is repeated until only one cluster remains. Traditionally, the distance between two clusters is defined as either a complete distance, single distance, average distance, or centroid distance. However, all of these approaches suffer from interpretation difficulties and inversions (which means parent nodes can sometimes have a lower distance than their children), see Bien, Tibshirani (2011) [5]. To avoid these difficulties, Bien, Tibshirani (2011) [5] introduced hierarchical clustering with prototypes via a minimax linkage measure, defined as follows. For any point x and cluster C, let d max (x, C) = max be the distance to the farthest point in C from x. Define the minimax radius of the cluster C as r(C) = min x∈C d max (x, C) that is, this measures the distance from the farthest point x ∈ C which is as close as possible to all the other elements in C. We call the minimizing point the prototype for C. Intuitively, it is the point at the center of this cluster. The minimax linkage between two clusters G and H is then defined as d(G, H) = r(G ∪ H).
Using this approach, we can easily find a good representative for each cluster, which is the prototype defined above. It is important to note that minimax linkage trees do not have inversions. Also, in our application as described below, to guarantee interpretable and tractability, using a single representative independent variable is better than using other approaches (for example, principal components analysis (PCA)) which employ linear combinations of the independent variables.
The LASSO method was introduced by Tibshirani (1996) [19] for model selection when the number of independent variables (p) is larger than the number of sample observations (n). The method is based on the idea that instead of minimizing the squared loss to derive the Ordinary Least-Square (OLS) solution for a regression, we should add to the loss a penalty on the absolute value of the coefficients to minimize the absolute value of the non-zero coefficients selected. To illustrate the procedure, suppose that we have a linear model y = Xβ + where ∼ N (0, σ 2 I), X is an n × p matrix, y and are n × 1 vectors, and β is a p × 1 vector. The LASSO estimator of β is given bŷ where λ > 0 is the tuning parameter, which determines the magnitude of the penalty on the absolute value of non-zero β's. In this paper, we use the R package glmnet [8] to fit LASSO.
In the subsequent estimation, we will only use a modified version of LASSO as a model selection method to find the collection of important independent variables. After the relevant basis assets are selected, we use a standard Ordinary Least-Square (OLS) regression on these variables to test for the goodness of fit and significance of the coefficients. More discussion of this approach can be found in Zhao, Shojaie, Witten (2017) [21].
In this paper, we fit the prototype clustering followed by a LASSO on the prototype basis assets selected. The theoretical justification for this approach can be found in [14] and [21].