美文网首页
纵向数据的分析方法之 广义估计方程

纵向数据的分析方法之 广义估计方程

作者: 灵活胖子的进步之路 | 来源:发表于2022-10-02 09:18 被阅读0次

英文教程地址
https://data.library.virginia.edu/getting-started-with-generalized-estimating-equations/

广义估计方程和混合效应模型及多水平模型的区别如下

  1. The main difference is that it’s a marginal model. It seeks to model a population average. Mixed-effect/Multilevel models are subject-specific, or conditional, models. They allow us to estimate different parameters for each subject or cluster. In other words, the parameter estimates are conditional on the subject/cluster. This in turn provides insight into the variability between subjects or clusters. We can also obtain a population-level model from a mixed-effect model, but it’s basically an average of the subject-specific models.

  2. GEE is intended for simple clustering or repeated measures. It cannot easily accommodate more complex designs such as nested or crossed groups; for example, nested repeated measures within a subject or group. This is something better suited for a mixed-effect model.

  3. GEE computations are usually easier than mixed-effect model computations. GEE does not use the likelihood methods that mixed-effect models employ, which means GEE can sometimes estimate more complex models.Because GEE doesn’t use likelihood methods, the estimated “model” is incomplete and not suitable for simulation.

  4. GEE allows us to specify a correlation structure for different responses within a subject or group. For example, we can specify that the correlation of measurements taken closer together is higher than those taken farther apart. This is not something that’s currently possible in the popular lme4 package.

#建立模拟数据集
URL <- "http://static.lib.virginia.edu/statlab/materials/data/depression.csv"
dat <- read.csv(URL, stringsAsFactors = TRUE)
dat$id <- factor(dat$id)
dat$drug <- relevel(dat$drug, ref = "standard")
head(dat, n = 3)
数据集情况
#查看病人个数(每个病人可以有多个观测)
dat%>%
  distinct(id)%>%
  count()
总共340例患者
#查看数据分布情况
with(dat, tapply(depression, list(diagnose, drug, time), mean)) %>% 
  ftable() %>% 
  round(2)
分组结果数据分布情况
#构建广义估计方程并查看最终结果
dep_gee <- gee(depression ~ diagnose + drug*time,#方程,注意交互作用
               data = dat, #数据集
               id = id, #患者识别编号
               family = binomial,#连接函数
               corstr = "independence")#数据相关矩阵,这里设定为独立
summary(dep_gee)
广义估计方程结果

exp(estimate)后可以得到OR值,可以看到,independence的作业相关矩阵中假设组内相关性是0,因为一个id是3个观察,所以是3乘以3的矩阵了

# Now let’s try a model with an exchangeable correlation structure. 
# This says all pairs of responses within a subject are equally correlated. 
# To do this we set corstr = "exchangeable".
#设定相关性矩阵为exchangeable,意思是组内配对之间的相关性系数相等
dep_gee2 <- gee(depression ~ diagnose + drug*time,
                data = dat, 
                id = id, 
                family = binomial,
                corstr = "exchangeable")
summary(dep_gee2)
exchangeable相关性矩阵下,除对角线外,其他相关性系数相等.png
# Another possibility for correlation is an autoregressive structure. 
# This allows correlations of measurements taken closer together to be higher than those taken farther apart.
#设定自回归相关性矩阵并查看结果
dep_gee3 <- gee(depression ~ diagnose + drug*time,
                data = dat, 
                id = id, 
                family = binomial,
                corstr = "AR-M", Mv = 1)

dep_gee3$working.correlation
自回归矩阵,距离较近的点的相关性系数大于距离远的点

作业相关矩阵的选择

How to choose which correlation structure to use? The good news is GEE estimates are valid even if you misspecify the correlation structure (Agresti, 2002). Of course this assumes the model is correct, but then again no model is exactly correct. Agresti suggests using the exchangeable structure as a start and then checking how the coefficient estimates and standard errors change with other correlation structures. If the changes are minimal, go with the simpler correlation structure.

相关文章

  • 纵向数据的分析方法之 广义估计方程

    英文教程地址https://data.library.virginia.edu/getting-started-w...

  • 一文教你掌握广义估计方程

    广义估计方程是一种研究纵向数据(比如重复测量数据,面板数据)的方法。 同一测量对象的多次测量数据结果之间很可能有着...

  • 线性混合模型、广义线性模型等

    线性混合模型: 用于非独立数据的统计分析,也称多水平模型、广义估计方程。 充分考虑数据聚集性问题,在数据存在聚集性...

  • 2020-08-07 重复测量

    1.连续数值变量 一般线性模型 2.二分类,有序变量,无序变量 广义估计方程 2.1 广义估计方程 GEE/广义线...

  • R语言:广义估计方程(GEE)

    转自个人微信公粽号【易学统计】的统计学习笔记:R语言:广义估计方程(GEE)[https://mp.weixin....

  • 数据分析

    数据分析基本方法 对比分析(横向对比纵向对比) 趋势分析 象限分析 交叉分析 数据分析框架_AARRR分析 逻辑分...

  • 数学与统计虐我千百遍……

    被数学和统计虐惨的我 广义线性模型 广义可加模型 广义估计方程 线性混合模型 线性相加模型 广义线性混合模型 一般...

  • R数据分析:广义估计方程式GEE的做法和解释

    好久没有更新文章了,因为同学们咨询的问题有点多,另一个原因就是自己实在太懒。。。。 今天继续给大家写广义估计方程式...

  • 微专业--分析数据

    基本分析方法 数据分析更多是基于业务的角度来总结数据,发现数据背后的结论 -- 对比分析横向对比--跟自己比纵向对...

  • 一图知晓数据分析与数据挖掘的区别是什么?

    数据分析可以分为广义的数据分析和狭义的数据分析,广义的数据分析就包括狭义的数据分析和数据挖掘,我们常说的数据分析就...

网友评论

      本文标题:纵向数据的分析方法之 广义估计方程

      本文链接:https://www.haomeiwen.com/subject/pxzdartx.html