# Plot the contribution of each variable in a model

I'm looking to plot the contribution of each variable in a regression model incrementally, and display how that impacts accuracy and the residuals.

Given the model

$$y \sim \text{trend} + \text{Financial Planning} + \text{Investing} + \text{Business News} + \ldots$$

How can I create a plot similar to the one below in R? I saw this plot being used in the context of BSTS models.

• Although in its current form this question doesn't seem to be on-topic here as it is simply asking for a package recommendation - see our help center - I think you could bring this within the scope of our site by changing the question to "what is the name of this graph?" And perhaps adding something like "and what does it show?" or "how is it produced?" (meaning in the mathematical sense). I think once you know the mathematics of how the graph is produced, then creating one "by hand" on a computer isn't too hard. And you may get lucky with someone posting a package link anyway – Silverfish Sep 28 '16 at 18:06
• The fact it is no longer a "name me a package" question is an improvement! I think you could do with putting a more substantive question in - at the moment it's not obvious what you're actually asking, or what you'd hope to learn from an answer. – Silverfish Sep 28 '16 at 19:53

plot(decompose(AirPassengers,type="multiplicative"))