lnmor

命令简介

lnmor computes (adjusted) marginal odds ratios after logit or probit using G-computation. lnmor works by applying fractional logit to averaged counterfactual predictions from the original model.

命令安装

net from https://raw.githubusercontent.com/benjann/lnmor/main/
net install lnmor, replace
ssc install moremata, replace

命令示例

载入数据

webuse lbw
logit low i.smoke i.race age lwt ptl ht ui, vce(robust)

计算 marginal odds ratio:

. lnmor i.smoke, or

Enumerating predictions: smoke..done

Marginal odds ratio                             Number of obs     =        189
                                                Command           =      logit

------------------------------------------------------------------------------
             |               Robust
         low | Odds Ratio   std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
       smoke |
     Smoker  |   2.188234   .7145092     2.40   0.017     1.149095    4.167077
------------------------------------------------------------------------------

使用marginal命令重现[1]

. margins, at(smoke=(0 1)) post vce(unconditional)

(output omitted)

. nlcom (smoke:(logit(_b[2._at]) - logit(_b[1._at]))), post

(output omitted)

. ereturn display, eform(Odds Ratio)
------------------------------------------------------------------------------
             | Odds Ratio   Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
       smoke |   2.188234   .7145092     2.40   0.016     1.153869    4.149835
------------------------------------------------------------------------------

联系作者

姓名:Ben Jann

邮箱:ben.jann@unibe.ch

文献:

Marginal Odds Ratios: What They Are, How to Compute Them, and Why Sociologists Might Want to Use Them

https://sociologicalscience.com/articles-v10-10-332

https://boris.unibe.ch/178165/1/karlson-jann-2023-MOR.pdf

Estimation of marginal odds ratios

https://boris.unibe.ch/176998/8/jann-karlson-2023-mor.pdf

Marginal odds ratios

https://www.stata.com/meeting/switzerland22/slides/Switzerland22_Jann.pdf



基本信息
词条统计

所属分类Stata

浏览次数80

创建者epiman

最后编辑epiman