简体   繁体   English

如何使用R比较两个逻辑回归模型的系数?

[英]How to compare coefficients of two logistic regression models using R?

I am trying to model the effect of an event on the odds ratio using logistic regression.我正在尝试使用逻辑回归模拟事件对优势比的影响。 So I have 4 months before and 4 months after the event.所以我有活动前 4 个月和活动后 4 个月。 The data is pooled cross sectional, so I have one observation for each individual but across different times of collection.数据是汇集横截面的,所以我对每个人都有一个观察,但在不同的收集时间。 However, there is no controlled sample, all the sample in the latter 4 months is affected by the event.但是,没有控制样本,后4个月的样本全部受事件影响。 So I can NOT create a 2x2 matrix where there is controlled versus treated and before versus after the event.因此,我无法创建一个 2x2 矩阵,其中控制与处理以及事件之前与之后。 I only have 1x2 dimension: before and after the event.我只有 1x2 维度:事件之前和之后。 I am trying to compare the coefficients of two logistic regression model, model 1 includes data before the event and model 2 includes data after the event.我试图比较两个逻辑回归模型的系数,模型 1 包含事件之前的数据,模型 2 包含事件之后的数据。 I used moderation (interaction) so far but my boss thinks it is not the right way.到目前为止,我使用了适度(互动),但我的老板认为这不是正确的方法。 In this, I put all the data in 1 model and I included an interaction between all the predictors and the event.在此,我将所有数据放入 1 个模型中,并包含所有预测变量与事件之间的交互。 However, he thinks that this model is daunting because it includes a lot of independent variables (the predictors, a dummy variable for the event, an interaction between each of the predictors and the dummy event and finally the controls).然而,他认为这个模型令人生畏,因为它包括许多自变量(预测变量、事件的虚拟变量、每个预测变量与虚拟事件之间的相互作用,最后是控制)。 My objective: To measure the effect of the event on the influence of the predictors (which are binary, categorical and numerical variables) on the binary outcome variable.我的目标:测量事件对预测变量(二元变量、分类变量和数值变量)对二元结果变量的影响的影响。 I need to find a statistic similar to the t-test: the t-test compares mean values but I need to compare the beta (the regression coefficients) in this case.我需要找到一个类似于 t 检验的统计量:t 检验比较平均值,但在这种情况下我需要比较 beta(回归系数)。 Is there any statistic parallel to the t-test that compares the coefficients of 2 regression models?是否有与比较 2 个回归模型系数的 t 检验平行的统计量? (I am using logistic regression using R) Thank you (我使用 R 使用逻辑回归)谢谢

I suggest running a single model using all the data, with an interaction between your current predictor(s) and an indicator for "after the event".我建议使用所有数据运行单个模型,并在当前预测变量和“事后”指标之间进行交互。

Then the z-statistic and p-value for the interaction in the regression output relates to the test of the hypothesis that the coefficient for the period before the event is the same as the coefficient for the period after the event.然后,回归输出中交互作用的 z 统计量和 p 值与假设检验相关,即事件前时期的系数与事件后时期的系数相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM