{"action":"opened","issue":{"url":"https://api.github.com/repos/dgrtwo/broom/issues/161","repository_url":"https://api.github.com/repos/dgrtwo/broom","labels_url":"https://api.github.com/repos/dgrtwo/broom/issues/161/labels{/name}","comments_url":"https://api.github.com/repos/dgrtwo/broom/issues/161/comments","events_url":"https://api.github.com/repos/dgrtwo/broom/issues/161/events","html_url":"https://github.com/dgrtwo/broom/issues/161","id":177251839,"number":161,"title":"broom for vars package on Vector Autoregressive Methods","user":{"login":"Diego-MX","id":9877444,"avatar_url":"https://avatars.githubusercontent.com/u/9877444?v=3","gravatar_id":"","url":"https://api.github.com/users/Diego-MX","html_url":"https://github.com/Diego-MX","followers_url":"https://api.github.com/users/Diego-MX/followers","following_url":"https://api.github.com/users/Diego-MX/following{/other_user}","gists_url":"https://api.github.com/users/Diego-MX/gists{/gist_id}","starred_url":"https://api.github.com/users/Diego-MX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Diego-MX/subscriptions","organizations_url":"https://api.github.com/users/Diego-MX/orgs","repos_url":"https://api.github.com/users/Diego-MX/repos","events_url":"https://api.github.com/users/Diego-MX/events{/privacy}","received_events_url":"https://api.github.com/users/Diego-MX/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-15T18:24:56Z","updated_at":"2016-09-15T18:24:56Z","closed_at":null,"body":"Thank you for such an awesome package.  I've been using it for the last month and really want to exploit all of its potential.  \r\nIn my last project I found an interesting example that I can't get my head around.  So I want to put it out there, and see if I can get help from the community.  \r\n\r\nThe package `vars` gives models for timed vectors.  Here are links for the [docs](https://cran.r-project.org/web/packages/vars/vars.pdf) and [vignette](https://cran.r-project.org/web/packages/vars/vignettes/vars.pdf).  \r\n\r\nThe function `VAR` estimates models for the time-vector $y_t$ as follows:\r\n$$ y_t = A_1 y_{t-1} + ... + A_p y_{t-p} $$\r\n\r\nBut since $y_t$ contains several variables, its structure gets complicated. \r\n\r\n```\r\n> library(vars)\r\n> data(\"Canada\")\r\n> p1ct <- VAR(Canada, p=1, type=\"both\")\r\n> class(p1ct)\r\n# \"varest\"\r\n> names(p1ct)\r\n# [1] \"varresult\"    \"datamat\"      \"y\"            \"type\"        \r\n   [5] \"p\"            \"K\"            \"obs\"          \"totobs\"      \r\n   [9] \"restrictions\" \"call\"  \r\n```\r\nThe models are actually stored in `varresult` with the names of the variables. \r\n```\r\n> class(p1ct$varresult$U)\r\n# lm\r\n> lm_U <- p1ct$varresult$U\r\n```\r\nFor which I extracted the corresponding models in order to tidy them... and glance and augment them.  \r\nThere are two issues here: \r\n1. The main issue is that I couldn't get the fitted values back from the _augmentation_. \r\n```\r\ncompare_fitted <- cbind( lm_U$fitted.values, augment(lm_U)$.fitted )\r\ncompare_fitted\r\n```\r\n\r\n2. The second issue is minor.  When looking up about `augment`, I found that you can append the original data giving it as an argument.  In these models, the original data lost two rows because of the lagged observations.  So I got an error when I tried to recover it.  I was still able to get around it with `left_join` and `right_join`.  \r\n\r\nIn any case, my question for the package developers (and community) is.  \r\na) How do the .fitted values get computed?  Would you know why I'm getting different ones?  \r\nb) If I were to request methods for such `varest` class, or even better wanted to contribute in its development, how can I go about and do that?  I have been using R for a while, and am looking forward to taking the next step in contributing to a package.  \r\n\r\nCheers. \r\n\r\n\r\n\r\n\r\n\r\n\r\n "}}
{"actor":{"display_login":"Diego-MX"}}