这位心脏病学教授写了一个R包,解释置信区间到底是怎么回事!
install.packages("interpretCI")
install.packages("PairedData")
library(interpretCI)
library(PairedData)
summary(mtcars)

meanCI(mtcars$mpg)

meanCI(mtcars$mpg) |>
plot()

interpret(meanCI(mtcars$mpg))

summary(iris)

meanCI(iris$Sepal.Length, iris$Sepal.Width)

t.test(iris$Sepal.Length, iris$Sepal.Width)

meanCI(iris$Sepal.Length, iris$Sepal.Width) |>
plot(ref = "control", side = FALSE)

data(Anorexia)
summary(Anorexia)

meanCI(Anorexia, Prior, Post, paired = TRUE) |>
plot(ref = "test", side = FALSE)

t.test(Anorexia$Prior, Anorexia$Post, paired = TRUE)

meanCI(iris, Species, Sepal.Length)

meanCI(iris, Species, Sepal.Length) |> plot()

meanCI(iris, Species, Sepal.Length,
mu = 0) |> plot()

data(anscombe2)
anscombe2

meanCI(anscombe2,
idx = list(c("X1","Y1"),
c("X2","Y2"),
c("X3","Y3")),
paired = TRUE, mu = 0) |>
plot()

summary(acs)

acs |>
subset(select = c(sex, TC, TG, HDLC)) |>
meanCI(sex, mu = 0)

acs |>
subset(select = c(sex, TC, TG, HDLC)) |>
meanCI(sex, mu = 0) |>
plot()



https://cran.r-project.org/web/packages/interpretCI/index.html
2024-05-02 09:15