Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Difference of the commands "mean" and "center"

    Dear all,

    could someone maybe help me with this:

    What is the difference between the command
    Code:
    mean varlist [if] [in] [weight] [, options]
    and the command
    Code:
    center varlist [weight] [if exp] [in range]
    ?

  • #2
    -mean- is an estimation command while the user-written -center- (as the FAQ explains, you should tell us where you got this), is for generating new variables that are the centered (or standardized, optionally) version of old variables - since the help files would tell you this, I think I may be missing something in your question; if I did, please clarify

    added: forgot mention that I am referring to Ben Jann's -center- which is at SSC
    Last edited by Rich Goldstein; 12 Oct 2017, 05:53.

    Comment


    • #3
      Dear Rich:

      Thank you for your answer! Sorry, I haven´t clarified where I got the -center- command from.
      I was also referring to Ben Jann´s -center-

      Jann, B. (2004). center: Stata module to center (or standardize)
      variables. Available from
      http://ideas.repec.org/c/boc/bocode/s444102.html.

      I think I just didn´t get it right.

      If I have for example the following data:
      'lrgdp' is the log of real GDP per capita
      and I want to center the variable 'lrgdp', would that be the same as to sum up all the levels of 'lrgdp' and then divide them by the number of the variables (here: 20) ?

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input int year str11 country float lrgdp
      1870 "Australia"  2.627285
      1871 "Australia" 2.6345375
      1872 "Australia"  2.710996
      1873 "Australia"  2.786211
      1874 "Australia"  2.789214
      1875 "Australia"   2.86745
      1876 "Australia"  2.834332
      1877 "Australia"  2.841745
      1878 "Australia"  2.901711
      1879 "Australia"  2.884088
      1880 "Australia"  2.903649
      1881 "Australia"  2.943671
      1882 "Australia"  2.848141
      1883 "Australia" 2.9487655
      1884 "Australia" 2.9078684
      1885 "Australia"  2.936056
      1886 "Australia"  2.914104
      1887 "Australia" 2.9838395
      1888 "Australia" 2.9548414
      1889 "Australia" 3.0089836
      end
      format %ty year

      Thank you very much in advance!

      Comment


      • #4
        if I understand your question correctly (note that there are 20 observations not 20 variables), then no, it would not be the same; loosely speaking, -center- first does what you say and then subtracts that mean from each observation so that the mean of the centered variable is now 0

        Comment


        • #5
          Dear Rich:

          Thanks, that was exactly what I didn´t understand. Thank you very much!

          Comment


          • #6
            you're welcome

            Comment

            Working...
            X