How to estimate the stochastic volatility as in Fernandez (2010)?

I’ve seen many papers talking about computing SV, like FV (2010) or BP (2014). I think its structure is like state space modelling. Is there any tips to estimate the SV of a time series? Thank you in advance.

Best,
Hui

Those SV processes are exogenous process that are separately estimated from the rest of the model. You can use a particle filter for this. We used

Thank you to Prof. Johannes.

Sorry that I’m still confused about modifying your sample code. Could I only plug in x for another series? Do I need to take log of it at first? And let the other blocks unchanged. Thank you.

Yes, you can modify the variable you want to estimate. Whether you log it or not depends on what you want to do.

I am trying to estimate a stochastic volatility shock for Total Factor Productivity (TFP) in a similar way to Fernandez-Villaverde and Rubio-Ramírez (2010) and Fernandez-Villaverde et al (2011).

A_t = \rho_{A}A_{t-1} + \sigma_t \epsilon_{A,t}

Where \epsilon_{A,t} is normally distributed with zero mean variance of 1.

From my understanding that A_t is the Solow residual. To find and calibrate \rho_{A} this can be estimated with an ARIMA(1,0,0) and time trend where \rho will be the coefficient and \sigma_t is the standard deviation of the residuals. Is this correct?

Regarding the stochastic volatility, how can I calibrate it?

\log (\sigma_t) = (1 - \rho_\sigma)\log \sigma + \rho_\sigma \log \sigma_{t-1}+ \eta u_t

Where \sigma_t is time varying stochastic volatility, \rho_\sigma is the autoregressive coefficient of the log standard deviation and \eta is
the standard deviation of the innovations to volatility.

Can someone please tell me how I can estimate the equation of the stochastic volatility? How can I have a series for \sigma_t ?

I should get values for these parameters based on the data and use them as priori in the particle filter right?

The point of the particle filter is exactly to estimate the SV process. Note that the priors in the particle filter are chosen before seeing the data. It’s not valid to use the data to obtain a prior.

1 Like

Thank you jpfeifer, but can you tell me how to choose the priors that I input in the Particle filtering to obtain posteriors of the shock parameters ?

I am looking at your code of particle filtering run_filter_and_smoother_AR1.m

I can see that rho_sigma is 0.9 and eta_sigma is 0.3 .
Are these values I have to write them by default and let the particle filter decide on the values for the SV?

Those are not the prior values, they are the starting values of the chain. Regardless of the starting value, your chain should converge to the ergodic distribution. The priors are in Particle_Filtering/evaluate_prior_AR1.m at master · JohannesPfeifer/Particle_Filtering · GitHub

2 Likes

Dear Pfeifer, I think I understand now the priors for the particle filter. However, what I do not understand the prior given to the parameter \sigma (sigma_bar as defined in your particle filter code) from my understanding in the paper of Fernandez-Villaverde etal (2011) that this is chosen to match the data.

Can you please tell me how is it calculated/derived?

  1. Strictly speaking, this approach is not valid.
  2. As the paper says: they compute the \sigma as if the process were a simple AR(1) without SV. So you simply estimate the AR(1) and compute the standard deviation of the residuals.
2 Likes

Hi Prof. Pfeifer,

Would you mind asking some basic questions?

  1. Shall I get the parameter estimates of the SV processes by running only the run_filter_and_smoother_AR1.m? Does this file also implement Tailored Randomized Block Metropolis-Hastings (TaRB-MH) algorithm? What I understood is that the run_filter_and_smoother_AR1.m file implements particle filter. It is used to estimate the SV process as you commented above. Why do we still need implementing TaRB-MH algorithm?

  2. After feeding the estimated parameters into the mod file can I solve the full model at first order and estimate it using RWMH algorithm? I am aware that in your “policy risk and business cycle” paper the SMM was used for full model estimation.

  3. The function named “PF_density_computation_function” is used as an input argument in the function “PF_basefunction_with_smoother_AR1”. However, I did not find any function titled “PF_density_computation_function” inside the particle filters folder. Would you kindly tell me about it?

  1. The particle filter is only a way to construct the likelihood. You still need to evaluate the posterior distribution. That’s what the Metropolis-Hastings algorithms are for.
  2. Yes, you can do that. But in that case, stochastic volatility would not play a role for identifying the parameters.
  3. The PF_density_computation_function is not a function name, but rather the function handle passed as an input. In PF_caller.m you have @PF_AR1_density as the input.
  1. Should this file “run_filter_and_smoother_AR1_TaRB” be run to estimate the parameters of the stochastic volatility (SV) model?
  2. If I only stoch_simul the model at 3rd order feeding the estimated parameters of the SV model will volatility of the shocks have any impact on the parameter identification?
  1. Yes.
  2. At third order, uncertainty shocks play a role. The tricky part is estimation at higher order. That’s why we used SMM.
  1. I ran the file “run_filter_and_smoother_AR1_TaRB” and encountered an error.
    There is an ‘ii’ in line 179 col 88, which I guess is not previously defined. I also see many 'ii’s after the line 179. Could you please take a look if time permits? May I ask you a couple of questions related to the estimation?
    a) Where are the estimated parameters stored?
    b) My model features both transitory and permanent productivity shocks having time-varying volatility. Should I do one-sided hp filter to decompose the original TFP process into its transitory and permanent components?
    c) The model also has a preference shock, which is unobservable. How can I deal with the stochastic volatility of an unobservable series?

  2. Given the complexity of estimation, I only want to solve the model at 3rd order after estimating the stochastic volatility model. Will it be enough to write a paper?

  1. I pushed a corrected version to the repository.
    a) the MCMC draws are stored under their name in line 192
    b) You as the model builder need to decide what type of decomposition you are aiming for.
    c) that is a problem. the two step procedure of estimating the exogenous processes separately from the rest of the model only works with observed series.
  2. I am not the referee who has to judge that. Ultimately, it’s about the research question and the answer you can give to it.

Thank you for your kind response.