Type: | Package |
Title: | Detect Nonnormality in Meta-Analysis without Raw Data |
Version: | 1.0.0 |
Maintainer: | Rongwei Sun <irissun_s@hotmail.com> |
Description: | Non-normality could greatly distort the meta-analytic results, according to the simulation in Sun and Cheung (2020) <doi:10.3758/s13428-019-01334-x>. This package aims to detect non-normality for two independent groups with only limited descriptive statistics, including mean, standard deviation, minimum, and maximum. |
License: | MIT + file LICENSE |
URL: | https://github.com/irissun/detectnorm |
BugReports: | https://github.com/irissun/detectnorm/issues |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R (≥ 2.10) |
Imports: | nleqslv, ggplot2, truncnorm, Rdpack, psych |
Suggests: | knitr, metafor (≥ 3.4-0), rmarkdown, testthat (≥ 3.0.0) |
RdMacros: | Rdpack |
RoxygenNote: | 7.2.0 |
Config/testthat/edition: | 3 |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2022-07-15 13:29:16 UTC; iris |
Author: | Rongwei Sun |
Repository: | CRAN |
Date/Publication: | 2022-07-16 09:10:05 UTC |
Example meta-analysis: Extremely Non-normal Data
Description
This dataset is generated by nonnormal data with function rnonnorm
. It contains the descriptive data in individual studies in the meta-analysis.
Usage
beta_mdat
Format
A data.frame
with 40 studies:
- study
No of studies
- n1
sample size of group 1 with equal sample size for the two studies. Generated with uniform distribution.
- m1
mean of group 1. Population mean is equal to 1. The data of group 1 is generated with skewness = 4 and kurtosis = 2.
- sd1
standard deviation of group 1. Population sd of group 1 is equal to 1.
- lo1
minimum of the generated sample for group 1.
- hi1
maximum of the generated sample for group 1.
- n2
sample size of study 2; n1 = n2 for each study
- m2
mean of group 2. Population mean is equal to 1.5. The data of group 2 is generated with skewness = -4 and kurtosis = 2.
- sd2
standard deviation of group 2. Population sd of group 2 is equal to 1.
- lo2
minimum of the generated sample for group 2.
- hi2
maximum of the generated sample for group 2.
- skew1
sample skewness for group 1.
- skew2
sammple skewness for group 2.
Calculate skewness and kurtosis based on Beta distribution in one group
Description
This function can be used to calculate the skewness and kurtosis based on the Beta distribution. Also, this function estimate the shape parameters alpha and beta.
Usage
desbeta(
vmean,
vsd,
lo,
hi,
method = "MM",
rawdata = NULL,
showFigure = FALSE,
...
)
Arguments
vmean |
sample mean of the truncated data |
vsd |
sample standard deviation of the truncated data |
lo |
minimum possible value |
hi |
maximum possible value |
method |
when method = 'MM', the method used is the method of moments, when method = "ML', the method used to estimate the distribution is maximum likelihood |
rawdata |
when raw data is available, we could still use it to check it figuratively, if the data was closed to the normal distribution, or truncated normal distribution. |
showFigure |
when showFigure = TRUE, it will display the plots with theoretical normal curve and the truncated normal curve. |
... |
other arguments |
Value
If 'showFigure = TRUE', the output will be a list with two objects: one is the data frame of shape parameters (alpha and beta), mean and standard deviation of standard beta distribution (mean and sd), and skewness and kurtosis; the other is the theoretical figures of beta and normal distributions. If 'showFigure = FALSE', the output will be only the data frame.
References
Johnson NL, Kotz S, Balakrishnan N (1995). “Continuous univariate distributions.” In volume 289, chapter 25 Beta Distributions. John wiley & sons.
Smithson M, Verkuilen J (2006). “A better lemon squeezer? Maximum-likelihood regression with beta-distributed dependent variables.” Psychological methods, 11(1), 54.
See Also
Examples
data('beta_mdat')
desbeta(vmean=beta_mdat$m2[6], vsd=beta_mdat$sd2[6],
hi = beta_mdat$hi2[6], lo = beta_mdat$lo2[6], showFigure = TRUE)
Calculate skewness and kurtosis based on truncated normal distribution in one group
Description
This function can be used to calculate the skewness and kurtosis based on the truncated normal distribution. Also, it can be used to estimate the mean and variance of the parent distribution (the distribution before truncated).
Usage
destrunc(
vmean,
vsd,
lo,
hi,
rawdata = NULL,
showFigure = FALSE,
xstart,
btol,
ftol,
...
)
Arguments
vmean |
sample mean of the truncated data |
vsd |
sample standard deviation of the truncated data |
lo |
minimum possible value |
hi |
maximum possible value |
rawdata |
when raw data is available, we could still use it to check it figuratively, if the data was closed to the normal distribution, or truncated normal distribution. |
showFigure |
when showFigure = TRUE, it will display the plots with theoretical normal curve and the truncated normal curve. |
xstart |
see the package |
btol |
see the package |
ftol |
see the package |
... |
other arguments |
Value
If 'showFigure = TRUE', the output will be a list with two objects: one is the data frame of parent mean and standard deviation (pmean and psd), mean and standard deviation of truncated normal distribution (mean and sd), and skewness and kurtosis; the other is the theoretical figures of beta and normal distributions. If 'showFigure = FALSE', the output will be only the data frame.
References
Shah SM, Jaiswal MC (1966). “Estimation of parameters of doubly truncated normal distribution from first four sample moments.” Annals of the Institute of Statistical Mathematics, 18(1), 107–111.
Robert CP (1995). “Simulation of truncated normal variables.” Statistics and computing, 5(2), 121–125.
Barr DR, Sherrill ET (1999). “Mean and variance of truncated normal distributions.” The American Statistician, 53(4), 357–361.
See Also
Examples
data("trun_mdat")
destrunc(vmean=trun_mdat$m2[6], vsd=trun_mdat$sd2[6],
hi = 4, lo = 0, showFigure = TRUE)
#example2
destrunc(vmean=trun_mdat$m1[17], vsd=trun_mdat$sd1[17],
hi = 4, lo = 0, showFigure = TRUE)
Calculate skewness and kurtosis based on Beta or truncated normal distribution in a meta-analysis for SMD (Two independent groups)
Description
This function can be used to calculate the skewness and kurtosis based on the Beta distribution with the dataset used to conduct meta-analysis.
Usage
detectnorm(
m1i,
sd1i,
n1i,
lo1i,
hi1i,
m2i,
sd2i,
n2i,
lo2i,
hi2i,
data,
showFigure = FALSE,
distri = "beta",
...
)
Arguments
m1i |
vector to the means of first group |
sd1i |
vector to specifiy the standard deviation of first group |
n1i |
vector to specify the sample size of first group |
lo1i |
vector to specify the possible minimum of the first group |
hi1i |
vector to specify the possible maximum of the first group |
m2i |
vector to the means of second group |
sd2i |
vector to specifiy the standard deviation of second group |
n2i |
vector to specify the sample size of second group |
lo2i |
vector to specify the possible minimum of the second group |
hi2i |
vector to specify the possible maximum of the second group |
data |
the opitional original data frame containing the data for the function |
showFigure |
when showFigure = TRUE, it will display all the plots (within the result as a list, result$fig) with theoretical normal curve and the truncated normal curve. |
distri |
Beta distribution is used when using 'distri = "beta"'; Truncated normal distribution is used when using 'distri = "truncnorm"' |
... |
other arguments |
Value
The output of the data frame adding some columns of the possible skewness and kurtosis for each groups.
References
Barr DR, Sherrill ET (1999). “Mean and variance of truncated normal distributions.” The American Statistician, 53(4), 357–361.
Johnson NL, Kotz S, Balakrishnan N (1995). “Continuous univariate distributions.” In volume 289, chapter 25 Beta Distributions. John wiley & sons.
Robert CP (1995). “Simulation of truncated normal variables.” Statistics and computing, 5(2), 121–125.
Shah SM, Jaiswal MC (1966). “Estimation of parameters of doubly truncated normal distribution from first four sample moments.” Annals of the Institute of Statistical Mathematics, 18(1), 107–111.
Smithson M, Verkuilen J (2006). “A better lemon squeezer? Maximum-likelihood regression with beta-distributed dependent variables.” Psychological methods, 11(1), 54.
Sun RW, Cheung SF (2020). “The influence of nonnormality from primary studies on the standardized mean difference in meta-analysis.” Behavior Research Methods, 52(4), 1552–1567.
Examples
#truncated normal data
data("trun_mdat")
ex <- detectnorm(m1i = m1,sd1i = sd1,n1i = n1,
hi1i = 4,lo1i = 0,m2i = m2,sd2i = sd2,n2i = n2,
hi2i = 4,lo2i=0,distri = "truncnorm", data = trun_mdat)
head(ex)
#extremely non-normal data
data("beta_mdat")
ex2 <- detectnorm(m1i = m1,sd1i = sd1,n1i = n1,
hi1i = hi1,lo1i = lo1,m2i = m2,sd2i = sd2,n2i = n2,
hi2i = hi2,lo2i=lo2,distri = "beta", data = beta_mdat)
head(ex2)
mean(ex2$skew1)#sample skewness calculated from the sample
mean(ex2$g1_skewness) #estimated using beta
Non-normal Distribution
Description
Generating Non-normal data with specified skewness and kurtosis using Fleishman's Method
Usage
rnonnorm(n, mean = 0, sd = 1, skew = 0, kurt = 0)
Arguments
n |
number of observations |
mean |
mean |
sd |
standard deviation |
skew |
skewness |
kurt |
kurtosis |
Details
This function can be used to generate non-normal data with specified skewness and kurtosis using Fleishman's Power Method.
Value
A list of two objects: non-normal data is 'dat'; and the other is the Fleishman Coeffficients used to generate the distributions.
References
Fleishman AI (1978). “A method for simulating non-normal distributions.” Psychometrika, 43(4), 521–532.
Examples
set.seed(341031)
exdat <- rnonnorm(n = 100, mean = 1, sd = 2, skew = 3, kurt = 2)$dat
hist(exdat)
Example meta-analysis: Truncated Normal Data
Description
This dataset is generated by truncated normal data with function rtruncnorm
with the scale of 0-4.
Usage
trun_mdat
Format
A data frame with 40 studies:
- study
No of studies
- n1
sample size of group 1 with equal sample size for the two studies. Generated with uniform distribution.
- m1
mean of group 1. Population mean is equal to 1. The data of group 1 is generated with the scale 0-4.
- sd1
standard deviation of group 1. Population sd of group 1 is equal to 1.
- lo1
minimum of the generated sample for group 1.
- hi1
maximum of the generated sample for group 1.
- n2
sample size of study 2; n1 = n2 for each study
- m2
mean of group 2. Population mean is equal to 1.5. The data of group 2 is generated with the scale 0-4.
- sd2
standard deviation of group 2. Population sd of group 2 is equal to 1.
- lo2
minimum of the generated sample for group 2.
- hi2
maximum of the generated sample for group 2.
- skew1
sample skewness for group 1.
- skew2
sammple skewness for group 2.