The Bayesian estimation report of dynare has several graphs of ‘smoothed shocks’, I don’t understand what is the usage of having them. Could anyone explain? And is it always necessary to demean all the data by setting ‘prefilter=1’? Why do we have to demean?

Smoothed shocks correspond to smoothed state estimates. They are the best estimates for the shocks given the whole set of observations.

Let’s say your model contains a unit root and you have used a first difference filter, i.e. you estimate your model with data in first differences and a corresponding observation equation as in Smets/Wouters. If you don’t want to estimate the parameters responsible for the constant part of the observation equation, you can get rid of them by demeaning the data (this for example allows you to have discount factor in the model that is different from the one implied by the data). Demeaning is only necessary if it is required to match your data to the variable definitions in the model.