我正在尝试使用Bland-Altman(图基均值差)图来评估impute.knn()
包中的impute
函数如何影响许多CpG的结果(此处以cg16181396为例) ),我不确定如何解释结果。
以下是数据集:
subset_df <- structure(list(cpg = c("cg16181396", "cg16181396", "cg16181396",
"cg16181396", "cg16181396", "cg16181396", "cg16181396", "cg16181396",
"cg16181396", "cg16181396", "cg16181396", "cg16181396", "cg16181396",
"cg16181396", "cg16181396", "cg16181396", "cg16181396", "cg16181396",
"cg16181396", "cg16181396", "cg16181396", "cg16181396", "cg16181396",
"cg16181396", "cg16181396", "cg16181396", "cg16181396", "cg16181396",
"cg16181396", "cg16181396", "cg16181396", "cg16181396", "cg16181396",
"cg16181396", "cg16181396"), sample = structure(c(404L, 590L,
780L, 783L, 784L, 822L, 71L, 498L, 566L, 602L, 273L, 278L, 624L,
32L, 37L, 188L, 416L, 625L, 634L, 48L, 79L, 84L, 316L, 436L,
468L, 655L, 734L, 257L, 267L, 280L, 454L, 457L, 512L, 555L, 684L
), .Label = c("201490020010_R01C01", "201490020010_R02C01", "201490020010_R03C01",
"201490020010_R04C01", "201490020010_R05C01", "201490020010_R06C01",
"201490020010_R07C01", "201490020010_R08C01", "201490020011_R01C01",
"201490020011_R02C01", "201490020011_R03C01", "201490020011_R04C01",
"201490020011_R05C01", "201490020011_R06C01", "201490020011_R07C01",
"201490020011_R08C01", "201490020016_R01C01", "201490020016_R03C01",
"201490020016_R04C01", "201490020016_R05C01", "201490020016_R06C01",
"201490020016_R07C01", "201490020016_R08C01", "201490020055_R01C01",
"201490020055_R02C01", "201490020055_R03C01", "201490020055_R04C01",
"201490020055_R05C01", "201490020055_R06C01", "201490020055_R07C01",
"201490020055_R08C01", "201490020091_R02C01", "201490020091_R03C01",
"201490020091_R04C01", "201490020091_R05C01", "201490020091_R06C01",
"201490020091_R07C01", "201490020091_R08C01", "201490020116_R02C01",
"201490020116_R03C01", "201490020116_R04C01", "201490020116_R05C01",
"201490020116_R06C01", "201490020116_R07C01", "201490020116_R08C01",
"201490020133_R01C01", "201490020133_R02C01", "201490020133_R04C01",
"201490020133_R05C01", "201490020133_R06C01", "201490020133_R07C01",
"201490020133_R08C01", "201490020139_R01C01", "201490020139_R02C01",
"201490020139_R03C01", "201490020139_R04C01", "201490020139_R05C01",
"201490020139_R06C01", "201490020139_R07C01", "201490020139_R08C01",
"201490020184_R01C01", "201490020184_R02C01", "201490020184_R03C01",
"201490020184_R04C01", "201490020184_R05C01", "201490020184_R08C01",
"201490030009_R01C01", "201490030009_R02C01", "201490030009_R03C01",
"201490030009_R04C01", "201490030009_R05C01", "201490030009_R06C01",
"201490030009_R07C01", "201490030009_R08C01", "201490030016_R01C01",
"201490030016_R03C01", "201490030016_R04C01", "201490030016_R05C01",
"201490030016_R06C01", "201490030016_R07C01", "201490030016_R08C01",
"201490030018_R01C01", "201490030018_R02C01", "201490030018_R03C01",
"201490030018_R04C01", "201490030018_R05C01", "201490030018_R06C01",
"201490030018_R07C01", "201490030018_R08C01", "201490030052_R01C01",
"201490030052_R02C01", "201490030052_R03C01", "201490030052_R04C01",
"201490030052_R05C01", "201490030052_R06C01", "201490030052_R07C01",
"201490030052_R08C01", "201490030079_R02C01", "201490030079_R03C01",
"201490030079_R04C01", "201490030079_R05C01", "201490030079_R06C01",
"201490030079_R07C01", "201490030079_R08C01", "201490030081_R01C01",
"201490030081_R02C01", "201490030081_R03C01", "201490030081_R05C01",
"201490030081_R06C01", "201490030081_R07C01", "201490030081_R08C01",
"201490030153_R01C01", "201490030153_R02C01", "201490030153_R03C01",
"201490030153_R04C01", "201490030153_R05C01", "201490030153_R06C01",
"201490030153_R07C01", "201490030153_R08C01", "201490030177_R02C01",
"201490030177_R03C01", "201490030177_R04C01", "201490030177_R05C01",
"201490030177_R06C01", "201490030177_R07C01", "201490030177_R08C01",
"201490030196_R01C01", "201490030196_R02C01", "201490030196_R03C01",
"201490030196_R04C01", "201490030196_R05C01", "201490030196_R06C01",
"201490030196_R07C01", "201490030196_R08C01", "201490030241_R01C01",
"201490030241_R02C01", "201490030241_R03C01", "201490030241_R04C01",
"201490030241_R05C01", "201490030241_R06C01", "201490030241_R07C01",
"201490030241_R08C01", "201492560054_R01C01", "201492560054_R02C01",
"201492560054_R03C01", "201492560054_R04C01", "201492560054_R05C01",
"201492560054_R06C01", "201492560054_R07C01", "201492560054_R08C01",
"201492560060_R01C01", "201492560060_R02C01", "201492560060_R03C01",
"201492560060_R04C01", "201492560060_R05C01", "201492560060_R07C01",
"201492560060_R08C01", "201492560073_R01C01", "201492560073_R02C01",
"201492560073_R03C01", "201492560073_R04C01", "201492560073_R05C01",
"201492560073_R06C01", "201492560073_R07C01", "201492560073_R08C01",
"201492560135_R01C01", "201492560135_R02C01", "201492560135_R04C01",
"201492560135_R05C01", "201492560135_R06C01", "201492560135_R07C01",
"201492560135_R08C01", "201492560136_R01C01", "201492560136_R02C01",
"201492560136_R03C01", "201492560136_R04C01", "201492560136_R06C01",
"201492560136_R07C01", "201492560136_R08C01", "201492560137_R01C01",
"201492560137_R02C01", "201492560137_R03C01", "201492560137_R04C01",
"201492560137_R05C01", "201492560137_R06C01", "201492560137_R07C01",
"201492560137_R08C01", "201492560138_R01C01", "201492560138_R03C01",
"201492560138_R04C01", "201492560138_R05C01", "201492560138_R06C01",
"201492560138_R07C01", "201492560138_R08C01", "201492560167_R01C01",
"201492560167_R02C01", "201492560167_R03C01", "201492560167_R04C01",
"201492560167_R05C01", "201492560167_R06C01", "201492560167_R07C01",
"201492560167_R08C01", "201492560190_R01C01", "201492560190_R02C01",
"201492560190_R03C01", "201492560190_R04C01", "201492560190_R05C01",
"201492560190_R06C01", "201492560190_R07C01", "201492560190_R08C01",
"201492560198_R01C01", "201492560198_R02C01", "201492560198_R03C01",
"201492560198_R04C01", "201492560198_R05C01", "201492560198_R06C01",
"201492560198_R07C01", "201492560198_R08C01", "201492560223_R01C01",
"201492560223_R02C01", "201492560223_R04C01", "201492560223_R05C01",
"201492560223_R06C01", "201492560223_R07C01", "201492560223_R08C01",
"201492570153_R01C01", "201492570153_R02C01", "201492570153_R04C01",
"201492570153_R05C01", "201492570153_R06C01", "201492570153_R07C01",
"201492570153_R08C01", "201496710010_R01C01", "201496710010_R02C01",
"201496710010_R03C01", "201496710010_R04C01", "201496710010_R05C01",
"201496710010_R06C01", "201496710010_R07C01", "201496710035_R01C01",
"201496710035_R02C01", "201496710035_R03C01", "201496710035_R05C01",
"201496710035_R06C01", "201496710035_R07C01", "201496710035_R08C01",
"201496710036_R01C01", "201496710036_R02C01", "201496710036_R03C01",
"201496710036_R04C01", "201496710036_R05C01", "201496710036_R06C01",
"201496710036_R07C01", "201496710036_R08C01", "201496710038_R01C01",
"201496710038_R02C01", "201496710038_R03C01", "201496710038_R04C01",
"201496710038_R05C01", "201496710038_R06C01", "201496710038_R07C01",
"201496710038_R08C01", "201496710044_R01C01", "201496710044_R02C01",
"201496710044_R03C01", "201496710044_R04C01", "201496710044_R05C01",
"201496710044_R06C01", "201496710044_R07C01", "201496710044_R08C01",
"201496710047_R01C01", "201496710047_R02C01", "201496710047_R03C01",
"201496710047_R04C01", "201496710047_R05C01", "201496710047_R06C01",
"201496710047_R07C01", "201496710047_R08C01", "201496710061_R02C01",
"201496710061_R03C01", "201496710061_R04C01", "201496710061_R05C01",
"201496710061_R06C01", "201496710061_R07C01", "201496710061_R08C01",
"201496710063_R01C01", "201496710063_R02C01", "201496710063_R03C01",
"201496710063_R04C01", "201496710063_R05C01", "201496710063_R06C01",
"201496710063_R07C01", "201496710063_R08C01", "201496710073_R01C01",
"201496710073_R02C01", "201496710073_R03C01", "201496710073_R04C01",
"201496710073_R05C01", "201496710073_R06C01", "201496710073_R07C01",
"201496710073_R08C01", "201496710077_R01C01", "201496710077_R02C01",
"201496710077_R03C01", "201496710077_R04C01", "201496710077_R05C01",
"201496710077_R06C01", "201496710077_R07C01", "201496710077_R08C01",
"201496710086_R01C01", "201496710086_R02C01", "201496710086_R03C01",
"201496710086_R04C01", "201496710086_R05C01", "201496710086_R06C01",
"201496710086_R07C01", "201496710094_R01C01", "201496710094_R02C01",
"201496710094_R03C01", "201496710094_R04C01", "201496710094_R06C01",
"201496710094_R07C01", "201496710094_R08C01", "201496710095_R01C01",
"201496710095_R02C01", "201496710095_R03C01", "201496710095_R04C01",
"201496710095_R05C01", "201496710095_R06C01", "201496710095_R07C01",
"201496710095_R08C01", "201496710096_R01C01", "201496710096_R03C01",
"201496710096_R04C01", "201496710096_R05C01", "201496710096_R06C01",
"201496710096_R07C01", "201496710096_R08C01", "201496710107_R01C01",
"201496710107_R02C01", "201496710107_R04C01", "201496710107_R05C01",
"201496710107_R06C01", "201496710107_R07C01", "201496710107_R08C01",
"201496710111_R01C01", "201496710111_R02C01", "201496710111_R03C01",
"201496710111_R04C01", "201496710111_R05C01", "201496710111_R06C01",
"201496710111_R07C01", "201496710111_R08C01", "201496710181_R01C01",
"201496710181_R02C01", "201496710181_R03C01", "201496710181_R04C01",
"201496710181_R05C01", "201496710181_R06C01", "201496710181_R07C01",
"201496710181_R08C01", "201496850007_R01C01", "201496850007_R02C01",
"201496850007_R03C01", "201496850007_R04C01", "201496850007_R05C01",
"201496850007_R06C01", "201496850007_R07C01", "201496850007_R08C01",
"201496850008_R01C01", "201496850008_R03C01", "201496850008_R04C01",
"201496850008_R05C01", "201496850008_R06C01", "201496850008_R07C01",
"201496850008_R08C01", "201496850064_R02C01", "201496850064_R03C01",
"201496850064_R04C01", "201496850064_R05C01", "201496850064_R06C01",
"201496850064_R07C01", "201496850064_R08C01", "201496850073_R01C01",
"201496850073_R02C01", "201496850073_R03C01", "201496850073_R04C01",
"201496850073_R05C01", "201496850073_R06C01", "201496850073_R07C01",
"201496850073_R08C01", "201496850089_R01C01", "201496850089_R02C01",
"201496850089_R03C01", "201496850089_R04C01", "201496850089_R05C01",
"201496850089_R06C01", "201496850089_R07C01", "201496850127_R01C01",
"201496850127_R02C01", "201496850127_R03C01", "201496850127_R04C01",
"201496850127_R05C01", "201496850127_R06C01", "201496850127_R07C01",
"201496850127_R08C01", "201496850129_R01C01", "201496850129_R02C01",
"201496850129_R04C01", "201496850129_R05C01", "201496850129_R06C01",
"201496850129_R07C01", "201496850129_R08C01", "201496850130_R01C01",
"201496850130_R02C01", "201496850130_R03C01", "201496850130_R04C01",
"201496850130_R05C01", "201496850130_R06C01", "201496850130_R07C01",
"201496850130_R08C01", "201496850138_R01C01", "201496850138_R02C01",
"201496850138_R03C01", "201496850138_R04C01", "201496850138_R05C01",
"201496850138_R06C01", "201496850138_R07C01", "201496850138_R08C01",
"201496850161_R01C01", "201496850161_R02C01", "201496850161_R03C01",
"201496850161_R04C01", "201496850161_R05C01", "201496850161_R06C01",
"201496850161_R07C01", "201496850161_R08C01", "201496850187_R01C01",
"201496850187_R02C01", "201496850187_R03C01", "201496850187_R04C01",
"201496850187_R05C01", "201496850187_R06C01", "201496850187_R07C01",
"201496850187_R08C01", "201496850188_R03C01", "201496850188_R04C01",
"201496850188_R05C01", "201496850188_R06C01", "201496850188_R07C01",
"201496850188_R08C01", "201496860007_R01C01", "201496860007_R02C01",
"201496860007_R03C01", "201496860007_R04C01", "201496860007_R05C01",
"201496860007_R06C01", "201496860007_R07C01", "201496860007_R08C01",
"201496860008_R01C01", "201496860008_R02C01", "201496860008_R03C01",
"201496860008_R04C01", "201496860008_R05C01", "201496860008_R06C01",
"201496860008_R07C01", "201496860008_R08C01", "201496860026_R01C01",
"201496860026_R02C01", "201496860026_R03C01", "201496860026_R04C01",
"201496860026_R05C01", "201496860026_R06C01", "201496860026_R07C01",
"201496860026_R08C01", "201496860028_R01C01", "201496860028_R02C01",
"201496860028_R04C01", "201496860028_R05C01", "201496860028_R06C01",
"201496860028_R07C01", "201496860028_R08C01", "201496860030_R01C01",
"201496860030_R02C01", "201496860030_R03C01", "201496860030_R04C01",
"201496860030_R05C01", "201496860030_R06C01", "201496860030_R07C01",
"201496860030_R08C01", "201496860045_R01C01", "201496860045_R02C01",
"201496860045_R03C01", "201496860045_R04C01", "201496860045_R05C01",
"201496860045_R06C01", "201496860045_R07C01", "201496860045_R08C01",
"201496860063_R01C01", "201496860063_R02C01", "201496860063_R03C01",
"201496860063_R04C01", "201496860063_R05C01", "201496860063_R06C01",
"201496860063_R08C01", "201496860082_R01C01", "201496860082_R02C01",
"201496860082_R03C01", "201496860082_R04C01", "201496860082_R05C01",
"201496860082_R06C01", "201496860082_R07C01", "201496860082_R08C01",
"201496860101_R01C01", "201496860101_R02C01", "201496860101_R03C01",
"201496860101_R04C01", "201496860101_R05C01", "201496860101_R06C01",
"201496860101_R07C01", "201496860101_R08C01", "201496860112_R01C01",
"201496860112_R02C01", "201496860112_R03C01", "201496860112_R04C01",
"201496860112_R05C01", "201496860112_R06C01", "201496860112_R07C01",
"201496860112_R08C01", "201496860125_R01C01", "201496860125_R02C01",
"201496860125_R03C01", "201496860125_R05C01", "201496860125_R06C01",
"201496860125_R07C01", "201496860125_R08C01", "201496860130_R01C01",
"201496860130_R02C01", "201496860130_R03C01", "201496860130_R04C01",
"201496860130_R05C01", "201496860130_R06C01", "201496860130_R07C01",
"201496860130_R08C01", "201496860133_R01C01", "201496860133_R02C01",
"201496860133_R05C01", "201496860133_R06C01", "201496860133_R07C01",
"201496860133_R08C01", "201496860148_R01C01", "201496860148_R02C01",
"201496860148_R03C01", "201496860148_R04C01", "201496860148_R05C01",
"201496860148_R06C01", "201496860148_R07C01", "201496860148_R08C01",
"201496860165_R01C01", "201496860165_R02C01", "201496860165_R03C01",
"201496860165_R04C01", "201496860165_R05C01", "201496860165_R06C01",
"201496860165_R07C01", "201496860165_R08C01", "201496860171_R01C01",
"201496860171_R02C01", "201496860171_R03C01", "201496860171_R04C01",
"201496860171_R05C01", "201496860171_R06C01", "201496860171_R07C01",
"201496860171_R08C01", "201496860173_R01C01", "201496860173_R02C01",
"201496860173_R03C01", "201496860173_R05C01", "201496860173_R06C01",
"201496860173_R07C01", "201496860173_R08C01", "201496860176_R01C01",
"201496860176_R02C01", "201496860176_R03C01", "201496860176_R04C01",
"201496860176_R05C01", "201496860176_R06C01", "201496860176_R07C01",
"201496860176_R08C01", "201496860177_R02C01", "201496860177_R03C01",
"201496860177_R04C01", "201496860177_R05C01", "201496860177_R07C01",
"201496860177_R08C01", "201496860191_R01C01", "201496860191_R03C01",
"201496860191_R04C01", "201496860191_R05C01", "201496860191_R06C01",
"201496860191_R07C01", "201496860191_R08C01", "201496860196_R01C01",
"201496860196_R02C01", "201496860196_R03C01", "201496860196_R05C01",
"201496860196_R06C01", "201496860196_R07C01", "201496860196_R08C01",
"201503470003_R01C01", "201503470003_R02C01", "201503470003_R03C01",
"201503470003_R04C01", "201503470003_R05C01", "201503470003_R06C01",
"201503470003_R07C01", "201503470003_R08C01", "201503470025_R01C01",
"201503470025_R02C01", "201503470025_R03C01", "201503470025_R04C01",
"201503470025_R05C01", "201503470025_R07C01", "201503470025_R08C01",
"201503470027_R03C01", "201503470027_R04C01", "201503470027_R05C01",
"201503470027_R06C01", "201503470027_R07C01", "201503470027_R08C01",
"201503470038_R01C01", "201503470038_R02C01", "201503470038_R03C01",
"201503470038_R04C01", "201503470038_R08C01", "201503470065_R01C01",
"201503470065_R02C01", "201503470065_R03C01", "201503470065_R04C01",
"201503470065_R06C01", "201503470065_R07C01", "201503470065_R08C01",
"201503470078_R01C01", "201503470078_R02C01", "201503470078_R03C01",
"201503470078_R04C01", "201503470078_R05C01", "201503470078_R06C01",
"201503470078_R07C01", "201503470078_R08C01", "201503670005_R01C01",
"201503670005_R02C01", "201503670005_R03C01", "201503670005_R04C01",
"201503670005_R05C01", "201503670005_R06C01", "201503670005_R07C01",
"201503670006_R01C01", "201503670006_R02C01", "201503670006_R03C01",
"201503670006_R04C01", "201503670006_R05C01", "201503670006_R06C01",
"201503670006_R07C01", "201503670006_R08C01", "201503670012_R01C01",
"201503670012_R02C01", "201503670012_R03C01", "201503670012_R04C01",
"201503670012_R05C01", "201503670012_R06C01", "201503670012_R07C01",
"201503670012_R08C01", "201503670034_R01C01", "201503670034_R02C01",
"201503670034_R03C01", "201503670034_R05C01", "201503670034_R06C01",
"201503670034_R07C01", "201503670034_R08C01", "201503670044_R01C01",
"201503670044_R02C01", "201503670044_R03C01", "201503670044_R04C01",
"201503670044_R05C01", "201503670044_R06C01", "201503670044_R07C01",
"201503670044_R08C01", "201503670049_R01C01", "201503670049_R02C01",
"201503670049_R03C01", "201503670049_R04C01", "201503670049_R05C01",
"201503670049_R06C01", "201503670049_R07C01", "201503670049_R08C01",
"201503670091_R01C01", "201503670091_R02C01", "201503670091_R03C01",
"201503670091_R04C01", "201503670091_R05C01", "201503670091_R06C01",
"201503670091_R07C01", "201503670091_R08C01", "201503670113_R01C01",
"201503670113_R03C01", "201503670113_R04C01", "201503670113_R05C01",
"201503670113_R06C01", "201503670113_R07C01", "201503670113_R08C01",
"201503670115_R02C01", "201503670115_R03C01", "201503670115_R04C01",
"201503670115_R05C01", "201503670115_R06C01", "201503670115_R07C01",
"201503670115_R08C01", "201503670125_R02C01", "201503670125_R03C01",
"201503670125_R04C01", "201503670125_R05C01", "201503670125_R06C01",
"201503670125_R07C01", "201503670125_R08C01", "201503670127_R01C01",
"201503670127_R02C01", "201503670127_R04C01", "201503670127_R05C01",
"201503670127_R06C01", "201503670127_R07C01", "201503670127_R08C01",
"201503670136_R01C01", "201503670136_R02C01", "201503670136_R03C01",
"201503670136_R05C01", "201503670136_R06C01", "201503670136_R07C01",
"201503670136_R08C01", "201503670137_R01C01", "201503670137_R03C01",
"201503670137_R04C01", "201503670137_R05C01", "201503670137_R06C01",
"201503670137_R07C01", "201503670137_R08C01", "201503670138_R01C01",
"201503670138_R02C01", "201503670138_R03C01", "201503670138_R04C01",
"201503670138_R05C01", "201503670138_R06C01", "201503670138_R07C01",
"201503670138_R08C01", "201503670140_R01C01", "201503670140_R02C01",
"201503670140_R03C01", "201503670140_R04C01", "201503670140_R05C01",
"201503670140_R06C01", "201503670140_R07C01", "201503670140_R08C01",
"201503670152_R01C01", "201503670152_R02C01", "201503670152_R04C01",
"201503670152_R05C01", "201503670152_R06C01", "201503670152_R07C01",
"201503670152_R08C01", "201503670165_R01C01", "201503670165_R02C01",
"201503670165_R03C01", "201503670165_R04C01", "201503670165_R05C01",
"201503670165_R06C01", "201503670165_R07C01", "201503670165_R08C01",
"201503670167_R01C01", "201503670167_R02C01", "201503670167_R03C01",
"201503670167_R04C01", "201503670167_R05C01", "201503670167_R06C01",
"201503670167_R07C01", "201503670167_R08C01", "201503670183_R01C01",
"201503670183_R02C01", "201503670183_R03C01", "201503670183_R04C01",
"201503670183_R05C01", "201503670183_R06C01", "201503670183_R07C01",
"201503670183_R08C01", "201503670184_R01C01", "201503670184_R02C01",
"201503670184_R03C01", "201503670184_R04C01", "201503670184_R05C01",
"201503670184_R06C01", "201503670184_R07C01", "201503670184_R08C01",
"201503670190_R01C01", "201503670190_R02C01", "201503670190_R03C01",
"201503670190_R04C01", "201503670190_R05C01", "201503670190_R06C01",
"201503670190_R07C01", "201503670190_R08C01", "201503670191_R01C01",
"201503670191_R02C01", "201503670191_R03C01", "201503670191_R04C01",
"201503670191_R05C01", "201503670191_R06C01", "201503670191_R07C01",
"201503670191_R08C01", "201503670201_R01C01", "201503670201_R03C01",
"201503670201_R04C01", "201503670201_R05C01", "201503670201_R06C01",
"201503670201_R07C01", "201503670201_R08C01"), class = "factor"),
new_value = c(0.917332051233228, 0.934229622581678, 0.948445874060236,
0.894769062983977, 0.938478109726929, 0.962743150108134,
0.958698210677898, 0.970638431152643, 0.944673040712397,
0.967456063987761, 0.940349992631848, 0.959782923419344,
0.955331108269665, 0.9384376923857, 0.944387779753246, 0.936048669352623,
0.963576852802152, 0.955200250025058, 0.88897291534105, 0.965862263740485,
0.923797015700323, 0.948964575338992, 0.947709791612548,
0.944971488435348, 0.944615701111974, 0.902142158325627,
0.943790493218177, 0.961096655942385, 0.960656120717624,
0.959206307985572, 0.965459139938961, 0.967297803946416,
0.972960521426889, 0.946393263322362, 0.873428191965011),
old_value = c(0.515690662525024, 0.534369339172159, 0.545615288282488,
0.545714353255571, 0.589563099936732, 0.436133151885182,
0.491232486991768, 0.449160372570262, 0.565050733855713,
0.525907944036624, 0.560854975327333, 0.526114003234173,
0.536534878098628, 0.605740361883492, 0.522474345659614,
0.562865160513985, 0.495346007267898, 0.482060690151413,
0.55257739665539, 0.426897632986784, 0.649520613868939, 0.453104345756112,
0.545263969138834, 0.560609732844838, 0.495499667637053,
0.679051065849815, 0.54162095963395, 0.474142335644699, 0.650514266798773,
0.489499392739077, 0.454189613481646, 0.56212314353812, 0.459838989342173,
0.732112228394545, 0.555150658452942)), class = "data.frame", row.names = c(NA,
-35L))
这是我运行的原始代码
subset_df$Avg <- (subset_df$new_value + subset_df$old_value) / 2
subset_df$Diff <- subset_df$new_value - subset_df$old_value
ggplot(subset_df, aes(x = Avg, y = Diff)) +
geom_point(alpha = 0.5) +
geom_hline(yintercept = mean(subset_df$Diff), colour = "blue", size = 0.5) +
geom_hline(yintercept = mean(subset_df$Diff) - (1.96 * sd(subset_df$Diff)), colour = "red", size = 0.5) +
geom_hline(yintercept = mean(subset_df$Diff) + (1.96 * sd(subset_df$Diff)), colour = "red", size = 0.5) +
ylab("Diff. Between Measures") +
xlab("Average Measure")
所有这些BA图都有一个有问题的斜率,这显然是由于违反了两个测量值应具有相同方差的BA假设所致。查看此链接:https://analyticastats.wordpress.com/2014/08/29/theres-something-wrong-with-my-bland-altman-plot/
因此,我按照该帖子的建议改用weighted average
:
subset_df$WeightedAvg <- (var(subset_df$old_value) - cov(subset_df$new_value, subset_df$old_value)) / (var(subset_df$new_value) - 2*cov(subset_df$new_value, subset_df$old_value) + var(subset_df$old_value))
subset_df$Diff <- subset_df$new_value - subset_df$old_value
temp_plot <- ggplot(subset_df, aes(x = WeightedAvg, y = Diff)) +
geom_point(alpha = 0.5) +
geom_hline(yintercept = mean(subset_df$Diff), colour = "blue", size = 0.5) +
geom_hline(yintercept = mean(subset_df$Diff) - (1.96 * sd(subset_df$Diff)), colour = "red", size = 0.5) +
geom_hline(yintercept = mean(subset_df$Diff) + (1.96 * sd(subset_df$Diff)), colour = "red", size = 0.5) +
ylab("Diff. Between Measures") +
xlab("Weighted Average Measure")
现在,BA图看起来所有点都属于weighted average measure
的单个值,该值也不正确。
正在寻找帮助解释此结果的方法,或者我在尝试计算加权平均数时出错了?如果是这样,我们很乐意接受更正!
答案 0 :(得分:1)
如果您查看数据框中的WeightedAvg
列,您会发现所有值实际上都是相同的。此错误是由于您实际上没有使用加权平均值引起的!相反,您使用的是权重之一。
具体地说,您没有计算加权平均值 [α* N +(α-1)* O] / 2 ,而是计算了权重α一个常数。在这里,α是应用于new_value
的权重, N 和 O 是指new_value
和{{1 }}, 分别。应用于old_value
的权重只是 1-α。
您有点倒霉,因为您提供的链接并未对如何实际施加权重给出特别明确的解释。更糟糕的是,您选择计算的第一个权重恰好落在数据范围内,从而使您的问题似乎只是某种绘图错误。
改为尝试以下代码:
old_value
结果图: