相当于R中的对比(Stata)

问题描述 投票:0回答:1

我不知道R中是否有等同于Stata的contrast命令。

特别是我对sex@agegroup#group2感兴趣

我知道程序包margins,用于计算模型对象的边际(或局部)影响。

我从Stata网页中提取了一个示例:https://www.stata.com/features/overview/contrasts/

regress y agegroup##sex

contrast r.sex@agegroup
Contrasts of marginal linear predictions

Margins      : asbalanced
                                         df           F        P>F

          sex@agegroup       

(female vs male) 10-19                    1        1.13     0.2945

(female vs male) 20-29                    1        3.36     0.0743

(female vs male) 30-39                    1        5.00     0.0310

(female vs male) 40-59                    1        0.41     0.5279

(female vs male) 60-79                    1        2.71     0.1076

                 Joint                    5        2.52     0.0448                           

            Denominator                  40

                                   Contrast   Std. Err.     [95% Conf. Interval]

             sex@agegroup        

(female vs male) 10-19             6.841855   6.441542     -6.176987     19.8607

(female vs male) 20-29            -11.80631   6.441542     -24.82515    1.212534

(female vs male) 30-39            -14.40607   6.441542     -27.42491   -1.387228

(female vs male) 40-59            -4.101691   6.441542     -17.12053    8.917151

(female vs male) 60-79            -10.60137   6.441542     -23.62022    2.417469
r stata anova compare-contrast
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.