[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: do file: sort by t, then give dfuller p-value, then corr?

Subject   st: do file: sort by t, then give dfuller p-value, then corr?
Date   Thu, 19 Nov 2009 15:44:12 -0500


I am looking to create a do file that will perform a good bit of
analysis at the bivariate level. Thanks to the code prepared by John Merryman and guidance from Nick Cox, I was able to achieve the first part of this task (sorting by t-score) (see code prepared by Mr. Merryman below).

Now, I would like to perform the same task, but drop all variables with a t-score below 1.70. I would then like to take this subset of data and perform a dfuller test, with an output being the p-value, filter out those with a p-value greater than 1% and finally perform a correlation matrix on the remaining variables.

Is this at all possible? Ideally, the output would keep the t-score, dfuller, and corr matrix, however, if the output was simply the corr matrix, having filtered for a t-score greater than 1.7, a dfuller pvalue of 1% or less, that would suffice as well.

Thank you for your consideration.

sysuse auto
tempname memhold
tempfile results
postfile `memhold' str12 name double t using `results', replace
foreach var  of varlist head-gear {
local name  "`var'"
         qui reg mpg `var'
         matrix e =e(b)
         matrix v = e(V)
         local t = abs(e[1,1]/sqrt(v[1,1]))
         post `memhold' ("`name'") (`t')
postclose `memhold'
use `results'
gsort -t

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index