2
$\begingroup$

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.

enter image description here

$\endgroup$
  • 2
    $\begingroup$ 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 $\endgroup$ – Silverfish Sep 28 '16 at 18:06
  • 2
    $\begingroup$ 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. $\endgroup$ – Silverfish Sep 28 '16 at 19:53
0
$\begingroup$

You can decompose a time series by trend seasonal and random.

But adding one feature after another as in your example seems to be a stackoverflow question.

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

enter image description here

$\endgroup$
  • 3
    $\begingroup$ More than decomposing the signal I'm looking to plot the contributions of the regressors in my model, as they are included one by one $\endgroup$ – germanium Sep 28 '16 at 17:04
  • $\begingroup$ @user1093107 then it is off topic here... $\endgroup$ – hxd1011 Sep 28 '16 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.