r 在甲基化年龄分析的背景下,展示拦截术语如何从抽样方法中调整估计偏差

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了r 在甲基化年龄分析的背景下,展示拦截术语如何从抽样方法中调整估计偏差相关的知识,希望对你有一定的参考价值。

#Sample size
N=10000
#Simulate a population sample, ages ranging from 20-40
age1 <- runif(N,20,40)
#Where trauma follows an exponential distribution (most people have little trauma)
trauma1 <- rexp(N,rate=.5)

#Model methylation age as real age + random noise (3 years deviation on average) + Acceleration due to trauma (.1 years for every unit increase in trauma)
age1_dnam <- age1 + rnorm(N,0,3) + .5*trauma1

#Model methylation age as a function of age, get the residuals
age1_resids <- lm(age1_dnam ~ age1 )$residual
summary(lm(age1_dnam ~ age1 ))$coefficients[2,1] #Beta should be close to 1

#Association the residuals to trauma
summary(lm(age1_resids ~ trauma1))

##Traumatized sample

#Take a sample of data with the same ages
age2 <-  age1

#But who have been sampled on the upper range of the trauma distribution (Median or above)
trauma2 <- runif(N,median(trauma1),max(trauma1))

#Model acceleration in the same way
age2_dnam <- age2 + rnorm(N,0,3) + .5*trauma2

#Model methylation age as a function of age, get the residuals
age2_resids <- lm(age2_dnam ~ age2 )$residual
summary(lm(age2_dnam ~ age2 ))$coefficients[2,1] #Beta should be close to 1


#Association the residuals to trauma
summary(lm(age2_resids ~ trauma2))




pdf('age1plots.pdf',7,7)
plot(age1,age1_dnam)
plot(age2,age2_dnam)

dev.off()

以上是关于r 在甲基化年龄分析的背景下,展示拦截术语如何从抽样方法中调整估计偏差的主要内容,如果未能解决你的问题,请参考以下文章

使用IGV简单绘制甲基化分布图

r 甲基化样本验证

Uanle TCGA数据挖掘——预后相关的甲基化位点及构建重要基因的风险模型

如何通过CHIP-seq分析鉴别基因启动子和增强子

饮食与健康AIGC创作表观生理年龄逆转指北

易基因:全基因组CpG密度和DNA甲基化分析方法比较(MeDIPRRBS和WGBS)| 研究综述