Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: re: error in my loop


From   stephanie watkins <[email protected]>
To   [email protected]
Subject   Re: st: re: error in my loop
Date   Sat, 8 Dec 2007 14:54:27 -0800 (PST)

Hi Kim,

Thanks for the response! I am working with an
ecomonist who wants to difference out the effect of a
variable from all of the covariates...flexibility
controlling for a variable...before estimating their
parametric effect. He wrote the program and I just
can't get it to run. I will give your suggestion a
try. 


I did use plreg but that differences your variables
and runs the regression in one step. We want to have
access to the variables so we can do loess smoothing
and then create three dimensional graphs in R.

Thanks again,
Stephanie
--- Kit Baum <[email protected]> wrote:

> Not sure why Stephanie wants to do this, but...
> always a better idea to use Stata's time series
> operators when you can.
> 
> program drop _all
> program define mydiff
> syntax varlist [, order(real 5) ]
> di "Differencing `varlist' at order `order'"
> matrix D1  = (0.7071, -0.7071)
> matrix D2  = (0.8090, -0.5000, -0.3090)
> matrix D3  = (0.1942,  0.2809,  0.3832, -0.8582)
> matrix D4  = (0.2708, -0.0142,  0.6909, -0.4858,
> -0.4617)
> matrix D5  = (0.9064, -0.2600, -0.2167, -0.1774,
> -0.1420, -0.1103)
> matrix D = D`order'
> foreach var of varlist `varlist' {
> 	forv l=1/`order' {
>   		qui gen F`l'`var'=F`l'.`var'
>    	}
> 	mkmat `var' F*`var' , matrix(lags)
> 	drop F*`var'
> 	matrix F`var'=lags*D'
> 	svmat F`var'
> }
> end
> 
> sysuse auto,clear
> g t=_n
> tsset t
> mydiff price mpg
> desc F*
> 
> 
> 
> Kit Baum, Boston College Economics and DIW Berlin
> http://ideas.repec.org/e/pba1.html
> An Introduction to Modern Econometrics Using Stata:
> http://www.stata-press.com/books/imeus.html
> 
> 
> *
> *   For searches and help try:
> *  
> http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 



      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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