54
第第第 第第第第第第第第第第第

第三章 混合模型的纵向数据分析

  • Upload
    teigra

  • View
    120

  • Download
    10

Embed Size (px)

DESCRIPTION

第三章 混合模型的纵向数据分析. 线性模型 分成数据的混合模型. 纵向数据( Longitudinal Data )的混合模型. 这里 是协方差矩阵,即 的元素不需要独立. 的选取. 常见的是和时间有关,如 中的元素服从时间序列模型,自回归模型,滑动平均模型等,并有周期。 例如模型. 对于 AR ( 1 ). AR ( 1 )简介. 令 其中 独立。 假设 则时间序列平稳且 - PowerPoint PPT Presentation

Citation preview

Page 1: 第三章 混合模型的纵向数据分析

第三章 混合模型的纵向数据分析

Page 2: 第三章 混合模型的纵向数据分析

线性模型 分成数据的混合模型

Page 3: 第三章 混合模型的纵向数据分析

这里 是协方差矩阵,即 的元素不需要独立

纵向数据( Longitudinal Data )的混合模型

Page 4: 第三章 混合模型的纵向数据分析

常见的是和时间有关,如 中的元素服从时间序列模型,自回归模型,滑动平均模型等,并有周期。

例如模型

的选取

Page 5: 第三章 混合模型的纵向数据分析

对于 AR ( 1 )

Page 6: 第三章 混合模型的纵向数据分析

令 其中 独立。 假设 则时间序列平稳且

时间序列有单位根即 。

AR ( 1 )简介

Page 7: 第三章 混合模型的纵向数据分析

令 和 为给定 t-1 时刻前的条件期望和方差,则

因此

AR ( 1 )模型的数值特征

Page 8: 第三章 混合模型的纵向数据分析

均值方差为

分布为

无条件期望方差

Page 9: 第三章 混合模型的纵向数据分析

定义

协方差

相关系数 因为

自相关系数

Page 10: 第三章 混合模型的纵向数据分析

协方差

d 阶自相关系数

d 阶自相关系数

Page 11: 第三章 混合模型的纵向数据分析

对于 ARMA ( 1,1 )

Page 12: 第三章 混合模型的纵向数据分析

模型 其中

一般形式 其中

ARMA ( 1,1 )简介

Page 13: 第三章 混合模型的纵向数据分析

假设

其中 ,

Page 14: 第三章 混合模型的纵向数据分析

ARMA(1,1) 另一种形式为

自协方差函数

其中

MA( )

Page 15: 第三章 混合模型的纵向数据分析

方差

方差

Page 16: 第三章 混合模型的纵向数据分析

自协方差函数

Page 17: 第三章 混合模型的纵向数据分析

自相关系数

Page 18: 第三章 混合模型的纵向数据分析

第一层模型

分层模型

Page 19: 第三章 混合模型的纵向数据分析

第二层模型

Page 20: 第三章 混合模型的纵向数据分析

混合模型

Page 21: 第三章 混合模型的纵向数据分析

截距项 组间(时间不变) 组内(时变的) 交互

说明

Page 22: 第三章 混合模型的纵向数据分析

记为

其中

4 个组群,随机部分

Page 23: 第三章 混合模型的纵向数据分析

随机部分方差

Page 24: 第三章 混合模型的纵向数据分析

模型的矩阵形式 1

Page 25: 第三章 混合模型的纵向数据分析

这里

矩阵形式 2

Page 26: 第三章 混合模型的纵向数据分析

矩阵形式 3

Page 27: 第三章 混合模型的纵向数据分析

矩阵形式 4

Page 28: 第三章 混合模型的纵向数据分析

广义最小二乘( GLS )

Page 29: 第三章 混合模型的纵向数据分析

极大似然估计,同时估计 , 采用 anova 函数 , 其中 为固定效应 , 为随机效应 , 常被低估 .

限制的极大似然估计,先估计 然后采用 GLS 估计 ,采用函数 lme, 更精确

两种估计算法

Page 30: 第三章 混合模型的纵向数据分析

程序

Page 31: 第三章 混合模型的纵向数据分析

数据集描述(畸齿矫, orthodontics ) Investigators at the University of

North Carolina Dental School followed the growth of 27 children (16 males, 11 females) from age 8 until age 14. Every two years they measured the distance between the pituitary (脑垂体,脑下腺) and the pterygomaxillary fissure (翼上颌列)(单位 mm ) , two points that are easily identified on x-ray exposures of the side of the head.

Page 32: 第三章 混合模型的纵向数据分析

数据续 distance a numeric vector of

distances from the pituitary to the pterygomaxillary fissure (mm). These distances are measured on x-ray images of the skull.

age a numeric vector of ages of the subject (yr).

Page 33: 第三章 混合模型的纵向数据分析

Subject an ordered factor indicating the subject on which the measurement was made. The levels are labelled M01 to M16 for the males and F01 to F13 for the females. The ordering is by increasing average distance within sex.

Sex a factor with levels Male and Female

Page 34: 第三章 混合模型的纵向数据分析

文献 Pinheiro, J. C. and Bates, D. M.

(2000), Mixed-Effects Models in S and S-PLUS, Springer, New York. (Appendix A.17)

Potthoff, R. F. and Roy, S. N. (1964), “A generalized multivariate analysis of variance model useful especially for growth curve problems”, Biometrika, 51, 313–326.

Page 35: 第三章 混合模型的纵向数据分析

数据预处理 plot(dd) tab(dd,~Sex) fit1<-lm(distance~age*Sex,dd) summary(fit) wald(fit,"Sex") fit2<-lm(distance~age+Sex,dd) summary(fit2) fit3<-lm(distance~age/Sex,dd) summary(fit3)

Page 36: 第三章 混合模型的纵向数据分析

混合效应模型 fit<-

lme(distance~age*Sex,dd,random=~1+age|Subject,correlation=corAR1(form=~1|Subject))

summary(fit) intervals(fit)# 区间估计 getVarCov(fit)# 得到 G 矩阵

Page 37: 第三章 混合模型的纵向数据分析

去掉 Sex 主效应 fit1<-lme(distance~age/

Sex,dd,random=~1+age|Subject,correlation=corAR1(form=~1|Subject))

summary(fit1) intervals(fit1)# 区间估计 getVarCov(fit1)#G 矩阵

Page 38: 第三章 混合模型的纵向数据分析

去掉异常数据 fit.dropM09<-

update(fit,subset=Subject!="M09")

summary(fit.dropM09)

intervals(fit.dropM09)

Page 39: 第三章 混合模型的纵向数据分析

去掉异常数据 2

fit1.dropM09<-update(fit1,subset=Subject!="M09")

summary(fit1.dropM09)

intervals(fit1.dropM09)

Page 40: 第三章 混合模型的纵向数据分析

Wald 检验 L=rbind("Male at

14"=c(1,14,0,0),"Female at 14"=c(1,14,1,14))

wald(fit,L) L1=rbind("Male at

14"=c(1,14,0),"Female at 14"=c(1,14,14))

wald(fit1,L1)

Page 41: 第三章 混合模型的纵向数据分析

Wald 检验 2

L.gap<-rbind("Gap at 12"=c(0,0,1,12))

wald(fit,L.gap) wald(fit,"Sex") L1.gap<-rbind("Gap at

12"=c(0,0,12)) wald(fit1,L1.gap) wald(fit1,"Sex")

Page 42: 第三章 混合模型的纵向数据分析

一些模型总结 令 X 为组内因子(时变), W 为组间因子

(时间不变)

Page 43: 第三章 混合模型的纵向数据分析
Page 44: 第三章 混合模型的纵向数据分析

一因子混合模型 第一层

第二层

合并

Page 45: 第三章 混合模型的纵向数据分析

条件方差和无条件方差 条件方差

无条件方差

Page 46: 第三章 混合模型的纵向数据分析

的估计, 的加权平均 定义

估计值为

Page 47: 第三章 混合模型的纵向数据分析

一般结构

条件方差

Page 48: 第三章 混合模型的纵向数据分析

估计的期望

Page 49: 第三章 混合模型的纵向数据分析

方差

Page 50: 第三章 混合模型的纵向数据分析

EBLUPs(Empirical Best Linear Unbiased Predictor) 最佳线性预测 BLUP

Page 51: 第三章 混合模型的纵向数据分析

EBLUP of

OLS 估计

方差 分布的均值为 0 方差为

EBLUP

Page 52: 第三章 混合模型的纵向数据分析

最佳线形无偏估计( BLUPS ) Best linear unbiased predictor

estimate OLS

HLM

BLUP

Page 53: 第三章 混合模型的纵向数据分析

EBLUP

Empirical BLUP ( 经验最佳线型无偏估计 )

Page 54: 第三章 混合模型的纵向数据分析

一些方差结论