如何找到重复测量数据参数的模式和变化率
How to find the pattern and rate of change in a parameter for repeated measurement data
我有肌钙蛋白 (TRP) 水平(心脏肌肉中发现的一种蛋白质)的数据,这些数据是在 200 多名患者中测量的。数据分为 Placebo 和 Drug-X 组。对于每位患者,在第 1、3、7、14、21 和 28 天测量 TRP 水平。如果患者在 28 天前出院,则进行一次额外测量,即 TRP_on_discharge_day
,可以在任何一天进行1-28 之间。注意:并非所有受试者都有所有测量值,因为一些患者在两者之间出院。
我有两个问题:
首先,我想研究安慰剂组和 Drug-X 组的平均 TRP 水平,以及它们是否有显着差异。由于数据对每个主题都有多个测量值,我认为无法进行正常的 t 检验。因此,正如我在其他地方阅读的那样,我正在尝试使用 lme4::lmer
函数的线性混合模型。而我的模型是lmer( measurement ~ Randomization + (1|id))
。其中 measurement
是 TRP 水平,Randomization
是组(安慰剂或药物 X),id
是受试者的 ID。这是对我的问题建模的正确方法吗?
其次,我想研究Placebo组和Drug-X组TRP的变化模式和变化率,并测试它们是否不同。能否请你帮助我一些如何做到这一点,使用什么技术。
我正在 dput
获取示例数据。非常感谢任何类型的帮助。
structure(list(`Medication Code` = c(7001, 7004, 7008, 7009,
7014, 7016, 7018, 7022, 7025, 7026, 7028, 7031, 7032, 7033, 7036,
7038, 7039, 7044, 7045, 7052, 7055, 7057, 7066, 7068, 7079, 7081,
7083, 7090, 7093, 7097, 7103, 7105, 7107, 7110, 7116, 7123, 7125,
7129, 7132, 7133, 7135, 7136, 7142, 7143, 7144, 7146, 7150, 7151,
7152, 7153, 7157, 7166, 7168, 7171, 7174, 7175, 7176, 7177, 7185,
7186, 7189, 7192, 7195, 7197, 7200, 7202, 7004, 7008, 7010, 7018,
7022, 7026, 7032, 7036, 7038, 7039, 7044, 7045, 7052, 7055, 7057,
7066, 7081, 7097, 7116, 7123, 7125, 7132, 7133, 7135, 7142, 7143,
7144, 7146, 7151, 7152, 7157, 7168, 7174, 7175, 7176, 7185, 7189,
7195, 7198, 7202, 7009, 7018, 7022, 7026, 7028, 7038, 7052, 7081,
7090, 7100, 7105, 7125, 7133, 7135, 7144, 7152, 7174, 7176, 7189,
7038, 7066, 7116, 7133, 7135, 7133, 7135, 7135), Randomization = c("Placebo",
"Placebo", "Drug-X", "Placebo", "Drug-X", "Placebo",
"Drug-X", "Drug-X", "Drug-X", "Placebo", "Placebo",
"Drug-X", "Placebo", "Placebo", "Drug-X", "Placebo",
"Drug-X", "Drug-X", "Drug-X", "Drug-X",
"Placebo", "Placebo", "Drug-X", "Drug-X", "Placebo",
"Drug-X", "Placebo", "Placebo", "Placebo", "Placebo", "Placebo",
"Drug-X", "Drug-X", "Drug-X", "Placebo", "Drug-X",
"Drug-X", "Placebo", "Drug-X", "Placebo", "Placebo",
"Placebo", "Placebo", "Drug-X", "Placebo", "Drug-X",
"Drug-X", "Drug-X", "Placebo", "Drug-X", "Placebo",
"Drug-X", "Drug-X", "Drug-X", "Placebo", "Drug-X",
"Placebo", "Placebo", "Drug-X", "Drug-X", "Drug-X",
"Placebo", "Placebo", "Placebo", "Placebo", "Placebo", "Placebo",
"Drug-X", "Drug-X", "Drug-X", "Drug-X",
"Placebo", "Placebo", "Drug-X", "Placebo", "Drug-X",
"Drug-X", "Drug-X", "Drug-X", "Placebo", "Placebo",
"Drug-X", "Drug-X", "Placebo", "Placebo", "Drug-X",
"Drug-X", "Drug-X", "Placebo", "Placebo", "Placebo",
"Drug-X", "Placebo", "Drug-X", "Drug-X", "Placebo",
"Placebo", "Drug-X", "Placebo", "Drug-X", "Placebo",
"Drug-X", "Drug-X", "Placebo", "Placebo", "Placebo",
"Placebo", "Drug-X", "Drug-X", "Placebo", "Placebo",
"Placebo", "Drug-X", "Drug-X", "Placebo", "Drug-X",
"Drug-X", "Drug-X", "Placebo", "Placebo", "Placebo",
"Placebo", "Placebo", "Placebo", "Drug-X", "Placebo", "Drug-X",
"Placebo", "Placebo", "Placebo", "Placebo", "Placebo", "Placebo"
), trp_day = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1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 7004, 7008, 7009, 7014, 7016,
7018, 7022, 7025, 7026, 7028, 7031, 7032, 7033, 7036, 7038, 7039,
7044, 7045, 7052, 7055, 7057, 7066, 7068, 7079, 7081, 7083, 7090,
7093, 7097, 7103, 7105, 7107, 7110, 7116, 7123, 7125, 7129, 7132,
7133, 7135, 7136, 7142, 7143, 7144, 7146, 7150, 7151, 7152, 7153,
7157, 7166, 7168, 7171, 7174, 7175, 7176, 7177, 7185, 7186, 7189,
7192, 7195, 7197, 7200, 7202, 7004, 7008, 7010, 7018, 7022, 7026,
7032, 7036, 7038, 7039, 7044, 7045, 7052, 7055, 7057, 7066, 7081,
7097, 7116, 7123, 7125, 7132, 7133, 7135, 7142, 7143, 7144, 7146,
7151, 7152, 7157, 7168, 7174, 7175, 7176, 7185, 7189, 7195, 7198,
7202, 7009, 7018, 7022, 7026, 7028, 7038, 7052, 7081, 7090, 7100,
7105, 7125, 7133, 7135, 7144, 7152, 7174, 7176, 7189, 7038, 7066,
7116, 7133, 7135, 7133, 7135, 7135)), row.names = c(NA, -133L
), class = c("tbl_df", "tbl", "data.frame"))
第一个问题:
I want to study the average TRP level in placebo and Drug-X group and whether they are significantly different.
...是的,型号:
lmer( measurement ~ Randomization + (1|id))
将估计两组之间的平均差异。
第二题:
I want to study the pattern and rate of change in TRP in Placebo group and Drug-X group and test whether they are different.
...您需要合并时间变量并将其与组变量交互:
lmer( measurement ~ Randomization*trp_day + (1|id))
这将提供每组随时间推移的斜率估计值。
首先,将时间视为数字而不是一个因素是个好主意。
我有肌钙蛋白 (TRP) 水平(心脏肌肉中发现的一种蛋白质)的数据,这些数据是在 200 多名患者中测量的。数据分为 Placebo 和 Drug-X 组。对于每位患者,在第 1、3、7、14、21 和 28 天测量 TRP 水平。如果患者在 28 天前出院,则进行一次额外测量,即 TRP_on_discharge_day
,可以在任何一天进行1-28 之间。注意:并非所有受试者都有所有测量值,因为一些患者在两者之间出院。
我有两个问题:
首先,我想研究安慰剂组和 Drug-X 组的平均 TRP 水平,以及它们是否有显着差异。由于数据对每个主题都有多个测量值,我认为无法进行正常的 t 检验。因此,正如我在其他地方阅读的那样,我正在尝试使用 lme4::lmer
函数的线性混合模型。而我的模型是lmer( measurement ~ Randomization + (1|id))
。其中 measurement
是 TRP 水平,Randomization
是组(安慰剂或药物 X),id
是受试者的 ID。这是对我的问题建模的正确方法吗?
其次,我想研究Placebo组和Drug-X组TRP的变化模式和变化率,并测试它们是否不同。能否请你帮助我一些如何做到这一点,使用什么技术。
我正在 dput
获取示例数据。非常感谢任何类型的帮助。
structure(list(`Medication Code` = c(7001, 7004, 7008, 7009,
7014, 7016, 7018, 7022, 7025, 7026, 7028, 7031, 7032, 7033, 7036,
7038, 7039, 7044, 7045, 7052, 7055, 7057, 7066, 7068, 7079, 7081,
7083, 7090, 7093, 7097, 7103, 7105, 7107, 7110, 7116, 7123, 7125,
7129, 7132, 7133, 7135, 7136, 7142, 7143, 7144, 7146, 7150, 7151,
7152, 7153, 7157, 7166, 7168, 7171, 7174, 7175, 7176, 7177, 7185,
7186, 7189, 7192, 7195, 7197, 7200, 7202, 7004, 7008, 7010, 7018,
7022, 7026, 7032, 7036, 7038, 7039, 7044, 7045, 7052, 7055, 7057,
7066, 7081, 7097, 7116, 7123, 7125, 7132, 7133, 7135, 7142, 7143,
7144, 7146, 7151, 7152, 7157, 7168, 7174, 7175, 7176, 7185, 7189,
7195, 7198, 7202, 7009, 7018, 7022, 7026, 7028, 7038, 7052, 7081,
7090, 7100, 7105, 7125, 7133, 7135, 7144, 7152, 7174, 7176, 7189,
7038, 7066, 7116, 7133, 7135, 7133, 7135, 7135), Randomization = c("Placebo",
"Placebo", "Drug-X", "Placebo", "Drug-X", "Placebo",
"Drug-X", "Drug-X", "Drug-X", "Placebo", "Placebo",
"Drug-X", "Placebo", "Placebo", "Drug-X", "Placebo",
"Drug-X", "Drug-X", "Drug-X", "Drug-X",
"Placebo", "Placebo", "Drug-X", "Drug-X", "Placebo",
"Drug-X", "Placebo", "Placebo", "Placebo", "Placebo", "Placebo",
"Drug-X", "Drug-X", "Drug-X", "Placebo", "Drug-X",
"Drug-X", "Placebo", "Drug-X", "Placebo", "Placebo",
"Placebo", "Placebo", "Drug-X", "Placebo", "Drug-X",
"Drug-X", "Drug-X", "Placebo", "Drug-X", "Placebo",
"Drug-X", "Drug-X", "Drug-X", "Placebo", "Drug-X",
"Placebo", "Placebo", "Drug-X", "Drug-X", "Drug-X",
"Placebo", "Placebo", "Placebo", "Placebo", "Placebo", "Placebo",
"Drug-X", "Drug-X", "Drug-X", "Drug-X",
"Placebo", "Placebo", "Drug-X", "Placebo", "Drug-X",
"Drug-X", "Drug-X", "Drug-X", "Placebo", "Placebo",
"Drug-X", "Drug-X", "Placebo", "Placebo", "Drug-X",
"Drug-X", "Drug-X", "Placebo", "Placebo", "Placebo",
"Drug-X", "Placebo", "Drug-X", "Drug-X", "Placebo",
"Placebo", "Drug-X", "Placebo", "Drug-X", "Placebo",
"Drug-X", "Drug-X", "Placebo", "Placebo", "Placebo",
"Placebo", "Drug-X", "Drug-X", "Placebo", "Placebo",
"Placebo", "Drug-X", "Drug-X", "Placebo", "Drug-X",
"Drug-X", "Drug-X", "Placebo", "Placebo", "Placebo",
"Placebo", "Placebo", "Placebo", "Drug-X", "Placebo", "Drug-X",
"Placebo", "Placebo", "Placebo", "Placebo", "Placebo", "Placebo"
), trp_day = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 5L, 6L, 7L), .Label = c("TRP_DAY0",
"TRP_DAY3", "TRP_DAY7", "TRP_DAY14", "TRP_DAY21", "TRP_DAY28",
"TRP_DAY35"), class = "factor"), measurement = c(4, 17, 20.5,
2.05, 5, 7, 8, 3, 5, 5, 5, 34, 3, 8, 4, 7, 7, 12, 5, 10, 10,
16, 2, 8, 4, 8, 11, 15, 24, 5, 4, 8, 0.025, 4, 7, 7, 3, 3, 8,
11, 16.7, 3, 9, 2, 4, 3, 4, 8, 12.6, 0.014, 7, 3.5, 7, 9, 13,
9, 14, 6, 4.2, 6, 9, 6, 11, 9, 5, 12, 4, 5.5, 6, 5, 5, 6, 4,
5, 3, 3, 7, 5, 6, 6, 10, 4, 6, 6, 13, 7, 3, 6, 12, 7, 4, 3, 4,
3, 7, 10, 9, 4, 7, 5, 7, 4.8, 29, 9, 0.02, 6, 0.03, 3, 3, 5,
6, 5, 5, 9, 5, 3, 15.1, 4, 10, 27, 3, 6, 8, 10, 15, 17, 3, 29,
38, 17, 11, 8, 10), id = c(7001, 7004, 7008, 7009, 7014, 7016,
7018, 7022, 7025, 7026, 7028, 7031, 7032, 7033, 7036, 7038, 7039,
7044, 7045, 7052, 7055, 7057, 7066, 7068, 7079, 7081, 7083, 7090,
7093, 7097, 7103, 7105, 7107, 7110, 7116, 7123, 7125, 7129, 7132,
7133, 7135, 7136, 7142, 7143, 7144, 7146, 7150, 7151, 7152, 7153,
7157, 7166, 7168, 7171, 7174, 7175, 7176, 7177, 7185, 7186, 7189,
7192, 7195, 7197, 7200, 7202, 7004, 7008, 7010, 7018, 7022, 7026,
7032, 7036, 7038, 7039, 7044, 7045, 7052, 7055, 7057, 7066, 7081,
7097, 7116, 7123, 7125, 7132, 7133, 7135, 7142, 7143, 7144, 7146,
7151, 7152, 7157, 7168, 7174, 7175, 7176, 7185, 7189, 7195, 7198,
7202, 7009, 7018, 7022, 7026, 7028, 7038, 7052, 7081, 7090, 7100,
7105, 7125, 7133, 7135, 7144, 7152, 7174, 7176, 7189, 7038, 7066,
7116, 7133, 7135, 7133, 7135, 7135)), row.names = c(NA, -133L
), class = c("tbl_df", "tbl", "data.frame"))
第一个问题:
I want to study the average TRP level in placebo and Drug-X group and whether they are significantly different.
...是的,型号:
lmer( measurement ~ Randomization + (1|id))
将估计两组之间的平均差异。
第二题:
I want to study the pattern and rate of change in TRP in Placebo group and Drug-X group and test whether they are different.
...您需要合并时间变量并将其与组变量交互:
lmer( measurement ~ Randomization*trp_day + (1|id))
这将提供每组随时间推移的斜率估计值。
首先,将时间视为数字而不是一个因素是个好主意。