Title: | Estimate the Confidence Interval and Interpret Step by Step |
---|---|
Description: | Estimate confidence intervals for mean, proportion, mean difference for unpaired and paired samples and proportion difference. Plot the confidence intervals. Generate documents explaining the statistical result step by step. |
Authors: | Keon-Woong Moon [aut, cre] |
Maintainer: | Keon-Woong Moon <[email protected]> |
License: | GPL-3 |
Version: | 0.1.2 |
Built: | 2024-10-29 04:48:09 UTC |
Source: | https://github.com/cardiomoon/interpretci |
A dataset containing demographic data and laboratory data of 857 patients with acute coronary syndrome(ACS).
acs
acs
An object of class data.frame
with 857 rows and 17 columns.
interpretCI::acs
interpretCI::acs
Draw normal distribution curve
draw_n(mean = 0, sd = 1, z = NULL, p = 0.05, alternative = "two.sided")
draw_n(mean = 0, sd = 1, z = NULL, p = 0.05, alternative = "two.sided")
mean |
vector of means |
sd |
vector of standard deviations |
z |
vector of quantiles |
p |
vector of probabilities |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
A ggplot
draw_n() draw_n(alternative="less") draw_n(alternative="greater") draw_n(z=-1.75) draw_n(z=-1.75,alternative="greater") draw_n(z=-1.75,alternative="less")
draw_n() draw_n(alternative="less") draw_n(alternative="greater") draw_n(z=-1.75) draw_n(z=-1.75,alternative="greater") draw_n(z=-1.75,alternative="less")
Draw t distribution curve
draw_t(DF = 50, t = NULL, p = 0.05, alternative = "two.sided")
draw_t(DF = 50, t = NULL, p = 0.05, alternative = "two.sided")
DF |
numeric degree of freedom |
t |
numeric t value |
p |
numeric p value |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
A ggplot
draw_t(DF=30) draw_t(DF=20,t=2.5) draw_t(DF=49,t=1.77) draw_t(DF=49,p=0.005) draw_t(DF=19,t=-0.894,alternative="less") draw_t(DF=146,t=0.67,alternative="greater")
draw_t(DF=30) draw_t(DF=20,t=2.5) draw_t(DF=49,t=1.77) draw_t(DF=49,p=0.005) draw_t(DF=19,t=-0.894,alternative="less") draw_t(DF=146,t=0.67,alternative="greater")
Draw chi-squared distribution curve
draw_x2(q = NULL, p = 0.05, df = 2)
draw_x2(q = NULL, p = 0.05, df = 2)
q |
vector of quantiles |
p |
vector of probabilities |
df |
degrees of freedom (non-negative, but can be non-integer). |
A ggplot
draw_x2(df=1) draw_x2(q=0.78)
draw_x2(df=1) draw_x2(q=0.78)
Convert numeric to string with uppercase first letter
English(x, digits = 2)
English(x, digits = 2)
x |
A numeric |
digits |
integer indicating the number of decimal places |
A string
English(40) English(13.1)
English(40) English(13.1)
Convert numeric to string
english2(x, digits = 2)
english2(x, digits = 2)
x |
A numeric |
digits |
integer indicating the number of decimal places |
A character string
english2(45) english2(12.34)
english2(45) english2(12.34)
Draw estimation plot1
estimationPlot1(x, palette = NULL)
estimationPlot1(x, palette = NULL)
x |
An object of class meanCI |
palette |
The name of color palette from RColorBrewer package or NULL |
A ggplot
x=meanCI(iris,Species,Sepal.Length) estimationPlot1(x)
x=meanCI(iris,Species,Sepal.Length) estimationPlot1(x)
Interpret an object of meanCI. Render appropriate rmarkdown file to html file and show RStudio viewer or browser.
interpret(x, viewer = "rstudio")
interpret(x, viewer = "rstudio")
x |
An object of class "meanCI" |
viewer |
Character One of c("rstudio","browser") |
No return value, called for side effect
x=meanCI(mtcars$mpg) x=meanCI(mtcars,mpg,mu=23) x=meanCI(n=150,m=115,s=10,alpha=0.01) x=meanCI(n=50,m=295,s=20,mu=300) x= meanCI(n=20,m=108,s=10,mu=110,alpha=0.01,alternative="less") x=meanCI(n1=500,n2=1000,m1=20,s1=3,m2=15,s2=2,alpha=0.01) x=meanCI(n1=15,n2=20,m1=1000,s1=100,m2=950,s2=90,alpha=0.1) x=meanCI(n1=30,n2=25,m1=78,s1=10,m2=85,s2=15,mu=0,alpha=0.10) x=meanCI(n1=100,n2=100,m1=200,s1=40,m2=190,s2=20,mu=7,alpha=0.05,alternative="greater") x1=c(95,89,76,92,91,53,67,88,75,85,90,85,87,85,85,68,81,84,71,46,75,80) y1=c(90,85,73,90,90,53,68,90,78,89,95,83,83,83,82,65,79,83,60,47,77,83) x=meanCI(x=x1,y=y1,paired=TRUE,alpha=0.1,mu=0) x=propCI(n=1600,p=0.4,alpha=0.01) x=propCI(n=100,p=0.73,P=0.8,alpha=0.01) x=propCI(n=100,p=0.73,P=0.8,alpha=0.05,alternative="greater") x=propCI(n1=100,n2=200,p1=0.38,p2=0.51,alpha=0.01) x=propCI(n1=150,n2=100,p1=0.71,p2=0.63,P=0,alternative="greater") ## Not run: interpret(x) interpret(x,"browser") ## End(Not run)
x=meanCI(mtcars$mpg) x=meanCI(mtcars,mpg,mu=23) x=meanCI(n=150,m=115,s=10,alpha=0.01) x=meanCI(n=50,m=295,s=20,mu=300) x= meanCI(n=20,m=108,s=10,mu=110,alpha=0.01,alternative="less") x=meanCI(n1=500,n2=1000,m1=20,s1=3,m2=15,s2=2,alpha=0.01) x=meanCI(n1=15,n2=20,m1=1000,s1=100,m2=950,s2=90,alpha=0.1) x=meanCI(n1=30,n2=25,m1=78,s1=10,m2=85,s2=15,mu=0,alpha=0.10) x=meanCI(n1=100,n2=100,m1=200,s1=40,m2=190,s2=20,mu=7,alpha=0.05,alternative="greater") x1=c(95,89,76,92,91,53,67,88,75,85,90,85,87,85,85,68,81,84,71,46,75,80) y1=c(90,85,73,90,90,53,68,90,78,89,95,83,83,83,82,65,79,83,60,47,77,83) x=meanCI(x=x1,y=y1,paired=TRUE,alpha=0.1,mu=0) x=propCI(n=1600,p=0.4,alpha=0.01) x=propCI(n=100,p=0.73,P=0.8,alpha=0.01) x=propCI(n=100,p=0.73,P=0.8,alpha=0.05,alternative="greater") x=propCI(n1=100,n2=200,p1=0.38,p2=0.51,alpha=0.01) x=propCI(n1=150,n2=100,p1=0.71,p2=0.63,P=0,alternative="greater") ## Not run: interpret(x) interpret(x,"browser") ## End(Not run)
Decide whether a vector can be treated as a numeric variable
is.mynumeric(x, maxy.lev = 5)
is.mynumeric(x, maxy.lev = 5)
x |
A vector |
maxy.lev |
An integer indicating the maximum number of unique values of a numeric variable be treated as a categorical variable |
logical
x=1:5 is.mynumeric(x) x=1:13 is.mynumeric(x)
x=1:5 is.mynumeric(x) x=1:13 is.mynumeric(x)
Whether the arg is provided in function call
isProvided(x, seek = "mu")
isProvided(x, seek = "mu")
x |
An object of class "meanCI" or function call or character string |
seek |
character. Default="mu" |
logical
x=meanCI(mtcars,am,mpg) isProvided(x)
x=meanCI(mtcars,am,mpg) isProvided(x)
Calculate confidence intervals of mean or difference between means
meanCI(x, ...)
meanCI(x, ...)
x |
An object of class data.frame or vector |
... |
Further arguments |
An object of class "meanCI" which is a list containing at least the following components:
A tibble containing raw data or a list of numeric vector
A data.frame consist of summary statistics
the matched call
character. One of c("mean","unpaired","paired")
meanCI(mtcars$mpg) meanCI(n=150,m=115,s=10,alpha=0.01) meanCI(n=50,m=295,s=20,mu=300) meanCI(n=20,m=108,s=10,mu=110,alpha=0.01,alternative="less") meanCI(mtcars,am,mpg) meanCI(n1=15,n2=20,m1=1000,s1=100,m2=950,s2=90,alpha=0.1) meanCI(n1=500,n2=1000,m1=20,s1=3,m2=15,s2=2,alpha=0.01) meanCI(n1=30,n2=25,m1=78,s1=10,m2=85,s2=15,alpha=0.10) meanCI(n1=100,n2=100,m1=200,s1=40,m2=190,s2=20,mu=7,alpha=0.05,alternative="greater") x=c(3.04,2.92,2.86,1.71,3.60,3.49,3.30,2.28,3.11,2.88,2.82,2.13,2.11,3.03,3.27,2.60,3.13) y=c(2.56,3.47,2.65,2.77,3.26,3.00,2.70,3.20,3.39,3.00,3.19,2.58,2.98) meanCI(x=x,y=y) x=c(95,89,76,92,91,53,67,88,75,85,90,85,87,85,85,68,81,84,71,46,75,80) y=c(90,85,73,90,90,53,68,90,78,89,95,83,83,83,82,65,79,83,60,47,77,83) meanCI(x=x,y=y,paired=TRUE,alpha=0.1) meanCI(10:30,1:15) meanCI(acs,sex,age) meanCI(iris$Sepal.Width,iris$Sepal.Length) meanCI(iris$Sepal.Width,iris$Sepal.Length,paired=TRUE)
meanCI(mtcars$mpg) meanCI(n=150,m=115,s=10,alpha=0.01) meanCI(n=50,m=295,s=20,mu=300) meanCI(n=20,m=108,s=10,mu=110,alpha=0.01,alternative="less") meanCI(mtcars,am,mpg) meanCI(n1=15,n2=20,m1=1000,s1=100,m2=950,s2=90,alpha=0.1) meanCI(n1=500,n2=1000,m1=20,s1=3,m2=15,s2=2,alpha=0.01) meanCI(n1=30,n2=25,m1=78,s1=10,m2=85,s2=15,alpha=0.10) meanCI(n1=100,n2=100,m1=200,s1=40,m2=190,s2=20,mu=7,alpha=0.05,alternative="greater") x=c(3.04,2.92,2.86,1.71,3.60,3.49,3.30,2.28,3.11,2.88,2.82,2.13,2.11,3.03,3.27,2.60,3.13) y=c(2.56,3.47,2.65,2.77,3.26,3.00,2.70,3.20,3.39,3.00,3.19,2.58,2.98) meanCI(x=x,y=y) x=c(95,89,76,92,91,53,67,88,75,85,90,85,87,85,85,68,81,84,71,46,75,80) y=c(90,85,73,90,90,53,68,90,78,89,95,83,83,83,82,65,79,83,60,47,77,83) meanCI(x=x,y=y,paired=TRUE,alpha=0.1) meanCI(10:30,1:15) meanCI(acs,sex,age) meanCI(iris$Sepal.Width,iris$Sepal.Length) meanCI(iris$Sepal.Width,iris$Sepal.Length,paired=TRUE)
Calculate confidence intervals of mean or difference between means in a data.frame
## S3 method for class 'data.frame' meanCI(x, ...) meanCI_sub(data = data, x, y, group, paired = FALSE, idx = NULL, ...)
## S3 method for class 'data.frame' meanCI(x, ...) meanCI_sub(data = data, x, y, group, paired = FALSE, idx = NULL, ...)
x |
Name of a categorical or numeric column. If !missing(y), name of continuous variable |
... |
Further arguments to be passed to meanCI |
data |
A data.frame |
y |
Name of a numeric column |
group |
Name of categorical column |
paired |
logical |
idx |
A vector containing factors or strings in the x columns. These must be quoted (ie. surrounded by quotation marks). The first element will be the control group, so all differences will be computed for every other group and this first group. |
An object of class "meanCI" which is a list containing at least the following components:
A tibble containing raw data or a list of numeric vector
A data.frame consists of summary statistics
the matched call
character. One of c("mean","unpaired","paired")
meanCI
: S3 method for data.frame
meanCI(acs,age) meanCI(acs,sex,age) meanCI(acs,Dx,age) acs %>% select(age) %>% meanCI() acs %>% select(sex,age) %>% meanCI() meanCI(iris,Species,Sepal.Length) meanCI(iris,Sepal.Width,Sepal.Length,paired=TRUE) meanCI(iris,Sepal.Length,Sepal.Width) iris %>% select(starts_with("Petal")) %>% meanCI(paired=TRUE) iris %>% meanCI(paired=TRUE) meanCI(acs,sex,age,Dx,mu=10) acs %>% select(sex,TC,TG,HDLC) %>% meanCI(group=sex) acs %>% select(sex,TC,TG,HDLC) %>% meanCI(sex) iris %>% select(Species,starts_with("Sepal")) %>% meanCI(Species) iris %>% select(Species,starts_with("Sepal")) %>% meanCI(group=Species)
meanCI(acs,age) meanCI(acs,sex,age) meanCI(acs,Dx,age) acs %>% select(age) %>% meanCI() acs %>% select(sex,age) %>% meanCI() meanCI(iris,Species,Sepal.Length) meanCI(iris,Sepal.Width,Sepal.Length,paired=TRUE) meanCI(iris,Sepal.Length,Sepal.Width) iris %>% select(starts_with("Petal")) %>% meanCI(paired=TRUE) iris %>% meanCI(paired=TRUE) meanCI(acs,sex,age,Dx,mu=10) acs %>% select(sex,TC,TG,HDLC) %>% meanCI(group=sex) acs %>% select(sex,TC,TG,HDLC) %>% meanCI(sex) iris %>% select(Species,starts_with("Sepal")) %>% meanCI(Species) iris %>% select(Species,starts_with("Sepal")) %>% meanCI(group=Species)
Calculate confidence intervals of mean or difference between means
## Default S3 method: meanCI(x, ...) meanCI2( x, y, n, m, s, n1, n2, m1, m2, s1, s2, mu = 0, paired = FALSE, var.equal = FALSE, alpha = 0.05, digits = 2, alternative = "two.sided" )
## Default S3 method: meanCI(x, ...) meanCI2( x, y, n, m, s, n1, n2, m1, m2, s1, s2, mu = 0, paired = FALSE, var.equal = FALSE, alpha = 0.05, digits = 2, alternative = "two.sided" )
x |
A vector |
... |
Further arguments to be passed to meanCI2 |
y |
A vector |
n , n1 , n2
|
integer sample(s) size |
m , m1 , m2
|
Numeric mean value of sample(s) |
s , s1 , s2
|
Numeric standard deviation of sample(s) |
mu |
numeric hypothesized true value of mean or mean difference |
paired |
logical If true, difference between paired sample calculated |
var.equal |
logical If true, pooled standard deviation is used |
alpha |
Numeric Confidence level |
digits |
integer indicating the number of decimal places |
alternative |
A character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
An object of class "meanCI" which is a list containing at least the following components:
A tibble containing raw data or a list of numeric vector
A data.frame containing of summary statistics
the matched call
character. One of c("mean","unpaired","paired")
meanCI
: Default S3 method
Prepare data to plot from an object of class meanCI
meanCI2df(x)
meanCI2df(x)
x |
An object of class meanCI |
A data.frame
x=meanCI(acs,sex,age) meanCI2df(x)
x=meanCI(acs,sex,age) meanCI2df(x)
Extract data from an object of class meanCI
meanCI2df1(x)
meanCI2df1(x)
x |
An object of class meanCI |
A data.frame summarizing mean and confidence interval
x=meanCI(acs,sex,age) meanCI2df1(x)
x=meanCI(acs,sex,age) meanCI2df1(x)
Draw meanCI plot for data with single vector
meanCIplot1(x)
meanCIplot1(x)
x |
An object of class "meanCI" with attr(x,"measure")=="mean" |
A ggplot
x=meanCI(mtcars,mpg) meanCIplot1(x)
x=meanCI(mtcars,mpg) meanCIplot1(x)
Draw a pair plot with an object of class meanCI
pairPlot(x, palette = NULL)
pairPlot(x, palette = NULL)
x |
An object of class "meanCI" with attr(x,"measure")=="paired" |
palette |
The name of color palette from RColorBrewer package or NULL |
A ggplot
x=meanCI(iris,paired=TRUE) pairPlot(x) x=meanCI(iris,Petal.Width, Petal.Length,paired=TRUE) pairPlot(x)
x=meanCI(iris,paired=TRUE) pairPlot(x) x=meanCI(iris,Petal.Width, Petal.Length,paired=TRUE) pairPlot(x)
Draw a pair plot
pairPlot1(data, ref = NULL, palette = NULL)
pairPlot1(data, ref = NULL, palette = NULL)
data |
a data.frame |
ref |
Numeric or NULL |
palette |
The name of color palette from RColorBrewer package or NULL |
A ggplot
x=meanCI(mtcars,paired=TRUE) pairPlot1(x$data) pairPlot1(x$data,ref=c(1,4,6)) pairPlot1(x$data,ref=c(1,3))
x=meanCI(mtcars,paired=TRUE) pairPlot1(x$data) pairPlot1(x$data,ref=c(1,4,6)) pairPlot1(x$data,ref=c(1,3))
Extract hexadecimal colors from a color palette
palette2colors(name, reverse = FALSE)
palette2colors(name, reverse = FALSE)
name |
The name of color palette from RColorBrewer package |
reverse |
Whether or not reverse the order of colors |
hexadecimal colors
palette2colors("Reds")
palette2colors("Reds")
S3 method for an object of class "meanCI"
## S3 method for class 'meanCI' plot(x, ref = "control", side = NULL, palette = NULL, ...)
## S3 method for class 'meanCI' plot(x, ref = "control", side = NULL, palette = NULL, ...)
x |
an object of class "meanCI" |
ref |
string One of c("test","control"). |
side |
logical or NULL If true draw side by side plot |
palette |
The name of color palette from RColorBrewer package or NULL |
... |
Further arguments to be passed |
A ggplot or an object of class "plotCI" containing at least the following components: '
A ggplot
A ggplot
logical
meanCI(mtcars,mpg) %>% plot() meanCI(mtcars,am,mpg) %>% plot() meanCI(iris,Sepal.Width) %>% plot() meanCI(iris,Sepal.Width,Sepal.Length) %>% plot() meanCI(iris,Sepal.Width,Sepal.Length,paired=TRUE) %>% plot(palette="Dark2") meanCI(iris,Sepal.Width,Sepal.Length) %>% plot() meanCI(iris,Species,Sepal.Width) %>% plot(side=TRUE) meanCI(iris,Species,Sepal.Width,mu=0.5,alternative="less") %>% plot(ref="test") meanCI(acs,age) %>% plot() meanCI(acs,sex,age) %>% plot() meanCI(acs,smoking,age) %>% plot(palette="Set1") meanCI(acs,Dx,age) %>% plot() meanCI(acs,Dx,age,sex,mu=0) %>% plot(palette="Dark2") x=c(95,89,76,92,91,53,67,88,75,85,90,85,87,85,85,68,81,84,71,46,75,80) y=c(90,85,73,90,90,53,68,90,78,89,95,83,83,83,82,65,79,83,60,47,77,83) meanCI(x=x,y=y,paired=TRUE,alpha=0.1) %>% plot() meanCI(10:30,1:15) %>% plot() iris %>% meanCI() %>% plot(side=TRUE) meanCI(n=150,m=115,s=10,alpha=0.01) %>% plot() meanCI(n1=30,n2=25,m1=78,s1=10,m2=85,s2=15,alpha=0.10) %>% plot() data(anscombe2,package="PairedData") meanCI(anscombe2,idx=list(c("X1","Y1"),c("X4","Y4"),c("X3","Y3"),c("X2","Y2")), paired=TRUE,mu=0) %>% plot() x=meanCI(anscombe2,idx=list(c("X1","X2","X3","X4"),c("Y1","Y2","Y3","Y4")),paired=TRUE,mu=0) plot(x) longdf=tidyr::pivot_longer(anscombe2,cols=X1:Y4) x=meanCI(longdf,name,value,idx=list(c("X1","X2","X3","X4"),c("Y1","Y2","Y3","Y4")),paired=TRUE,mu=0) plot(x) acs %>% select(sex,TC,TG,HDLC) %>% meanCI(group=sex) %>% plot() acs %>% select(sex,TC,TG,HDLC) %>% meanCI(sex) %>% plot()
meanCI(mtcars,mpg) %>% plot() meanCI(mtcars,am,mpg) %>% plot() meanCI(iris,Sepal.Width) %>% plot() meanCI(iris,Sepal.Width,Sepal.Length) %>% plot() meanCI(iris,Sepal.Width,Sepal.Length,paired=TRUE) %>% plot(palette="Dark2") meanCI(iris,Sepal.Width,Sepal.Length) %>% plot() meanCI(iris,Species,Sepal.Width) %>% plot(side=TRUE) meanCI(iris,Species,Sepal.Width,mu=0.5,alternative="less") %>% plot(ref="test") meanCI(acs,age) %>% plot() meanCI(acs,sex,age) %>% plot() meanCI(acs,smoking,age) %>% plot(palette="Set1") meanCI(acs,Dx,age) %>% plot() meanCI(acs,Dx,age,sex,mu=0) %>% plot(palette="Dark2") x=c(95,89,76,92,91,53,67,88,75,85,90,85,87,85,85,68,81,84,71,46,75,80) y=c(90,85,73,90,90,53,68,90,78,89,95,83,83,83,82,65,79,83,60,47,77,83) meanCI(x=x,y=y,paired=TRUE,alpha=0.1) %>% plot() meanCI(10:30,1:15) %>% plot() iris %>% meanCI() %>% plot(side=TRUE) meanCI(n=150,m=115,s=10,alpha=0.01) %>% plot() meanCI(n1=30,n2=25,m1=78,s1=10,m2=85,s2=15,alpha=0.10) %>% plot() data(anscombe2,package="PairedData") meanCI(anscombe2,idx=list(c("X1","Y1"),c("X4","Y4"),c("X3","Y3"),c("X2","Y2")), paired=TRUE,mu=0) %>% plot() x=meanCI(anscombe2,idx=list(c("X1","X2","X3","X4"),c("Y1","Y2","Y3","Y4")),paired=TRUE,mu=0) plot(x) longdf=tidyr::pivot_longer(anscombe2,cols=X1:Y4) x=meanCI(longdf,name,value,idx=list(c("X1","X2","X3","X4"),c("Y1","Y2","Y3","Y4")),paired=TRUE,mu=0) plot(x) acs %>% select(sex,TC,TG,HDLC) %>% meanCI(group=sex) %>% plot() acs %>% select(sex,TC,TG,HDLC) %>% meanCI(sex) %>% plot()
S3 method "print" for class "meanCI"
## S3 method for class 'meanCI' print(x, ...)
## S3 method for class 'meanCI' print(x, ...)
x |
An object of class "meanCI" |
... |
Further arguments |
No return value, called for side effect
S3 method for class plotCI
## S3 method for class 'plotCI' print(x, ...)
## S3 method for class 'plotCI' print(x, ...)
x |
An object of class plotCI |
... |
Further arguments |
No return value, called for side effect
Calculate confidence intervals of proportion or difference between proportions
propCI( x, y, n, p, n1, n2, p1, p2, P = 0, alpha = 0.05, digits = 2, alternative = "two.sided" )
propCI( x, y, n, p, n1, n2, p1, p2, P = 0, alpha = 0.05, digits = 2, alternative = "two.sided" )
x |
A vector |
y |
A vector |
n , n1 , n2
|
integer sample size |
p , p1 , p2 , P
|
Numeric proportion |
alpha |
numeric confidence level |
digits |
integer indicating the number of decimal places |
alternative |
A character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". |
A list containing at least the following components:
A tibble containing raw data or a list of numeric vector
A data.frame consists of summary statistics
the matched call
character. One of c("prop","propdiff")
#'@examples propCI(acs$sex) propCI(acs$sex,acs$DM) propCI(n=1600,p=0.4,alpha=0.01) propCI(n=100,p=0.73,P=0.8,alpha=0.01) propCI(n1=400,n2=300,p1=0.4,p2=0.3,alpha=0.1) propCI(n1=100,n2=200,p1=0.38,p2=0.51,alpha=0.01) propCI(n1=100,n2=200,p1=0.38,p2=0.51,alpha=0.01,alternative="less")
Calculate confidence intervals of proportion or difference between proportions in a data.frame
propCI_sub(data, x, y = NULL)
propCI_sub(data, x, y = NULL)
data |
A data.frame |
x |
Character Name of a categorical column |
y |
Character Optional. Name of another categorical column |
A list containing at least the following components:
A tibble containing raw data or a list of numeric vector
A data.frame consists of summary statistics
the matched call
character. One of c("prop","propdiff")
propCI_sub(acs,"sex") propCI_sub(acs,"sex","HBP")
propCI_sub(acs,"sex") propCI_sub(acs,"sex","HBP")
Show html file in RStudio viewer or browser
rstudio_viewer(file_name, file_path = NULL, viewer = "rstudio")
rstudio_viewer(file_name, file_path = NULL, viewer = "rstudio")
file_name |
character file name |
file_path |
character file path |
viewer |
Character One of c("rstudio","browser") |
No return value, called for side effect
Show t-value table
show_t_table(DF = 20, t = NULL, p = 0.05, alternative = "two.sided")
show_t_table(DF = 20, t = NULL, p = 0.05, alternative = "two.sided")
DF |
Numeric degree of freedom |
t |
Numeric vector of quantile |
p |
Numeric probability |
alternative |
Character One of c("two.sided","greater","less") |
An object of class "flextable"
show_t_table() show_t_table(t=1.4) show_t_table(DF=10)
show_t_table() show_t_table(t=1.4) show_t_table(DF=10)
Show chisquare table
show_x2_table(DF = 1, x2 = NULL, p = 0.05)
show_x2_table(DF = 1, x2 = NULL, p = 0.05)
DF |
Numeric degree of freedom |
x2 |
Numeric vector of chi-square value |
p |
Numeric probability |
An object of class "flextable"
show_x2_table(DF=2,x2=1.5) show_x2_table(p=0.05)
show_x2_table(DF=2,x2=1.5) show_x2_table(p=0.05)
Show z-value table
show_z_table(z = NULL, p = 0.05, alternative = "two.sided")
show_z_table(z = NULL, p = 0.05, alternative = "two.sided")
z |
Numeric vector of quantile |
p |
Numeric probability |
alternative |
Character One of c("two.sided","greater","less") |
An object of class "flextable"
show_z_table() show_z_table(z=1.4) show_z_table(z=-1.39234) show_z_table(p=0.160)
show_z_table() show_z_table(z=1.4) show_z_table(z=-1.39234) show_z_table(p=0.160)
Draw textbox
textBox( string, color = "black", lcolor = "red", bg = "cornsilk", lwd = 1, width = 10, bold = FALSE, italic = FALSE, fontsize = 11, space = 1.5, fontname )
textBox( string, color = "black", lcolor = "red", bg = "cornsilk", lwd = 1, width = 10, bold = FALSE, italic = FALSE, fontsize = 11, space = 1.5, fontname )
string |
string |
color |
font color |
lcolor |
line color |
bg |
background color |
lwd |
numeric line width |
width |
numeric box width |
bold , italic
|
logical |
fontsize |
numeric font size |
space |
space between lines |
fontname |
name of font |
A flextable
string="Good Morning!" textBox(string,italic=TRUE)
string="Good Morning!" textBox(string,italic=TRUE)