Announcement

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

  • table for ANOVA and regression

    Hello,

    I am doing a linear regression. When I get the output it is not showing me the ANOVA results. How can I create a regression output with ANOVA added?

  • #2
    If I understand you correctly, then you're not talking about the ANOVA table in the left-hand side of the output's header (model and residual mean squares) or the some model F-statistic in the header is missing-valued because of determinacy problems, but rather the multiple degree-of-freedom ANOVA contrasts that correspond to the enumerated indicator-variable contrasts that are shown in the regression table.

    If that's correct, then just use the contrast postestimation command after the regress estimation command. You can also use testparm, but I think that contrast is easier. (Or just use anova.) See below.

    .ÿ
    .ÿversionÿ17.0

    .ÿ
    .ÿclearÿ*

    .ÿ
    .ÿ//ÿseedem
    .ÿsetÿseedÿ1248265816

    .ÿ
    .ÿquietlyÿsysuseÿauto

    .ÿ
    .ÿsummarizeÿrep78,ÿmeanonly

    .ÿquietlyÿreplaceÿrep78ÿ=ÿruniformint(`r(min)',ÿ`r(max)')ÿifÿmi(rep78)

    .ÿ
    .ÿ*
    .ÿ*ÿBeginÿhere
    .ÿ*
    .ÿregressÿmpgÿi.(foreignÿrep78)

    ÿÿÿÿÿÿSourceÿ|ÿÿÿÿÿÿÿSSÿÿÿÿÿÿÿÿÿÿÿdfÿÿÿÿÿÿÿMSÿÿÿÿÿÿNumberÿofÿobsÿÿÿ=ÿÿÿÿÿÿÿÿ74
    -------------+----------------------------------ÿÿÿF(5,ÿ68)ÿÿÿÿÿÿÿÿ=ÿÿÿÿÿÿ4.40
    ÿÿÿÿÿÿÿModelÿ|ÿÿ597.797661ÿÿÿÿÿÿÿÿÿ5ÿÿ119.559532ÿÿÿProbÿ>ÿFÿÿÿÿÿÿÿÿ=ÿÿÿÿ0.0016
    ÿÿÿÿResidualÿ|ÿÿÿ1845.6618ÿÿÿÿÿÿÿÿ68ÿÿ27.1420853ÿÿÿR-squaredÿÿÿÿÿÿÿ=ÿÿÿÿ0.2447
    -------------+----------------------------------ÿÿÿAdjÿR-squaredÿÿÿ=ÿÿÿÿ0.1891
    ÿÿÿÿÿÿÿTotalÿ|ÿÿ2443.45946ÿÿÿÿÿÿÿÿ73ÿÿ33.4720474ÿÿÿRootÿMSEÿÿÿÿÿÿÿÿ=ÿÿÿÿ5.2098

    ------------------------------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿmpgÿ|ÿCoefficientÿÿStd.ÿerr.ÿÿÿÿÿÿtÿÿÿÿP>|t|ÿÿÿÿÿ[95%ÿconf.ÿinterval]
    -------------+----------------------------------------------------------------
    ÿÿÿÿÿforeignÿ|
    ÿÿÿÿForeignÿÿ|ÿÿÿ2.723466ÿÿÿ1.705033ÿÿÿÿÿ1.60ÿÿÿ0.115ÿÿÿÿ-.6788735ÿÿÿÿ6.125806
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿÿrep78ÿ|
    ÿÿÿÿÿÿÿÿÿÿ2ÿÿ|ÿÿÿÿÿÿÿÿÿ-1ÿÿÿÿ4.00481ÿÿÿÿ-0.25ÿÿÿ0.804ÿÿÿÿ-8.991474ÿÿÿÿ6.991474
    ÿÿÿÿÿÿÿÿÿÿ3ÿÿ|ÿÿ-1.839013ÿÿÿ3.808523ÿÿÿÿ-0.48ÿÿÿ0.631ÿÿÿÿ-9.438803ÿÿÿÿ5.760777
    ÿÿÿÿÿÿÿÿÿÿ4ÿÿ|ÿÿ-.8617332ÿÿÿ3.956631ÿÿÿÿ-0.22ÿÿÿ0.828ÿÿÿÿ-8.757068ÿÿÿÿ7.033602
    ÿÿÿÿÿÿÿÿÿÿ5ÿÿ|ÿÿÿ4.135346ÿÿÿ4.240826ÿÿÿÿÿ0.98ÿÿÿ0.333ÿÿÿÿ-4.327091ÿÿÿÿ12.59778
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿÿ_consÿ|ÿÿÿÿÿÿÿÿÿ21ÿÿÿÿ3.68389ÿÿÿÿÿ5.70ÿÿÿ0.000ÿÿÿÿÿ13.64891ÿÿÿÿ28.35109
    ------------------------------------------------------------------------------

    .ÿcontrastÿforeignÿrep78ÿ//ÿ<=ÿthis

    Contrastsÿofÿmarginalÿlinearÿpredictions

    Margins:ÿasbalanced

    ------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿÿÿÿÿdfÿÿÿÿÿÿÿÿÿÿÿFÿÿÿÿÿÿÿÿP>F
    -------------+----------------------------------
    ÿÿÿÿÿforeignÿ|ÿÿÿÿÿÿÿÿÿÿ1ÿÿÿÿÿÿÿÿ2.55ÿÿÿÿÿ0.1148
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿÿrep78ÿ|ÿÿÿÿÿÿÿÿÿÿ4ÿÿÿÿÿÿÿÿ2.02ÿÿÿÿÿ0.1009
    ÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿDenominatorÿ|ÿÿÿÿÿÿÿÿÿ68
    ------------------------------------------------

    .ÿ
    .ÿ//ÿcf.
    .ÿanovaÿmpgÿforeignÿrep78

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNumberÿofÿobsÿ=ÿÿÿÿÿÿÿÿÿ74ÿÿÿÿR-squaredÿÿÿÿÿ=ÿÿ0.2447
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿRootÿMSEÿÿÿÿÿÿ=ÿÿÿÿ5.20981ÿÿÿÿAdjÿR-squaredÿ=ÿÿ0.1891

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿSourceÿ|ÿPartialÿSSÿÿÿÿÿÿÿÿÿdfÿÿÿÿÿÿÿÿÿMSÿÿÿÿÿÿÿÿFÿÿÿÿProb>F
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ-----------+----------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿModelÿ|ÿÿ597.79766ÿÿÿÿÿÿÿÿÿÿ5ÿÿÿ119.55953ÿÿÿÿÿÿ4.40ÿÿ0.0016
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿforeignÿ|ÿÿ69.250323ÿÿÿÿÿÿÿÿÿÿ1ÿÿÿ69.250323ÿÿÿÿÿÿ2.55ÿÿ0.1148
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿrep78ÿ|ÿÿ219.64415ÿÿÿÿÿÿÿÿÿÿ4ÿÿÿ54.911036ÿÿÿÿÿÿ2.02ÿÿ0.1009
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿResidualÿ|ÿÿ1845.6618ÿÿÿÿÿÿÿÿÿ68ÿÿÿ27.142085ÿÿ
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ-----------+----------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿTotalÿ|ÿÿ2443.4595ÿÿÿÿÿÿÿÿÿ73ÿÿÿ33.472047ÿÿ

    .ÿ
    .ÿexit

    endÿofÿdo-file


    .
    Last edited by Joseph Coveney; 03 Aug 2022, 08:45.

    Comment

    Working...
    X