Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: theory reg vs. qreg


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: theory reg vs. qreg
Date   Mon, 29 Apr 2013 14:05:47 +0200

On Mon, Apr 29, 2013 at 1:49 PM, Kasal Roman wrote:
> but this is a fact, just try it with the simple "reg" command:
>
> A) Y1 = b1
> B) Y2 = a2*X + b2
>
> on the same data
> then MUST be:
>
> Y2 = mean(x)*X + b2 = b1 = Y1
>
> and I'd like to know if there is something like this possible with the
> "qreg" command.

Why would Y2 = Y1? I guess you mean that you are using the same
dependent/explained/left-hand-side/y-variable in both models,
otherwise it is a "fact" that your statement is wrong. If you want to
say that you are using the same variable you must make sure you give
them the same name throughout. If you are using the same dependent
variable your statement is trivial: a linear regression line moves by
definition through the point mean(x), mean(y).

Nick was asking for you to give exact Stata code. If you had done so,
we would not have to guess what you mean with Y1 and Y2 and whether
these are the same variables or not. You could for instance have told
us:

*------------------ begin example ------------------
sysuse auto, clear
reg price
reg price mpg
sum mpg, meanonly
di _b[_cons] + r(mean)*_b[mpg]
*------------------- end example -------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

In that case we would have seen exactly what you meant with Y1 and Y2,
i.e. they are both the variable price and thus better referred to as Y
or even better price.

-- Maarten

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index