Hi there,
have repeatedly tried to center a variable at its mean, using the "mcenter" function (https://econpapers.repec.org/softwar...de/s445601.htm).
This centered variable should have a mean of 0, but somehow it does not.
I first recoded my variable (age) so that it is categorised by decades:
. sum age
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
age | 69,260 42.58625 16.27877 16 103
.
. recode age (16/19 = 1 "16-19") (20/29 = 2 "20-29") (30/39 = 3 "30-39") (40/49 = 4 "40-49") (50/59 = 5 "50-59") (60/69 = 6 "60-69") (7
> 0/79 = 7 "70-79") (80/89 = 8 "80-89") (90/99 = 9 "90-99") (100/103 = 10 "100-103"), generate(agedec)
(69260 differences between age and agedec)
I then wanted to center the variable "agedec" at their mean, hence creating a new variable "C_agedec" with a mean of 0. However, as you can see below, the mean is not exactly 0.
.
. mcenter agedec
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
C_agedec | 69,260 1.60e-09 1.656345 -2.813947 6.186052
Is this simply a rounding error or something more serious? I don't understand why this function (mcenter) is not exactly doing what it is supposed to do?
Many thanks in advance to anyone who may know what is going on here
0 Response to "Mcenter" function yields mean other than 0
Post a Comment