Calculate skewness and kurtosis based on Beta or truncated normal distribution in a meta-analysis for SMD (Two independent groups)
Source:R/detectnorm.R
detectnorm.Rd
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)
#> study n1 m1 sd1 lo1 hi1 n2 m2 sd2
#> 1 1 199 1.297501 0.8203794 0.0061563102 3.611959 199 1.572915 0.9002734
#> 2 2 77 1.325658 0.7750929 0.0231261133 2.889290 77 1.597681 0.8782761
#> 3 3 166 1.212825 0.7460359 0.0158618581 3.607032 166 1.612654 0.8441273
#> 4 4 120 1.230577 0.7888702 0.0030294235 3.443851 120 1.598539 0.8776627
#> 5 5 175 1.279821 0.7477283 0.0002848415 3.409888 175 1.612636 0.8426223
#> 6 6 47 1.310062 0.8904328 0.0088877511 3.729032 47 1.613387 0.8375352
#> lo2 hi2 skew1 skew2 g1_pmean g1_psd g1_tm
#> 1 0.02056929 3.654732 0.4925754 0.31062433 0.9265047 1.0938781 1.297501
#> 2 0.01601133 3.591504 0.3189877 0.31978670 1.1151683 0.9467633 1.325658
#> 3 0.02598881 3.944059 0.8236975 0.41657818 0.9398112 0.9473430 1.212825
#> 4 0.05609411 3.563257 0.5632971 0.17020660 0.8502200 1.0561320 1.230577
#> 5 0.01150730 3.784293 0.4826745 0.20444248 1.0794292 0.9082416 1.279821
#> 6 0.04276128 3.137731 0.7678702 -0.02343749 0.5917055 1.3736190 1.310062
#> g1_tsd g1_skewness g1_kurtosis g2_pmean g2_psd g2_tm g2_tsd
#> 1 0.8203794 0.5716438 -0.2242368 1.344779 1.1457492 1.572915 0.9002734
#> 2 0.7750929 0.4748739 -0.2575908 1.430489 1.0697115 1.597681 0.8782761
#> 3 0.7460359 0.5641674 -0.1261384 1.497772 0.9813048 1.612654 0.8441272
#> 4 0.7888702 0.6126086 -0.1219403 1.432897 1.0677119 1.598539 0.8776627
#> 5 0.7477283 0.4849605 -0.2135704 1.499307 0.9779920 1.612636 0.8426223
#> 6 0.8904328 0.6407774 -0.2669263 1.505538 0.9667249 1.613387 0.8375352
#> g2_skewness g2_kurtosis
#> 1 0.3522515 -0.5744184
#> 2 0.3139299 -0.5529135
#> 3 0.2767216 -0.5033002
#> 4 0.3127301 -0.5523355
#> 5 0.2756432 -0.5008223
#> 6 0.2713042 -0.4927465
#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)
#> study n1 m1 sd1 lo1 hi1 n2 m2 sd2
#> 1 1 160 1.0259203 0.8995642 0.2083603 5.578894 160 1.430021 1.0598447
#> 2 2 34 1.1528144 1.1367622 0.2123795 4.932592 34 1.408080 0.9296092
#> 3 3 57 0.9959042 0.8760782 0.2089018 3.443021 57 1.508927 1.0423997
#> 4 4 155 0.9480018 0.8828343 0.2082652 3.934242 155 1.443682 0.9198336
#> 5 5 149 1.1162247 1.0968963 0.2081850 5.613920 149 1.444312 1.0826183
#> 6 6 132 1.0418582 0.8946956 0.2082168 4.301961 132 1.554712 0.7932896
#> lo2 hi2 skew1 skew2 g1_alpha g1_beta g1_mean g1_sd
#> 1 -3.177617 2.274204 1.788613 -2.230054 0.5480186 3.051904 0.1522307 0.1674999
#> 2 -1.296619 2.271800 1.655752 -1.232207 0.3488177 1.401962 0.1992357 0.2408286
#> 3 -2.287307 2.274883 1.292354 -1.627030 0.3672680 1.141989 0.2433436 0.2708861
#> 4 -2.072880 2.274900 1.530104 -1.560090 0.3641696 1.470115 0.1985349 0.2369403
#> 5 -4.294234 2.274901 1.541182 -2.244364 0.4022054 1.992201 0.1679771 0.2029134
#> 6 -2.987192 2.273312 1.508507 -2.096631 0.4877450 1.907413 0.2036379 0.2185519
#> g1_skewness g1_kurtosis g2_alpha g2_beta g2_mean g2_sd g2_skewness
#> 1 1.483046 1.8901609 2.081468 0.3813533 0.8451559 0.1944020 -1.591348
#> 2 1.331854 0.8377363 1.291009 0.4122712 0.7579545 0.2605101 -1.069528
#> 3 1.079966 0.0309162 1.394623 0.2813890 0.8321080 0.2284867 -1.581618
#> 4 1.327314 0.8548620 1.985434 0.4693019 0.8088177 0.2115640 -1.310686
#> 5 1.489420 1.5984400 2.678914 0.3877426 0.8735618 0.1648038 -1.789508
#> 6 1.234109 0.7489875 3.614481 0.5718672 0.8633971 0.1508011 -1.558126
#> g2_kurtosis
#> 1 2.00489688
#> 2 0.07531228
#> 3 1.66667585
#> 4 1.00447883
#> 5 3.02270945
#> 6 2.29997673
mean(ex2$skew1)#sample skewness calculated from the sample
#> [1] 1.687593
mean(ex2$g1_skewness) #estimated using beta
#> [1] 1.384237