Line for the server...
Agreed! But what is the beauty of your solution compared with the -mean-
command that was offered as a solution to Bastian`s problem in this thread?
They obviously give the same result...
********
sysuse auto, clear
reg mpg, nohe
mean mpg
********
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ronan Conroy
Sent: Tuesday, November 25, 2008 11:22 AM
To: [email protected]
Subject: Re: st: significance of mean and median
On 24 Nov 2008, at 11:55, Bastian Steingros wrote:
> After creating the descriptive statistics of my sample I want to
> show that the mean of a certain variable is statistically significant.
> For example the mean of var1 is 0,45. Now I want to show that the
> positive sign is significant.
A regression without any predictor variable is a constant-only model,
and the test for significance of the constant is a test that the
constant is zero.
. sysuse auto
(1978 Automobile Data)
. regress mpg
Source | SS df MS Number of obs
= 74
-------------+------------------------------ F( 0, 73)
= 0.00
Model | 0 0 . Prob > F
= .
Residual | 2443.45946 73 33.4720474 R-squared
= 0.0000
-------------+------------------------------ Adj R-squared
= 0.0000
Total | 2443.45946 73 33.4720474 Root MSE
= 5.7855
----------------------------------------------------------------------------
--
mpg | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------
+----------------------------------------------------------------
_cons | 21.2973 .6725511 31.67 0.000 19.9569
22.63769
----------------------------------------------------------------------------
--
The coefficient for the constant is the mean of the data (since the
mean is the statistic that minimises prediction error, when we define
prediction error as the squared difference between observed and
expected).
Similarly, quantile regression will test that the median is zero
. qreg mpg
Iteration 1: WLS sum of weighted deviations = 330.13202
Iteration 1: sum of abs. weighted deviations = 330
Iteration 2: sum of abs. weighted deviations = 328
Median regression Number of obs
= 74
Raw sum of deviations 328 (about 20)
Min sum of deviations 328 Pseudo R2
= 0.0000
----------------------------------------------------------------------------
--
mpg | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------
+----------------------------------------------------------------
_cons | 20 .7799751 25.64 0.000 18.44551
21.55449
----------------------------------------------------------------------------
--
the median being the statistic which minimises error, when we define
error as the absolute difference between the observed and expected.
Ronan Conroy
=================================
[email protected]
Royal College of Surgeons in Ireland
Epidemiology Department,
Beaux Lane House, Dublin 2, Ireland
+353 (0)1 402 2431
+353 (0)87 799 97 95
+353 (0)1 402 2764 (Fax - remember them?)
http://rcsi.academia.edu/RonanConroy
P Before printing, think about the environment
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/