Для непосвященных: Диаграмма Леви-Дженнинга - это диаграмма, используемая для управления образцами контроля качества, особенно в медицинской лаборатории.Ось Y - нет.SD и ось X должны быть временными метками.
Изменено из ответа Тима Риффе сверху.Это должно быть больше подходит для лабораторного использования.
# LJchart
# modified from Tim Riffe's answer on StackOverflow
#
# Version history:
# 1.1 Added support for timestamp on each datapoint
# Added rectangle to delineate the 2SD boundary, limited the scope to 3 SD
#
# Usage:
# LJchart( [Series of values], [Series of timestamp], [Manufacturer set mean], [Manufacturer set SD] )
# e.g.
# creatinineLV1 <- c(52, 51, 48, 51, 42, 48, 46, 44, 45, 51, 51,
# 46, 50, 45, 52, 41, 58, 45, 44, 44, 42, 47,
# 45, 43, 48, 43, 47, 47, 48)
# timeCRLV1 <- c(41267.41106, 41267.51615, 41267.64512, 41267.683,
# 41268.32005, 41269.55979, 41269.62026, 41269.88109,
# 41270.20442, 41270.5897, 41270.61914, 41270.66589,
# 41270.76311, 41271.43517, 41271.58534, 41271.69562,
# 41271.75682, 41272.43492, 41272.51768, 41272.53,
# 41272.59527, 41273.38759, 41273.46314, 41273.49382,
# 41273.6311, 41273.66563, 41273.78007, 41273.82463,
# 41273.88547)
# > LJchart(creatinineLV1, timeCRLV1, 50, 6)
LJchart <- function(series1, series2, meanx, sdx){
xbar <- mean(series1)
se <- sd(series1)
conv.series <- (series1 - meanx) / sdx
plot(series2, conv.series, type = "n", ylim=c(-3,+3))
rect(0, -2, max(series2)+1, 2, col = gray(.9), border = NA)
rect(0, -1, max(series2)+1, 1, col = gray(.8), border = NA)
lines(series2, conv.series)
points(series2, conv.series)
title(paste("calculated mean value of", round(xbar,3),
"\ncalculated standard deviation of", round(se,3)))
}