Modelling Time-Varying Parameters in Panel Data State-Space Frameworks: An Application to the Feldstein–Horioka Puzzle

In this paper, we develop a very flexible and comprehensive state-space framework for modeling time series data. Our research extends the simple canonical model usually employed in the literature, into a panel-data time-varying parameters framework, combining fixed (both common and country-specific) and varying components. Under some specific circumstances, this setting can be understood as a mean-reverting panel time-series model, where the mean fixed parameter can, at the same time, include a deterministic trend. Regarding the transition equation, our structure allows for the estimation of different autoregressive alternatives, and include control instruments, whose coefficients can be set-up either common or idiosyncratic. This is particularly useful to detect asymmetries among individuals (countries) to common shocks. We develop a GAUSS code that allows for the introduction of restrictions regarding the variances of both the transition and measurement equations. Finally, we use this empirical framework to test for the Feldstein–Horioka puzzle in a 17-country panel. The results show its usefulness for solving complexities in macroeconomic empirical research.


Introduction
In this paper, we develop a fully-fledged state-space framework for modelling panel time series. Since its origin in Systems Theory, and famous early applications in the Apollo and Polaris aerospace program, state-space models have been extensively used in Economics and Finance literature, along with their estimation through the popular Kalman filter algorithm (Kalman 1960;Kalman and Bucy 1961). State-space models can be usefully employed to address macroeconomic problems, either because some variables are unobservable, or just because they contain coefficients that are inherently time-varying, making economic relationships potentially unstable.
During the last decades, state-space modelling has been increasingly used in Economics, proving to be a very useful tool providing simple representations of relatively complex problems. Nevertheless there are very few contributions that discuss how those models can be used in practice and why they are such a powerful tool for practitioners. On the contrary, most of the empirical research in the area of Economics and Finance that employs a state-space framework has restricted the general model by introducing simplifying assumptions to the general framework (i.e., assuming randomwalk type state equations, no stochastic control instruments, restrictions on the variance of measurement errors, etc.).
In this paper we have chosen a different approach. Instead of simplifying the canonical model, our research contributes to this strand of the literature by extending the simplest framework into a panel-data time-varying structure, that combines both fixed and varying parameters in the measurement equation. Under some specific circumstances (see, for example Hamilton 1994a), this setting can be understood as a mean-reverting panel time-series model. We depart from James Hamilton's univariate code in several respects. 1 We have programmed a new GAUSS code extending the seminal one to admit the introduction of restrictions regarding the variances of both the transition and measurement equations. The main features of our specification are as follows. First, our empirical model is setup with the addition of a potential deterministic trend in the fixed parameter. Second, the panel modelization has been enriched allowing for the inclusion of either common and country-specific fixed parameters, and a common unobservable factor with idiosyncratic fixed parameters in the measurement equation. Third, regarding the transition equation, our structure enables the estimation of different autoregressive alternatives, where control instruments are also granted. Besides, their coefficients can be set-up either common or idiosyncratic, what is particularly interesting for detecting asymmetries among individuals (countries) to common shocks. Finally, as a by-product, and in order to check the adequacy of this flexible framework to solve complexities in macroeconomic empirical research, we conduct an empirical application to the so-called Feldstein-Horioka (FH hereafter) puzzle, that is, the "unexpected" correlation of domestic investment to domestic savings in a context of apparent deregulation and liberalization of international financial markets. Hence we estimate the model for a 17-country panel including both 12 Eurozone member countries and 5 non-member industrialized countries for the period 1970-2016. The main advantage of our empirical approach is that it captures the dynamics of the FH coefficient drifting in parallel with increased financial integration in OECD countries. Global risk and country size are relevant elements to "un-puzzle" the savings-investment correlation. The inclusion of time-varying estimates reveals significant heterogeneity across EMU countries and shows how asymmetric shocks, both idiosyncratic or common, affect the relationship between domestic investment and saving. Our application to the FH puzzle extends the existing literature in several directions. First, we address the FH puzzle (by departing from both the customary cross-country averaging or single-parameter time series estimation) and introduce a time-varying-parameter (TVP) model to uncover the potential dynamic evolution of the FH coefficient. Second, we also contribute to the literature by trying to ascertain the role of size and global risk aversion measures on the savings-investment regression, allowing for different time-varying responses across countries after the Great Recession.
The rest of the article is organized as follows: Sect. 2 introduces the state-space framework; Sect. 3 adapts it into a time-varying parameters model and proposes a strategy for its application in a multi-country panel; Sect. 4 presents the empirical application for the Feldstein-Horioka puzzle, introduces the dataset and formulates the model in the state-space framework; Sect. 5 presents and discusses the results, and Sect. 6 concludes.

State-Space Models
The state-space representation of a linear system models the dynamics of an observed (n × 1) vector y t , in terms of a possibly unobserved (or state) (r × 1) vector ξ t . 2 The Kalman Filter is, essentially, an algorithm for generating minimum mean square error forecasts in a state-space model. In state-space time-series models, (each of) the unobserved components that determine the time-series behaviour has a stochastic nature, which is governed by a linear stochastic difference equation (or state-transition equation): ξ t+1 where F denotes an (r × r ) state-transition matrix for the unobserved component, ξ t , and Z t is a (s × 1) vector containing any control inputs, either deterministic (drift and/or deterministic trend) or stochastic. If present, control inputs affect the state through the (r × s) control input matrix, B, which applies the effect of each control input parameter in the vector on the state vector. The introduction of stochastic control inputs is common practice in the literature on control engineering where this concept was coined. Basically, the idea is to simulate the effect of changes in the control variable on a system, namely the state vector. 3 Despite their many potential uses, empirical economic research generally has employed simple state-transition equations, where the unobserved component evolves as a random walk process and no control inputs are present.
Finally, ν t represents the (r × 1) vector of random variables containing the process noise terms for each parameter in the state vector and is assumed to be i.i.d.
and variance-covariance equal to, The measurement or observation equation models the dynamics of the observable variables that are assumed to be related to the state vector, providing information on ξ t . It takes the following general form: where y t represents an (n × 1) vector of variables that are observed at date t, x t represents a (k ×1) vector of exogenous determinants, their coefficients being included in the (k × n) matrix A. H is an (r × n) matrix of coefficients for the (r × 1) vector of unobserved components ξ t .
The measurement error, w t is an (n x 1) vector assumed to be i.i.d. N (0, R), independent of ξ t and ν t and for t = 1, 2, . . ., where and variance covariance equal to, Finally, (7) represents the initial condition of the system: Writing a model in state-space form means imposing certain values (such as zero or one) on some of the elements of F, Q, B, A, H and R, and interpreting the other elements as particular parameters of interest. Typically we will not know the values of these other elements, but need to estimate them on the basis of observation of (y 1 , y 2 , . . . , y T ) and (x 1 , x 2 , . . . , x T ). In its basic form, the model assumes that the values of F, (and even B), Q, A, H and R are all fixed and known, but (some of them) could be functions of time.
This kind of models is particularly useful for measuring expectations that cannot be observed directly. If these expectations are formed rationally, there are certain implications for the time-series behaviour of the observed series that can help to modelize them.
According to Harvey (1989), it does not exist a unique representation of a statespace formulation of a model. That is why the state variables obtained internally in the system have to be specified according to the nature of the problem with the ultimate goal of containing all the information necessary to determine the behaviour of the period-to-period system with the minimum number of parameters.

A Time-Varying Parameters State-Space Framework for Panel Data
In this section we explain in detail different alternatives to estimate time-varying coefficient regression models and their implications, going from simpler specifications to more complex ones that have been embedded in our Gauss code. 4

Time-Varying Coefficient Regression Models
Unlike standard linear econometrics, the time-varying parameters approach owes its origin to the idea that there may exist an underlying changing economy, where some shocks lead to permanent changes in the driving parameters of the econometric models. Swamy and Tavlas (2003) discuss how this technique, particularly in the "second generation models" that include a set of 'driving' variables, are able to overcome a wide range of model misspecification and produce consistent estimates of the parameters. All in all, any econometric model is almost certainly a misspecified version of truth, and this misspecification may take the form of omitted variables, endogeneity problems, measurement errors, and incorrect functional form. In fact, as stated by Granger (2008), the true model tends to be highly non-linear.
Although an important number of econometric time-varying parameters panel data models have been proposed in the past, 5 these models have not become popular in empirical research mostly because of computational difficulties. Wells (1996) distinguishes four different categories of models: Ordinary Least Squares (OLS), random coefficients (RCF), random walks (RW) and mean reverting (MRV) models. In traditional OLS, the regression coefficients remain constant for all periods: 4 Parameter instability in dynamic econometric models has often been integrated in the form of structural change models (see Perron 1989). Markov-switching models, as in Hamilton (1989), constitute a less ambitious approach, despite the advantage of easily allowing the parameters to change gradually over time.
The simplest TVP framework can be estimated by rolling regressions, while the Kalman filter is the most popular framework due to its simplicity. Our proposal, compared to the other alternatives, has the advantage of implementing a smooth time-varying transition overtime instead of discreet changes. 5 See Rosenberg (1973), Hsiao (1974), Hsiao (1975), Ck and Zellner (1993), Swamy and Mehta (1977), Zellner et al. (1991) among others. Hildreth and Houck (1968) and Swamy (1970) proposed Random Coefficient (RCF) models, 6 whose coefficients fluctuate randomly about a mean value as follows: where ν t is a random variable following a Gaussian distribution with zero mean and fixed variance. The third of the four models listed above is the Random Walk (RW) model, first introduced by Rubin (1950) and Rao (1965), that can be written as: Finally, the Mean Reverting (MRV) model was proposed by Bos and Newbold (1984) as: where ν t is a gaussian error term with a zero mean and a fixed variance, forcing the parameters to gradually return to its mean.
The mean-reverting model represents a general 7 representation of the parameters that nests the rest: the OLS model is derived when var(ν t = 0); when Φ = 1 we obtain a random walk (RW) model for the varying parameters; and when Φ = 0 we have a random coefficient model (RCF) where the coefficient fluctuates randomly about the mean value. If Φ < 1 the model converges (even if convergence is slow).
For convenience, the MRV model can be rewritten as: that focuses on the time-transition of the varying component of the parameter.

Time-Varying State-Space Models
The time-varying coefficient regression models constitute an interesting application of the state-space representation, as: where A represents a matrix of fixed parametersβ. Compared to the general model where the elements of the matrices F, Q, A, H and R are treated as constants, in this model H depends on the observed regressors, as [H (x t )] = x t . As stated in Hamilton (1994a), assuming that the eigenvalues of F in (1) are all inside the unit circle, the coefficients can be interpreted as the average or steady-state coefficient vector, and the measurement equation can be written as follows: where the vector of unobserved coefficients, ξ t = β t −β , evolves along time according to the expression: Equation (15) represents a simple transition equation to be estimated through the Kalman Filter, where β t −β = ξ t is the unobserved component of our time-varying parameter, while the fixed component is also included at the measurement equation asβ.

A Panel Time-Varying State-Space Extension
In this subsection, we extend the previous time-varying parameters model to a panel setting. Our main goal is to explore the use of the state-space modelisation and the Kalman filter algorithm as an effective method for combining time series in a panel. This flexible structure allows the model specification to be affected by different potential sources of cross-section heterogeneity. This approach can be a superior alternative to the estimation of the model in unstacked form, commonly employed when there is a small number of cross-sections.
The general model can be written as follows: or in matrix form: representing the measurement equation for a y t ∈ R n vector containing the dependent variable for a panel of countries. x t ∈ R k×n is a vector of k exogenous variables, including either (or both) stochastic and deterministic components. The unobserved vector ξ t ∈ R r influences the dependent variable through a varying H (x t ) (n × r ) matrix, whose simplest form is H (x t ) = x t . Finally, w t ∈ R n represents the (n × 1) vector of N measurement errors.
The specification of the model in Eq. (17) relies on a MRV-type modelisation of the measurement equation, which allows for the inclusion of fixed parameters. These parameters can be defined either as a common parameter for all the agents in the panel,β, or country-specific coefficients,β i . The model also includes timevarying parameters (ξ t ) for some of the regressors, that eventually can be interpreted as deviations from the mean parameters ( β it −β i = ξ t ).
The measurement equation for each i-th element in the t-th period y i,t in the vector of the dependent variable, can be expressed as follows: In Eq. (18), the measurement equation for each of the individuals (countries) included in the panel allows for the potential inclusion of both fixed (mean) and/or time-varying parameters for the regressors included in the model to be estimated. For the fixed-parameters case different partitions can be considered. First, one can choose a subset of ksnum = ksmax − ksmin + 1 regressors (x ksmin , . . . , x ks , . . . , x ksmax ) in the interval [0, k] , whose coefficients will be modeled as country-specific or idiosyncratic. A second subset of kcnum = kcmax − kcmin + 1 regressors (x kcmin , . . . , x kc , . . . , x kcmax ), also defined in the interval [0, k] , is also possible, but related in this case to the dependent vector through a common coefficient for all the countries included in the panel. Last, the varying parameters are associated to a third subset of kvnum = kvmax − kvmin + 1 regressors (x kvmin , . . . , x kv , . . . , x kvmax ), also belonging to the interval [0, k] , Moreover, we can also consider the possibility of the fixed parameters being affected by a deterministic time trend: Equation (19) presents a more general panel representation of the measurement equation. This representation includes a deterministic time trend accompanying (or not) the fixed parameters explained above, and modeled either idiosyncratic δ ks,i · t or common to all the countries δ kc,i · t .
The panel specification presented in Eqs. (18) and (19) can also be enriched to allow for the potential inclusion, as in Broto and Perez-Quiros (2015), of a dynamic common-factor in the measurement equation driving the dependent variable vector, y i,t . This common factor is modelled simply as an additional unobserved state in the state-vector (whose number of rows ups now until n * kv+1), that enters each country's measurement equation with a country-specific loading parameter, h i . 8 Regarding the state-transition Equation, the ξ t ∈ R r vector of unobserved coefficients evolves according to the following expression, In Eq. (20), the vector of unobserved components ξ t follows an autoregressive process where F denotes an (r × r ) state-transition matrix, while Z i,t is the vector containing any control inputs affecting the state through the control input matrix B, which applies the effect of each control input on the state vector. These control variables are frequently employed in Engineering but are not so commonly applied to state-space models in Economics. Their use could be interpreted as the "coefficient-drivers" of the second-generation TVP models, described in Swamy and Tavlas (2003) and related work. As stated in Gourieroux and Monfort (1997), with the introduction of an input in the "transition equation" or in the "measurement equation", all the formulae of the filter remain valid with the exception of the introduction of the variable in the update equation. Finally, ν t represents the (r × 1) vector containing the process noise terms for each parameter in the state vector and is assumed to be i.i.d. N (0, Q).
Each one of the (kv × n) first components of ξ t+1 are driven by the following expression: where every unobserved component follows an autoregressive process and the coefficients φ kv,i are to be estimated. The unobserved component is also influenced by the evolution of a vector containing s observed variables, z t . Input controls in the state transition equation can be included as common/specific for all countries in the panel and/or common/specific for any control variables considered. Thus, a subset of jsnum = jsmax − jsmin + 1 control inputs z jsmin , . . . , z js , . . . , z jsmax in the interval [0, s] , whose coefficientsμ js,i are modeled as country-specific or idiosyncratic. Similarly, for a second subset of jcnum = jcmax − jcmin + 1 regressors z jcmin , . . . , z jc , . . . , z jcmax , also defined in the interval [0, s], the coefficientμ jc is estimated as common for all the countries included in the panel. This specification is particularly helpful when economic theory suggests asymmetries among countries from the impact of any particular variable (i.e. while country size should exhibit a common parameter for all countries, global risk aversion should affect differently to the attractiveness of a country for investments). If a dynamic common factor is introduced in the model, its transition equation can be conveniently restricted, so it does not require the inclusion of potentially idiosyncratic control variables.
The autoregressive parameter in the state-transition equation is estimated, in contrast to Hamilton (1994a), where it is restricted to a random walk. Following Hamilton (1994a), if the eigenvalues of F remain inside the unit circle, then the system is stable and the vector process defined by (20) is stationary. In this case, the inclusion of both fixed and varying parameters for the regressors can be interpreted as a mean-reverting model. The fixed parameter, either idiosyncratic (β i ) or common (β) should be inter-preted as the average or steady-state coefficient vector, and the varying parameter as the deviation from this mean in a mean-reverting framework, where: Finally, the previous specification can be adapted to introduce multiple restrictions on the variances of the measurement and transition equations, i.e. by assuming measurement error to be null or of identical variance size for all countries, or defining the signal-to-noise ratio (ratio between the two variances) 9 . Further restrictions can also be introduced on any of the components of the hyper-parameters vector.

A Brief Review of the Literature on the FH Puzzle
Over the recent decades, global capital markets have witnessed an unprecedented expansion of international financial transactions. This process has been boosted by advances in information and communication technologies (ICT) and has been accompanied by a substantial financial market deregulation and a generalized abolishment of capital controls in virtually all countries. 10 As a result, if capital is mobile domestic investment will not be restricted by domestic saving and, therefore, the correlation between investment and saving will be low. However, since the seminal papers by Feldstein and Horioka (1980) and Feldstein (1983), the evidence has pointed to the opposite direction: domestic investment closely tracking domestic saving. Feldstein and Horioka (1980), proposed running a simple regression as a simple test to measure capital mobility. They estimated the regression of gross domestic investment on gross domestic savings, both expressed in terms of GDP, for the period 1960-1974, of the form: where S is gross domestic savings (GDP minus private and government consumption), I is gross domestic investment, both in terms of gross domestic product Y , and nominal terms. In this framework, the constant term, α, captures the impact of the common shocks that affect average savings and investment rates all over the world. The coefficient β (also known as the "saving-retention coefficient") measures the degree to which domestic saving and investment ratios to GDP are correlated, for a panel of countries. Surprisingly, Feldstein and Horioka (1980) found a very high saving-investment coefficient when they tested this relationship for 16 OECD countries for the period 1960-1974. To handle the cyclical endogeneity of savings and investment rates, their research took the long-period averages of these rates, estimating the coefficients for three subperiods (1960-1964, 1965-1969 and 1970-1974). These findings were confirmed by Feldstein (1983) and Feldstein and Bacchetta (1991), who extended the sample period up to 1986 and concluded that capital mobility was low at that time.
In order to justify these findings Feldstein and Horioka (1980) argue that a number of barriers, such as exchange rate and sovereignty risks, legal difficulties, transactions costs, and information limitations remain. Therefore, capital mobility would be impaired and domestic saving would still be a very important source of financing for domestic investment. In the end, these early papers support the lack of full capital mobility and the existence of constraints to international capital mobility, as they interpret the saving-retention coefficient as an indicator of the degree of international capital mobility.
There have been numerous attempts to solve what became the Feldstein-Horioka puzzle, looking for evidence of a decreasing coefficient.
However, the presence of this high correlation between domestic savings and investment remained stubbornly high in the decades following the publication of FH's paper (using different samples, country coverage and estimation methods), even though interest parity studies and casual empiricism have revealed a very high degree of international capital mobility (Camarero et al. 2009(Camarero et al. , 2010. Therefore, this empirical finding constituted a puzzle and has produced an extensive research in an attempt to solve it either looking for alternative interpretations of the saving-retention coefficient away from a financial integration indicator or challenging the result on methodological grounds. 11 Relying on the previous objections, the empirical literature has tried to solve the puzzle using improved econometric techniques, mainly time series and panel data methodologies. However, the evidence using both time series and panels tend to be non-conclusive. Westerlund (2006) shows that once we account for structural breaks in the panel, we find more evidence of cointegration between saving and investment. 12 His findings show a decreasing saving-retention coefficient for the EU countries. This approach assumed abrupt structural breaks. However, it may seem unlikely that a structural break could be so abrupt, and it might seem reasonable to allow for a period of time for the structural change to take effect. Indeed, given the menu cost, the effect of the technological progress and policy switch might have time lags. Accordingly, we think that to capture this effect it is more realistic to let the parameter in the FH regression vary over time. Indeed, there is a recent and growing literature that focuses on this kind of statistical approach that we follow in the present research. Telatar et al. (2007) argue that international capital mobility is a time-varying phenomenon, leading to a FH model that cannot be represented by one fixed coefficient. Gomes et al. (2008) estimate a time varying savings retention parameter for three Latin American countries. More recently, Ma and Li (2016) estimate a time-varying coefficient cointegration model for developed economies, while Khan (2017) provides time-varying estimates for OECD countries through Kalman filtering. Following this same approach, in the next section we assume that the saving retention coefficient may vary smoothly over time.

A Time-Varying Model for the Feldstein-Horioka Puzzle
We claim that the approach adopted in this paper permits to account for several factors that have been considered crucial in the theoretical and empirical literature to explain the FH puzzle. First of all, we provide a very flexible testing framework for both the measurement and the transitions equations. Secondly, in this section we present a detailed justification of the role played by two additional control variables we include in the state equation, namely a measure of country-size and a measure of risk.
Concerning the need of a flexible testable framework, recently, Giannone and Lenza (2010) and Lenza (2018) have put forward the importance of using general equilibrium to explain the FH findings. 13 Since global shocks are acknowledged to be an important driving force of the world business cycle, general equilibrium effects should be able to reconcile theory and evidence. However, Giannone and Lenza (2010) claim that some previous attempts to find a decreasing saving-investment correlation when controlling for global shocks failed because they assumed homogeneity across countries. 14 It is important to bear in mind that if global shocks have heterogeneous (asymmetric) effects, they can create imbalances on the world capital market. Giannone and Lenza (2010) propose the use of factor-augmented panel regressions, a new methodology, to isolate idiosyncratic sources of fluctuations. They improve on existing studies since countries are allowed to react with specific sign and magnitude to global shocks. Unlike previous studies that reached biased estimations of the saving-retention coefficient, they find that allowing for a heterogeneous propagation mechanism of global shocks yields dropping saving-retention coefficients from the 1980s. According to this, our framework can be also suitable to assess the evolution of the FH retention coefficient. In the present paper, as in Paniagua et al. (2017), we also account for both idiosyncratic and global shocks, allowing the latter to have asymmetric effects. Ito et al. (2014) and related literature apply the TV-VAR, time-varying autoregressive (TV-AR), and timevarying vector error correction (TV-VEC) models to stock prices and exchange rates, using a regression model (instead of the Kalman filter). They show that these other time varying alternatives produce equivalent estimates.
As for the control variables, a strand of the literature stresses that country size is one of the potential determinants of the saving retention coefficient. Feldstein and Horioka (1980) claimed that, as a country gets larger, it tends to behave like a closed 13 The predictions of the partial equilibrium inter-temporal theory of the current account refers to idiosyncratic components (country-specific or regional shocks) of saving and investment rates that, as they do not affect all countries similarly, are unlikely to generate imbalances in the world capital market. 14 Examples of this are Glick and Rogoff (1995) and Ventura (2003). economy, attributing the high saving-correlation to a country size effect. Therefore, if we only include large industrialized countries in our sample, that may cause an upward bias on the saving-retention coefficient, as savings shocks hitting the large economies are expected to affect the world interest rate and hence their domestic investment. On one side, Harberger (1980) shows that FH conclusions may be influenced by size-ofcountry considerations. 15 In the same vein Murphy (1984), argues that the estimates of an equation where all the countries are treated equally may yield biased coefficients if the ability of a country to influence conditions in the world capital market depends on its size. Ho (2003) has also found that the saving-retention coefficient increased with the size of the country using threshold models. Several measures of size have been used in the empirical literature, such as average saving, investment, and GDP shares in the respective totals. In our case we have used the share of each of the countries analyzed in world GDP as a proxy for country-size.
A second important control variable that we include in our specification is the global risk. After the recent financial crisis, the literature on international capital markets shifted the attention from idiosyncratic factors towards a common factor, which would reflect a change in investors' risk aversion. Risk aversion is associated with the willingness of investors to take risks (the so-called "risk appetite"). As investors continuously adjust their risk-return preference function, even if the "amount of risk" embedded in a security remains unchanged, the risk premium may vary depending on the "price of risk". From that perspective, variations in global risk-aversion might have also contributed to increase distrust and perceived risk (Litterman and Scheinkman 1991). In times of high uncertainty, investors are supposed to be more risk-averse. In practice, shifts in investors' "risk appetite" are not directly observable and the impact on global risk repricing should be assessed through its interaction with the risk-content of a particular asset, which could also be time-varying.
As in Bernoth and Erdogan (2012), we use the yield spread between low grade US corporate bonds (BAA) and the 10-year Treasury bonds as an empirical proxy for this overall investors' risk attitude ("BAAS"). This variable has been obtained from the Federal Reserve Economic Database (FRED), provided by the Federal Reserve Bank of St. Louis. 16 Finally, concerning the source for the rest of the database, we have obtained annual savings and investment data (relative to GDP) from 1970 to 2016 for 17 countries, 12 from the original Eurozone (Luxembourg, Austria, Belgium, Finland, France, Germany, Greece, Ireland, Italy, Netherlands, Portugal and Spain) and 5 other large industrialized or emerging economies (Canada, China, Japan, United Kingdom and USA). The data has been extracted from the World Development Indicators (WDI) 15 Harberger notes that the difference between gross domestic saving and investment to GDP has greater variability and larger absolute value for small countries than for large ones. 16 An alternative variable for global risk aversion is the CBOE Volatility Index, known by its ticker symbol VIX; this variable was not available for the whole period. Note that CBOE VIX measures the stock market's expectation of volatility implied by S&P 500 index options, calculated and published by the Chicago Board Options Exchange. Moreover, although the literature finds a relevant role for both proxies, while BAA spread measures risk appetite, a variation in implied volatility on a market may stem from a change in the quantity of risk on this market and not necessarily from a change in the investor's risk aversion.
database. 17 The graphs for the two variables for each of the countries analyzed is presented in Fig. 1.
After these qualifications, we present the equations that we effectively estimate in this paper. Our time-varying parameters specification of the investment ratio to GDP (I /Y ) on savings ratio to GDP (S/Y ), is represented by the equation: where inv i,t is the investment to GDP ratio, sav i,t is the saving to GDP ratio and, in addition to the fixed (country-specific) savings retention coefficient, β 1i , ξ i,t stands for the varying component of the sav i,t parameter. In a mean-reverting framework, this varying component can be interpreted as the deviation from the saving-retention mean parameter, β 1i,t −β 1i . The model includes also a deterministic trend in the parameter variation δ i · t, so that the varying parameter β 1i,t =β 1i + δ i · t + ξ i,t is reverting towards a mean parameter potentially including a deterministic trend as well,β 1i + δ i · t. Hence, our state-space model incorporates heterogeneity by allowing for both country-specific intercepts and slopes. Then, the model is estimated by maximum likelihood using the Kalman Filter algorithm, where each of the elements of the unobserved vector, ξ i,t , follows a stochastic process such as: where υ t ∼ N (0, Q) and the transition of the unobserved vector includes, in addition of the autoregressive component, a (common parameter, μ 1 ) that corresponds to the country-size indicator, with si ze = gdp worldgd p , that is, the relative size of each country in terms of world's gdp. The second control instrument, a global risk aversion measure, in our case the BAA spread, is denoted baas i,t and assumed to affect the varying saving-retention through a country-specific parameter, μ 2i .

Results and Discussion
In this section we estimate the empirical specification described in Sect. 4 using monthly data for the period 1970 to 2016 in a panel of 17 countries. Prior to the estimation of our model using TVP, we analyze the univariate properties of the series using panel unit root tests, allowing for both cross-country dependence and structural breaks. 17 The data has been obtained from https://data.worldbank.org/. Gross fixed capital formation (formerly gross domestic fixed investment) includes land improvements (fences, ditches, drains, and so on); plant, machinery, and equipment purchases; and the construction of roads, railways, and the like, including schools, offices, hospitals, private residential dwellings, and commercial and industrial buildings. According to the 1993 SNA, net acquisitions of valuables are also considered capital formation. Gross domestic savings are calculated as GDP less final consumption expenditure (total consumption). As in the literature, both variables have been expressed as a percentage of GDP.

Univariate Properties of the Data
Regarding the analysis of the order of integration of the variables included in the estimated model, we have considered the existence of potential and unknown structural changes. This issue is non-trivial given that unit root tests can lead to misleading conclusions if the presence of structural breaks is not accounted for, as Perron (1989) argued in his seminal paper.
As most of the variables (with the exception of the BAAS spread, baas t ) have been defined at country-level, we can construct a panel consisting of the different individuals and test for unit roots using Bai and Carrion-i Silvestre (2009) panel unit root test. In the case of baas t , we apply the univariate unit root tests proposed by Carrion-i Silvestre et al. (2009). Both, the panel and the univariate tests, allow for multiple and unknown structural breaks. Bai and Carrion-i Silvestre (2009) propose a set of panel unit root statistics that pool the modified Sargan-Bhargava (hereafter MSB) tests (Sargan and Bhargava 1983) for individual series, taking into account the possible existence of multiple structural breaks 18 and cross-section dependence modelled as a common factors model. 19 The common factors may be non-stationary, stationary or a combination of both. The number of common factors is estimated using the panel Bayesian information criterion proposed by Bai and Ng (2002).
The possible presence of non-stationary variables, as the potential structural changes, are non-trivial features. A non-stationary dependent variable, without further restrictions, could be most likely driven by a non-stationary state, such as one following a random walk. 20 In our case we do not assume that the transition equation follows a random walk, but let it be estimated as a component of the hyper-parameter vector. On the other hand, the presence of the structural breaks could, in fact, be an indication of a time-varying relationship for the model.
Concerning the panel unit root tests, we have allowed for a maximum of 4 breaks, determined using the Bai and Perron (1998) procedure. 21 In Table 1 we present the unit root results for the variables inv it , sav it and si ze it , estimated for our group of seventeen countries. The panel unit root tests have a constant and a trend and allow for structural changes in both (Model 2, trend break model). In the case of inv it the evidence points to a non-rejection of the unit root hypothesis and a similar outcome is found for si ze it , with the exception of the Z * test. As Bai and Perron (1998) suggest that the Z and P statistics have better small sample properties, we conclude that the latter variable is non-stationary. Regarding sav it , all the P-tests point toward stationarity at different levels of significance, but the null hypothesis of a unit root cannot be rejected using the Z-tests. Thus, the evidence is inconclusive in this case.
The position of the structural breaks found for each of the panel-dimension variables is reported in Table 2. Due to the length of the sample, the structural breaks are distributed along the whole period, although we can find some patterns. Spain, 18 Adapting Bai and Perron (2003) methodology to a panel data framework. 19 Following Bai and Ng (2004) and Moon and Perron (2004).   43.188 and 37.485, at 1%, 5% and 10% respectively). The number of common factors are estimated using the panel Bayesian information criterion proposed by bai2002determining. Z * , P * and P * m refer to the corresponding statistics obtained using the p-values of the simplified MSB statistics. The null hypothesis of a unit root is rejected at * p < 0.10, ** p < 0.05, *** p < 0.01 significance level, respectively, if the statistic is greater than the upper level Period 1970Period -2016 Luxembourg, the Netherlands and Belgium present instabilities at the end of the seventies in some of the variables, whereas the beginning of the nineties also concentrates some breaks in Luxembourg, the Netherlands and China. Concerning the financial crisis, Greece, Ireland, the Netherlands, Portugal, Spain and China seem hit by changes between 2006 and 2009. No break has been detected by the algorithm in the cases of Austria, Finland, France, Italy, the UK and the US.
Finally, for the variable baas it , we have used the GLS-based unit root test statistics proposed in Kim and Perron (2009) and extended in Carrion-i Silvestre et al. (2009). The advantage of this proposal is that it solves many of the problems of previous standard unit root tests with a structural breaks, 22 and allows for multiple breaks at an unknown time under both the null and alternative hypotheses. In this case, the unit root test results are mixed, as some of them reject the null hypothesis of a unit root whereas others do not, as shown in Table 3.
Therefore, although with some mixed results, the null hypothesis of a unit root (with structural breaks) cannot be rejected for all the series at the 5% level of significance. Accordingly, we can conclude that the variables in Tables 2 and 3 are I(1) with structural breaks.

Panel TVP Model Estimation for the FH Savings-Retention Coefficient
In this subsection we present the results from the estimation of the mean-reverting time-varying savings-retention model with deterministic trend. For this purpose we have written a GAUSS code that extends the traditional approach by Hamilton (1994a) and includes all the elements of the model presented in Sect. 3.3. The results for the maximum likelihood estimation of the elements of the hyper-parameter vector, φ, are reported in Table 4. The first three columns display the "measurement equation"   1974 / 1979 /2007 *Denotes significance at p < 0.10, ** p < 0.05, and *** p < 0.01 significance level, respectively. The critical values were obtained from simulations using 1000 steps to approximate the Wiener process and 10,000 replications. Note that for the M S B and M P T tests the null hypothesis of a unit root is rejected in favour of stationarity when the estimated value of the statistic is smaller than the critical value results [see Eq. (25) above] , while the "state-update equation" is included in columns 4-6 [see Eq. (26)]. Also a horizontal line separates the Eurozone (EZ) countries from non-members. We should emphasize the importance of considering jointly the two equations.Whereas the first one (the measurement equation) would be equivalent to many OLS models reported in the empirical literature, the state-update equation is our main contribution, as it represents the behavior of the unobserved component. To ease the interpretation of the results, we should complement the estimated coefficients presented in the Table with the graphs of the time-varying parameters shown in Fig.  2. According to Hamilton (1994a), as it happens in our case, if φ in the state-update equation is lower than one, the varying coefficient can be considered a deviation from the mean (the parameter obtained in the measurement equation). The estimated value for the parameter is 0.843, highly persistent but lower than zero. This means that a random walk would have been an unsatisfactory modelization of the process. Our state-space equation also includes control variables, driving the evolution of the varying component of the parameter: first, si ze it , that represents the relative size of the country (defined as a common-parameter control instrument) and captures the fact that larger countries tend to be less open than small ones, and second, baas t , the BAA spread, a frequently employed measure of the global risk aversion, defined as a country-specific parameter control instrument.
The estimated parameters of the model are shown in Table 4, for both the measurement equation and the state-transition equations. In the case of the first one, we report the single-country estimated fixed-parameters, where β 0i is the intercept, and β 1i and δ i are the mean and time-trend parameters, respectively, for the saving-retention coefficient. In the state-transition equation, the autoregressive parameter φ is in the fourth column, while columns 5 and 6 show the output of the common coefficient for si ze it , denoted μ 1 and an idiosyncratic coefficient for the global risk variation μ 2i . In Fig.  2 we plot the time-varying coefficients for the savings-retention parameter, estimated for each country as a deviation from the mean-parameter, that includes a deterministic trend in some cases.
In addition to the persistent nature of the autoregressive coefficient, a second noteworthy result is the heterogeneity of the saving-retention coefficients across countries (see the second column of Table 4, under the heading β 1i ). Luxembourg is an obvious outlier in the sample (as the parameter is negative), which may be explained by its special economic status as an attractive financial center. The remaining countries have positive saving-retention parameters ranging from 0.213 in Italy to 0.804 for Greece and 0.834 for Spain. Regarding the deterministic time-trend included δ i , it happens to be significant and negative with a downward slope for Austria, Finland, Germany, Italy and Portugal. For Greece, the slope in the mean parameter is found to be significant but positive. This pattern can be clearly observed in Fig. 2.
When focusing on the temporal evolution of the coefficients, we find that si ze i has a positive effect in the state-transition equation, that represents the varying component ξ it of the FH coefficient. This finding confirms previous results by Harberger (1980) and Ho (2003), among others.
Concerning the global risk indicator, also in this case the results are heterogeneous. For the majority of the countries, the coefficient on baas it is significant and negative . These results can be capturing an increase of international capital mobility in the post-crisis period and this may be primarily due to investors' preference for safe haven assets. A similar argument may apply for China's positive coefficient, representing a redirection of Chinese capital to internal financial demands, once international markets were riskier after the crisis and foreign investors more difficult to find. The negative coefficient for baas it in the case of EU peripheral countries such as Portugal seems to contradict the negative effect on short-term international capital mobility due to the global financial crisis. This surprising finding seems to be the result of declining investment rates in front of high and stable savings rates accompanied by current account surpluses which turn into lowering temporally saving-retention coefficients. 23 These results are consistent with previous research, such as Bautista and Maveyraud-Tricoire (2007) for the Asian financial crisis, or Sachs et al. (1981) who found a negative relation between investment and the current account balance for 14 developed economies. Hence, those countries most heavily affected by the global financial crisis will suffer a reduction in output and in economic activity, but this would, in turn, produce current account surpluses due to the decline in imports.
Up to now, our findings show that the Feldstein-Horioka puzzle vanishes when we consider an extended time period and allow for time-varying coefficients. Let us focus on specific countries in the sample. In the case of Austria, a small EZ country, the saving-retention parameter is small (0.30) but positive and significant. Thus, for Austria, there would be (apparently) no puzzle. Moreover, the time-varying coefficient evolves around a decreasing trend that is crossed twice: at the beginning of the eighties and later, at the time of the financial crisis. During the majority of the sample the time-varying parameter has been positive but with a decreasing slope, meaning that domestic saving contributed more to domestic investment, whereas during the first half of the eighties it was negative. The negative trend of this parameter points to an increase of capital mobility during the sample and, therefore, a reduction in the total saving-retention parameter.
Germany's saving-retention parameter β 1i is higher (0.492) than the Austrian one, but it has followed a similar (decreasing) trend. The time-varying parameter, however, has remained below the mean during the majority of the period, what implies that also in Germany capital mobility has increased with the monetary union. The Netherlands can be also included in this group, as the parameter in the measurement equation is 0.340 and the time-varying one is also below the mean during the whole period. One of the most remarkable features of these three countries is that the financial crisis did not reduce their degree of capital openness.
Belgium and France have also common characteristics. Both have a relatively high saving-retention parameters (0.568 in Belgium and 0.396 in France). Also in both cases the control variables (risk and size) are significant. During the sample period, the time-varying parameter has fluctuated around the mean, but most of the time has remained below it. Their inclusion in the EZ did not have the same type of effect as in the previous group of countries: their degree of capital mobility remained unaltered at the end of the period and the time-varying parameter increased with the financial crisis. Spain could be also included in this group, although the value of the savings parameter (0.834) is one of the highest of the EZ countries. A common feature with France and Belgium is that also in Spain the time-varying parameter increased in the years previous to the crisis, when the financial bubble was growing, an effect that was corrected when the bubble burst.
We should pay special attention to the countries that were assisted during the crisis. In the case of Greece, the saving-retention parameter is one of the highest among EZ members (0.804). Looking at the graph, during the whole period domestic investment has been mostly possible using domestic savings, although the time-varying parameter has remained below the mean during the whole sample. The graph shows that, although the mean is 0.804, the trend has systematically added to the value of the parameter, that has remained around 1 since 2012, after the bail-out programme. As for Ireland, the value of the saving-retention parameter in the measurement equation is not significant. The most plausible explanation for this finding is that Ireland is a very small country compared with the size of its financial system. An attractor of FDI due to its low taxes, the country has very high capital mobility.
Concerning non-EZ countries, the majority of them are large, so that the measurement equation coefficient is also relatively large (0.48 in Japan, 0.476 in China, 0.621 for the US, or 0.59 in the UK). Canada is the exception, with a small mean parameter (0.226) and an increase in capital openness since the beginning of the nineties. However, after the international financial crisis the time-varying parameter stays above the mean, remaining more conservative and, therefore, more dependent on domestic savings. The larger countries show a very stable value of the saving-retention parameter, around 0.6-0.7, with the time-varying coefficient fluctuating around the mean and no clear pattern. Finally, although the β 1i parameter (that is, the mean of the savingretention) is also near 0.5 in Japan, the time-varying parameter has had a very clear negative coefficient during the whole sample, showing an increase in capital openness in this country. The behaviour of some non-EZ countries, such as the UK and the US, is in sharp contrast to the larger countries in the EZ (Germany and France, and even Italy) that are significantly more open to capital mobility, especially after the launching of EMU and despite the world financial crisis. Our main conclusion is that we can hardly talk about the FH puzzle in the EZ if we allow for structural breaks and time-varying parameters. The same applies to other small open countries, such as Canada or even Japan, where since the end of the nineties the time-varying parameter has remained below the mean as well.
Summing up, our findings suggest that there is substantial cross-country variation in the degree of capital mobility, thereby validating the random coefficients approach. Nevertheless, the results also show that, for most countries, the FH coefficients exhibit a noticeable decline over time, confirming an increase in capital market mobility and international openness. Moreover, the role of global risk aversion is also very different depending on the country, something that should be taken into account to explain the pattern of global capital reallocation. Finally, the effect of the financial crisis on capital openness has been lower or negligible in the large EZ countries in sharp contrast to non-members, as the US or the UK, and to smaller or intervened members, possibly due to the effects of bailouts.

Conclusions
The contributions of this paper are twofold. First, we propose a fully fledged state-space framework for modeling panel time series for which we have developed a GAUSS code. Second, we have applied this framework to the analysis of the F-H puzzle. The proposed empirical framework contributes to the literature by extending the simplest specification generally employed by practitioners in the fields of economics and finance, into a panel-data time-varying model, that combines fixed and time-varying parameters in the measurement equation. Under specific conditions (see, for example, Hamilton 1994a), this setting can be understood as a mean-reverting panel time-series model, or even a mean-reverting model around a deterministic trend. Moreover, the panel modelization has been enriched by the inclusion of either (or both) common and country-specific fixed parameters, as well as a common unobservable factor with idiosyncratic fixed parameters in the measurement equation.
Regarding the transition equation, our panel structure allows for the estimation of different specifications for the autoregressive component. Control instruments are also possible, that can also be either common or idiosyncratic. All these specifications have been written in a GAUSS code, which has been adapted from Hamilton's univariate code. The new code also allows for the introduction of restrictions in the variances of both the transition and the measurement equations.
Finally, this panel-TVP state-space framework is used to re-examine the so-called Feldstein-Horioka puzzle. This article adds to the literature by showing that timevarying models can be useful for the analysis of both non-linearities and country heterogeneity in panel data time series, as is the case of the relationship represented by the Feldstein-Horioka puzzle. We analyze the existence of a correlation between domestic saving and investment ratios to GDP, that should not exist if capital markets were highly integrated. In our case we test for this relation during the period 1970-2016 in a sample of 17 countries, 12 Eurozone members (Luxembourg, Austria, Belgium, Finland, France, Germany, Greece, Ireland, Italy, Netherlands, Portugal and Spain) and 5 large non-member countries (Canada, China, Japan, United Kingdom and USA).
The time-varying estimates of the FH equation show the variations in the degree of responsiveness along time. Our results reveal certain heterogeneity not only in the fixed but also in the varying components of the saving-retention parameter. Moreover, many of the relationships evolve around a deterministic trend, either positive or negative. We find that both country size and global risk aversion have a significant role to explain international capital allocation. In addition, the large and stable EZ countries have been more isolated from the international financial crisis than other large non-member economies. Our results indicate that the effects of bailouts have been non-negligible for countries under assistance programs.