Type: | Package |
Title: | Sample Variance Plots (Sv-Plots) |
Version: | 0.1.0 |
Author: | Uditha Amarananda Wijesuriya <u.wijesuriya@usi.edu> |
Maintainer: | Uditha Amarananda Wijesuriya <u.wijesuriya@usi.edu> |
Description: | Two versions of sample variance plots, Sv-plot1 and Sv-plot2, will be provided illustrating the squared deviations from sample variance. Besides indicating the contribution of squared deviations for the sample variability, these plots are capable of detecting characteristics of the distribution such as symmetry, skewness and outliers. A remarkable graphical method based on Sv-plot2 can determine the decision on testing hypotheses over one or two population means. In sum, Sv-plots will be appealing visualization tools. Complete description of this methodology can be found in the article, Wijesuriya (2020) <doi:10.1080/03610918.2020.1851716>. |
License: | GPL-3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.1.1 |
Depends: | R (≥ 3.0.2) |
Imports: | ggplot2 |
Suggests: | testthat (≥ 3.0.0), knitr, rmarkdown, stats |
Config/testthat/edition: | 3 |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2021-04-06 15:55:07 UTC; uwijesuriy |
Repository: | CRAN |
Date/Publication: | 2021-04-07 08:40:02 UTC |
Creates Sv-plot1, the first version of the sample variance plots.
Description
Sv-plot1 identifies the characteristics of the distribution illustrating squared deviations in the sample variance by squares for each data value.
Usage
svplot1(X,title="Sv-plot1",xlab="x",lbcol="grey5",lscol="grey60",
rbcol="grey45",rscol="grey75",...)
Arguments
X |
an |
title |
title of the plot, Sv-plot1 by default. |
xlab |
|
lbcol |
left bound color, grey5 by default. |
lscol |
left square color, grey60 by default. |
rbcol |
right bound color, grey45 by default. |
rscol |
right square color, grey75 by default. |
... |
other graphical parameters. |
Value
Sv-plot1
References
Wijesuriya, U. A. (2020). Sv-plots for identifying characteristics of the distribution and testing hypotheses. Communications in Statistics-Simulation and Computation, doi: 10.1080/03610918.2020.1851716.
Examples
set.seed(0)
X1 <- matrix(rnorm(50,mean=2,sd=5))
svplot1(X1)
X2 <- matrix(rf(50,df1=10,df2=5))
svplot1(X2)
X3 <- matrix(rbeta(50,shape1=10,shape2=2))
svplot1(X3,title="",lbcol="blue",lscol="blue",rbcol="red",rscol="grey75")
Creates Sv-plot2, the second version of the sample variance plots.
Description
Sv-plot2 identifies the characteristics of the distribution illustrating squared deviation values in the sample variance against each data value.
Usage
svplot2(X,title="Sv-plot2",xlab="x",lbcol="grey5", lsdcol="grey60",
rbcol="grey45",rsdcol="grey75",...)
Arguments
X |
an |
title |
title of the plot, Sv-plot2 by default. |
xlab |
|
lbcol |
left bound color, grey5 by default. |
lsdcol |
left squared deviation color, grey60 by default. |
rbcol |
right bound color, grey45 by default. |
rsdcol |
right squared deviation color, grey75 by default. |
... |
other graphical parameters. |
Value
Sv-plot2
References
Wijesuriya, U. A. (2020). Sv-plots for identifying characteristics of the distribution and testing hypotheses. Communications in Statistics-Simulation and Computation, doi: 10.1080/03610918.2020.1851716.
Examples
set.seed(0)
X1 <- matrix(rnorm(50,mean=2,sd=5))
svplot2(X1)
X2 <- matrix(rf(50,df1=10,df2=5))
svplot2(X2)
X3 <- matrix(rbeta(50,shape1=10,shape2=2))
svplot2(X3,lbcol="blue",lsdcol="blue",rbcol="red",rsdcol="red")
Tests the hypothesis over population mean based on one sample by Sv-plot2.
Description
Decision on hypothesis testing over single mean is made by graphing sample and population Sv-plot2s along with the threshold line. If the intersection point of two Sv-plot2s locates on or above the threshold line, the null hypothesis is rejected at specified significance level, otherwise, failed to reject.
Usage
test1mu(X,mu0=3.5,alpha=0.05,unkwnsigma=TRUE,sigma=NULL,xlab="x",
title="Single mean: Hypothesis testing by Sv-plot2",
samcol="grey5",popcol="grey45",thrcol="black",...)
Arguments
X |
an |
mu0 |
hypothesized population mean, mu0=3.5 by default. |
alpha |
significance level, alpha=0.05 by default. |
unkwnsigma |
population standard deviation is unknown, TRUE by default. |
sigma |
population standard deviation, NULL by default. |
xlab |
|
title |
title of the plot, Single mean: Hypothesis testing by Sv-plot2 by default. |
samcol |
sample Sv-plot2 color, grey5 by default. |
popcol |
sample Sv-plot2 color, grey45 by default. |
thrcol |
threshold color, black by default. |
... |
other graphical parameters. |
Value
Decision on testing hypotheses over single population mean by Sv-plot2.
References
Wijesuriya, U. A. (2020). Sv-plots for identifying characteristics of the distribution and testing hypotheses. Communications in Statistics-Simulation and Computation, doi: 10.1080/03610918.2020.1851716.
Examples
set.seed(5)
X=matrix(rnorm(20,mean=3,sd=2))
test1mu(X,mu0=3.5,alpha=0.05,unkwnsigma=TRUE,sigma=NULL,xlab="x",
title="Single mean: Hypothesis testing by Sv-plot2",
samcol="grey5",popcol="grey45",thrcol="black")
Tests the hypothesis over population mean based on one sample summary statistics by Sv-plot2.
Description
Decision on hypothesis testing over single mean is made by graphing sample and population Sv-plot2s along with the threshold line. Intersecting Sv-plots on or above the horizontal line concludes the alternative hypothesis.
Usage
test1musm(n=20,xbar=3,s=2,mu0=4.5,alpha=0.05,
unkwnsigma=TRUE,sigma=NULL,xlab="x",
title="Single mean summary: Hypothesis testing by Sv-plot2",
samcol="grey5",popcol="grey45",thrcol="black",...)
Arguments
n |
sample size, n=20 by default. |
xbar |
sample average, xbar=3 by default. |
s |
sample standard deviation, s=2 by default. |
mu0 |
hypothesized population mean, mu0=4.5 by default. |
alpha |
significance level, alpha=0.05 by default. |
unkwnsigma |
population standard deviation is unknown, TRUE by default. |
sigma |
population standard deviation, NULL by default. |
xlab |
|
title |
title of the plot, Single mean: Hypothesis testing by Sv-plot2 by default by default. |
samcol |
sample Sv-plot2 color, grey5 by default. |
popcol |
sample Sv-plot2 color, grey45 by default. |
thrcol |
threshold color, black. |
... |
other graphical parameters. |
Value
Decision on testing hypotheses over single population mean by Sv-plot2.
References
Wijesuriya, U. A. (2020). Sv-plots for identifying characteristics of the distribution and testing hypotheses. Communications in Statistics-Simulation and Computation, doi: 10.1080/03610918.2020.1851716.
Examples
## For summary data
test1musm(n=20,xbar=3,s=2,mu0=4.5,alpha=0.05, unkwnsigma=TRUE,sigma=NULL,xlab="x",
title="Single mean summary: Hypothesis testing by Sv-plot2",
samcol="grey5",popcol="grey45",thrcol="black")
Tests the hypothesis over two population means based on two samples by Sv-plot2.
Description
Decision on hypothesis testing over two means is made by graphing two sample Sv-plot2s along with the threshold line. If the intersection point of two Sv-plot2s locates on or above the threshold line, the null hypothesis is rejected at specified significance level, otherwise, failed to reject.
Usage
test2mu(X1,X2,paired=FALSE,eqlvar=FALSE,unkwnsigmas=TRUE,
sigma1=NULL,sigma2=NULL,alpha=0.05,xlab="x",
title="Two means: Hypothesis testing by Sv-plot2",
sam1col="grey5",sam2col="grey45",thrcol="black",...)
Arguments
X1 |
an |
X2 |
an |
paired |
for dependent samples TRUE, FALSE by default. |
eqlvar |
population variances are equal, FALSE by default. |
unkwnsigmas |
population standard deviations are unknown, TRUE by default. |
sigma1 |
population1 standard deviation, NULL by default. |
sigma2 |
population2 standard deviation, NULL by default. |
alpha |
significance level, alpha=0.05 by default. |
xlab |
|
title |
title of the plot, Two means: Hypothesis testing by Sv-plot2 by default. |
sam1col |
sample1 Sv-plot2 color, grey5 by default. |
sam2col |
sample2 Sv-plot2 color, grey45 by default. |
thrcol |
threshold color, black by default. |
... |
other graphical parameters. |
Value
Decision on testing hypotheses over two population means by Sv-plot2.
References
Wijesuriya, U. A. (2020). Sv-plots for identifying characteristics of the distribution and testing hypotheses. Communications in Statistics-Simulation and Computation, doi: 10.1080/03610918.2020.1851716.
Examples
set.seed(5)
test2mu(X1=matrix(rnorm(10,mean=3,sd=2)),X2=matrix(rnorm(20,mean=4,sd=2.5)),
paired=FALSE,eqlvar=FALSE,unkwnsigmas=TRUE,
sigma1=NULL,sigma2=NULL,alpha=0.05,
sam1col="grey5",sam2col="grey45",thrcol="black")
test2mu(X1=matrix(rnorm(10,mean=3,sd=2)),X2=matrix(rnorm(20,mean=4,sd=2.5)),
paired=FALSE,eqlvar=TRUE,unkwnsigmas=TRUE,
sigma1=NULL,sigma2=NULL,alpha=0.05,
sam1col="grey5",sam2col="grey45",thrcol="black")
test2mu(X1=matrix(rnorm(50,mean=3,sd=2)),X2=matrix(rnorm(30,mean=4,sd=2.5)),
xlab="x",title="Two means: Hypothesis testing by Sv-plot2",
paired=FALSE,eqlvar=FALSE,unkwnsigmas=TRUE,
sigma1=NULL,sigma2=NULL,alpha=0.05,
sam1col="grey5",sam2col="grey45",thrcol="black")
test2mu(X1=matrix(rnorm(50,mean=3,sd=2)),X2=matrix(rnorm(30,mean=4,sd=2.5)),
paired=FALSE,eqlvar=FALSE,unkwnsigmas=FALSE,
sigma1=2,sigma2=4.920782,alpha=0.05,
sam1col="grey5",sam2col="grey45",thrcol="black")
X1=matrix(rnorm(10,mean=3,sd=2))
X2=2*X1
test2mu(X1,X2,
paired=TRUE,eqlvar=FALSE,unkwnsigmas=TRUE,
sigma1=NULL,sigma2=NULL,alpha=0.05,
sam1col="blue",sam2col="red",thrcol="black")
Tests the hypothesis over two population means based on two samples summary statistics by Sv-plot2.
Description
Decision on hypothesis testing over two means is made by graphing two sample Sv-plot2s along with the threshold line. Intersecting Sv-plots on or above the horizontal line concludes the alternative hypothesis.
Usage
test2musm(n1=20,n2=25,xbar1=3,xbar2=4,s1=1,s2=1.5,
paired=FALSE,eqlvar=FALSE,unkwnsigmas=TRUE,
sigma1=NULL,sigma2=NULL,sdevdif=NULL,alpha=0.05,
xlab="x",title="Two means summary: Hypothesis testing by Sv-plot2",
sam1col="grey5",sam2col="grey45",thrcol="black",...)
Arguments
n1 |
sample1 size, n1=20 by default. |
n2 |
sample2 size, n2=25 by default. |
xbar1 |
sample1 average, xbar1=3 by default. |
xbar2 |
sample2 average, xbar2=4 by default. |
s1 |
sample1 standard deviation, s1=1 by default. |
s2 |
sample2 standard deviation, s2=1.5 by default. |
paired |
for dependent samples TRUE, FALSE by default. |
eqlvar |
population variances are equal, FALSE by default. |
unkwnsigmas |
population standard deviations are unknown, TRUE by default. |
sigma1 |
population1 standard deviation, NULL by default. |
sigma2 |
population2 standard deviation, NULL by default. |
sdevdif |
standard deviation of the differences, NULL by default. |
alpha |
significance level, alpha=0.05 by default. |
xlab |
|
title |
title of the plot, Two means: Hypothesis testing by Sv-plot2 by default. |
sam1col |
sample1 Sv-plot2 color, grey5 by default. |
sam2col |
sample2 Sv-plot2 color, grey45 by default. |
thrcol |
threshold color, black by default. |
... |
other graphical parameter. |
Value
Decision on testing hypotheses over two population means by Sv-plot2.
References
Wijesuriya, U. A. (2020). Sv-plots for identifying characteristics of the distribution and testing hypotheses. Communications in Statistics-Simulation and Computation, doi: 10.1080/03610918.2020.1851716.
Examples
## For summary data
test2musm(n1=20,n2=25,xbar1=3,xbar2=4,s1=1,s2=1.5,
paired=FALSE,eqlvar=FALSE,unkwnsigmas=TRUE,
sigma1=NULL,sigma2=NULL,sdevdif=NULL,alpha=0.05,
xlab="x",title="Two means summary: Hypothesis testing by Sv-plot2",
sam1col="grey5",sam2col="grey45",thrcol="black")
test2musm(n1=20,n2=25,xbar1=3,xbar2=4,s1=1.5,s2=1.5,
paired=FALSE,eqlvar=TRUE,unkwnsigmas=TRUE,
sigma1=NULL,sigma2=NULL,sdevdif=NULL,alpha=0.05,
xlab="x",title="Two means summary: Hypothesis testing by Sv-plot2",
sam1col="grey5",sam2col="grey45",thrcol="black")
test2musm(n1=50,n2=35,xbar1=3,xbar2=4,s1=1,s2=1.5,
paired=FALSE,eqlvar=FALSE,unkwnsigmas=TRUE,
sigma1=NULL,sigma2=NULL,sdevdif=NULL,alpha=0.05,
xlab="x",title="Two means summary: Hypothesis testing by Sv-plot2",
sam1col="grey5",sam2col="grey45",thrcol="black")
test2musm(n1=50,n2=35,xbar1=3,xbar2=4,s1=1,s2=1.5,
paired=FALSE,eqlvar=FALSE,unkwnsigmas=FALSE,
sigma1=2,sigma2=3,sdevdif=NULL,alpha=0.05,
xlab="x",title="Two means summary: Hypothesis testing by Sv-plot2",
sam1col="grey5",sam2col="grey45",thrcol="black")
test2musm(n1=20,n2=20,xbar1=3,xbar2=4,s1=1,s2=1.5,
paired=TRUE,eqlvar=FALSE,unkwnsigmas=TRUE,
sigma1=NULL,sigma2=NULL,sdevdif=2,alpha=0.05,
xlab="x",title="Two means summary: Hypothesis testing by Sv-plot2",
sam1col="grey45",sam2col="grey5",thrcol="black")