Announcement

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

  • Correlation table for regression

    I am a new user of statistical software. I have a sample of 500 companies, however, for data missing regression was conducted on 350 samples. Now how I get the correlation table of variables for only these 350 samples. Thank you very much.

  • #2
    Welcome to the Stata Forum/ Statalust.

    Please read the FAQ, particularly the topic about sharing data/command/output.

    That said, I fear a table of correlations between 350 samples would be barely readable.


    Last edited by Marcos Almeida; 02 May 2018, 09:30.
    Best regards,

    Marcos

    Comment


    • #3
      I think Mohammad means a sample of 350, not 350 samples. (In many substantive fields, a sample is a chunk of something solid or fluid or gaseous, whether such chunks are enchanting or prosaic or disgusting.)

      After regress you just ask for

      Code:
      correlate ... if e(sample)
      where the dots are for your variable names.

      Comment


      • #4
        For insight:
        The purpose of 'if e(sample) restriction' please?
        The results do not seem to differ.
        Code:
        . sysuse auto
        (1978 Automobile Data)
        . regress mpg price weight length i.foreign
        
              Source |       SS           df       MS      Number of obs   =        74
        -------------+----------------------------------   F(4, 69)        =     35.58
               Model |   1645.6886         4  411.422151   Prob > F        =    0.0000
            Residual |  797.770856        69  11.5618965   R-squared       =    0.6735
        -------------+----------------------------------   Adj R-squared   =    0.6546
               Total |  2443.45946        73  33.4720474   Root MSE        =    3.4003
        
        ------------------------------------------------------------------------------
                 mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
               price |  -.0000374   .0002009    -0.19   0.853    -.0004381    .0003634
              weight |  -.0041499   .0019865    -2.09   0.040    -.0081128   -.0001871
              length |   -.086156    .058149    -1.48   0.143    -.2021601     .029848
                     |
             foreign |
            Foreign  |  -1.574443   1.292234    -1.22   0.227     -4.15238    1.003494
               _cons |   50.71772   6.364007     7.97   0.000     38.02187    63.41357
        ------------------------------------------------------------------------------
        
        . correlate price weight length if e(sample)
        (obs=74)
        
                     |    price   weight   length
        -------------+---------------------------
               price |   1.0000
              weight |   0.5386   1.0000
              length |   0.4318   0.9460   1.0000
        
        
        . correlate price weight length
        (obs=74)
        
                     |    price   weight   length
        -------------+---------------------------
               price |   1.0000
              weight |   0.5386   1.0000
              length |   0.4318   0.9460   1.0000

        Comment


        • #5
          Naturally they don't differ when there are no missing values in the variables used, as in the case you cite. Try using i.rep78 as a predictor instead.

          See also

          SJ-7-2 dm0030 . . . . . . . . . . Stata tip 44: Get a handle on your sample
          . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B. Jann
          Q2/07 SJ 7(2):266--267 (no commands)
          tip on how to keep track of the observations that make
          up your estimation sample

          Comment


          • #6
            Thank you. I got it.

            Comment


            • #7
              Got it.
              Much obliged.

              Comment

              Working...
              X