-------------
      name:  <unnamed>
       log:  /Users/ben/Documents/Stata/log.smcl
  log type:  smcl
 opened on:   4 Feb 2026, 09:25:54

. sysuse auto, clear
(1978 automobile data)

. tab headroom foreign

  Headroom |      Car origin
     (in.) |  Domestic    Foreign |     Total
-----------+----------------------+----------
       1.5 |         3          1 |         4
       2.0 |        10          3 |        13
       2.5 |         4         10 |        14
       3.0 |         7          6 |        13
       3.5 |        13          2 |        15
       4.0 |        10          0 |        10
       4.5 |         4          0 |         4
       5.0 |         1          0 |         1
-----------+----------------------+----------
     Total |        52         22 |        74

. tab rep78

     Repair |
record 1978 |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |          2        2.90        2.90
          2 |          8       11.59       14.49
          3 |         30       43.48       57.97
          4 |         18       26.09       84.06
          5 |         11       15.94      100.00
------------+-----------------------------------
      Total |         69      100.00

. su price

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
       price |         74    6165.257    2949.496       3291      15906

. su price weight length gear_ratio

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
       price |         74    6165.257    2949.496       3291      15906
      weight |         74    3019.459    777.1936       1760       4840
      length |         74    187.9324    22.26634        142        233
  gear_ratio |         74    3.014865    .4562871       2.19       3.89

. reg mpg displacement gear_ratio weight price

      Source |       SS           df       MS      Number of obs   =        74
-------------+----------------------------------   F(4, 69)        =     32.92
       Model |  1603.26274         4  400.815685   Prob > F        =    0.0000
    Residual |  840.196719        69   12.176764   R-squared       =    0.6561
-------------+----------------------------------   Adj R-squared   =    0.6362
       Total |  2443.45946        73  33.4720474   Root MSE        =    3.4895

-------------+----------------------------------------------------------------
          mpg | Coefficient   Std. err.       t    P>|t|      [95% con f. interval]
-------------+----------------------------------------------------------------
displacement |    .0088833    .0117481      0.76    0.452     -.0145535       .03232
  gear_ratio |    .9008024    1.645546      0.55    0.586     -2.381972     4.183577
      weight |   -.0063068    .0012248     -5.15    0.000     -.0087502    -.0038635
       price |   -.0001173    .0001687     -0.70    0.489     -.0004538     .0002193
       _cons |      36.595    6.734683      5.43    0.000      23.15968     50.03033
-------------+----------------------------------------------------------------

. margins, at(weight=(2000(500)4500))

 Predictive margins                                         Number of obs    = 74
 Model VCE: OLS


Expression:  Linear prediction, predict()


1._at:   weight   = 2000
2._at:   weight   = 2500
3._at:   weight   = 3000
4._at:   weight   = 3500
5._at:   weight   = 4000
6._at:   weight   = 4500

-------------+----------------------------------------------------------------
             |            Delta-method
             |     Margin    std. err.       t    P>|t|      [95% con f. interval]
-------------+----------------------------------------------------------------
         _at |
          1  |    27.72685    1.312853     21.12    0.000      25.10778     30.34593
          2  |    24.57344      .75454     32.57    0.000      23.06817     26.07871
          3  |    21.42002    .4063483     52.71    0.000      20.60938     22.23067
          4  |    18.26661     .714807     25.55    0.000      16.84061     19.69261
          5  |    15.11319    1.267604     11.92    0.000      12.58439       17.642
          6  |    11.95978    1.858154      6.44    0.000      8.252865     15.66669
-------------+----------------------------------------------------------------

. log close
      name:  <unnamed>
       log:  /Users/u1152038/Documents/Stata/log.smcl
  log type:  smcl
 closed on:   4 Feb 2026, 09:30:16
-------------