Closed jonathandroth closed 1 year ago
@jonathandroth It already does this.
Ah, well then I think the confusing thing is that the README only shows it with the matrices!
On Fri, Jun 16, 2023 at 3:26 PM Mauricio Caceres Bravo < @.***> wrote:
@jonathandroth https://github.com/jonathandroth It already does this.
— Reply to this email directly, view it on GitHub https://github.com/mcaceresb/stata-pretrends/issues/1#issuecomment-1595185706, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE6EXFE3QTOUHL3C3V5PGBDXLSXNNANCNFSM6AAAAAAZJUI5UU . You are receiving this because you were mentioned.Message ID: @.***>
@jonathandroth Right, but in my defense it does also say
By default, the package tries to use e(b) and e(V), which would be populated after most estimation commands
Fair enough! I created a PR to make the README more explicit about how to import results and what the output means.
On the topic of e(b) and e(V), I'm getting an error when using the pre()
and post()
options in conjunction with the beta()
and sigma()
options. Here's a MWE:
mata {
st_matrix("beta", PreTrendsExampleBeta())
st_matrix("sigma", PreTrendsExampleSigma())
}
pretrends power 0.5, b(beta) v(sigma) pre(1/3) post(4/7)
*This works
pretrends, numpre(3) b(beta) v(sigma) slope(`r(slope)')
*This produces an error
* Last estimation coefficients not found; please specify vector.
pretrends, e(beta) v(sigma) pre(1/3) post(4/7) slope(`r(slope)')
My guess is that the pre()
and post()
options only work if e(b)
and e(V)
are found? However, it seems like it would be useful to be able to provide beta
and sigma
from some estimation procedure (possibly including coefficients on control variables that are not of interest), and then to tell Stata which coefficients to use.
@jonathandroth They work in general, but e()
is not an option. To pass the coefficient vector you have to specify b(beta)
as in the previous call. This works
mata {
st_matrix("beta", PreTrendsExampleBeta())
st_matrix("sigma", PreTrendsExampleSigma())
}
pretrends power 0.5, b(beta) v(sigma) pre(1/3) post(4/7)
*This works
pretrends, numpre(3) b(beta) v(sigma) slope(`r(slope)')
* this also works
pretrends, b(beta) v(sigma) pre(1/3) post(4/7) slope(`r(slope)')
The reason e()
does not raise an error is because pretrend
captures all unrecognized options and passes them to coefplot
(a la R's ...
).
Ah got it, so I was being dumb.
Might be useful to add a check to see if the user passes v() but not b() or vice versa, and then throw a more intuitive error?
On Tue, Jun 20, 2023, 9:28 PM Mauricio Caceres Bravo < @.***> wrote:
@jonathandroth https://github.com/jonathandroth They work in general, but e() is not an option. To pass the coefficient vector you have to specify b(beta) as in the previous call. This works
mata { st_matrix("beta", PreTrendsExampleBeta()) st_matrix("sigma", PreTrendsExampleSigma()) } pretrends power 0.5, b(beta) v(sigma) pre(1/3) post(4/7)
*This works pretrends, numpre(3) b(beta) v(sigma) slope(`r(slope)')
- this also works pretrends, b(beta) v(sigma) pre(1/3) post(4/7) slope(`r(slope)')
The reason e() does not raise an error is because pretrend captures all unrecognized options and passes them to coefplot (a la R's ...).
— Reply to this email directly, view it on GitHub https://github.com/mcaceresb/stata-pretrends/issues/1#issuecomment-1599934233, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE6EXFAAYL2UWMJKSZ6H3GTXMJE2BANCNFSM6AAAAAAZJUI5UU . You are receiving this because you were mentioned.Message ID: @.***>
@jonathandroth Done in 67deb2e1f102c832e3bffdb87a04507792a8a057
Great, thanks!
On Thu, Jun 22, 2023 at 9:46 AM Mauricio Caceres Bravo < @.***> wrote:
@jonathandroth https://github.com/jonathandroth Done in 67deb2e https://github.com/mcaceresb/stata-pretrends/commit/67deb2e1f102c832e3bffdb87a04507792a8a057
— Reply to this email directly, view it on GitHub https://github.com/mcaceresb/stata-pretrends/issues/1#issuecomment-1602669080, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE6EXFEHV34DJMIF2TVKCHTXMRECJANCNFSM6AAAAAAZJUI5UU . You are receiving this because you were mentioned.Message ID: @.***>
@mcaceresb is it possible to import the variance matrix and original coefficients post-estimation in the same way as we do with stata-honestdid? I was told that providing the stata matrices is annoying