distdichogen {distdichoR} | R Documentation |
normal, skew-normal or gamma distributed data
Description
distdichogen first returns the results of a two-group unpaired t-test. Followed by the distributional estimates and their standard errors (see Sauzet et al. 2014 and Peacock et al. 2012) for a difference in proportions, risk ratio and odds ratio. It also provides the distributional confidence intervals for the statistics estimated. distdicho_gen takes normal (dist = 'normal'), skew normal (dist = 'sk_normal') and gamma (dist = 'gamma') distributed data. The data can either be given as two variables, which provide the outcome in each group or specified as a formula of the form lhs ~ rhs where lhs is a numeric variable giving the data values and rhs a factor with two levels giving the corresponding exposed and unexposed groups. In all cases, it is assumed that there are only two groups.
Usage
distdichogen(x, ...)
## Default S3 method:
distdichogen(x, y, cp = 0, tail = c("lower", "upper"),
conf.level = 0.95, dist = c("normal", "sk_normal", "gamma"),
bootci = FALSE, nrep = 2000, ...)
## S3 method for class 'formula'
distdichogen(formula, data, exposed, ...)
Arguments
x |
A numeric vector of data values. |
... |
Further arguments to be passed to or from methods. |
y |
A numeric vector of data values. |
cp |
A numeric value specifying the cut point under which the distributional proportions are computed. |
tail |
A character string specifying the tail of the distribution in which the proportions are computed. Must be either 'lower' (default) or 'upper'. |
conf.level |
Confidence level of the interval. |
dist |
A character string specifying the distribution of the data. Must be either 'normal' (default), 'sk_normal or 'gamma'. |
bootci |
A logical variable indicating whether bootstrap bias-corrected confidence intervals are calculated instead of distributional ones. |
nrep |
A numeric value, specifies the number of bootstrap replications (nrep must be higher than the number of observations). |
formula |
A formula of the form lhs ~ rhs where lhs is a numeric variable giving the data values and rhs a factor with two levels giving the corresponding exposed and unexposed groups. |
data |
An optional matrix or data frame containing the variables
in the formula. By default, the variables are taken from |
exposed |
A character string specifying the grouping value of the exposed group. |
Value
A list with class 'distdicho' containing the following components:
data.name |
The names of the data. |
arguments |
A list with the specified arguments. |
parameter |
The mean, standard error and number of observations for both groups. |
prop |
The estimated proportions below / above the cut point for both groups. |
dist.estimates |
The difference in proportions, risk ratio and odds ratio of the groups. |
se |
The estimated standard error of the difference in proportions, the risk ratio and the odds ratio. |
ci |
The confidence intervals of the difference in proportions, the risk ratio and the odds ratio. |
method |
A character string indicating the used method. |
ttest |
A list containing the results of a t-test. |
References
Peacock J.L., Sauzet O., Ewings S.M., Kerry S.M. Dichotomising continuous data while retaining statistical power using a distributional approach. Statist. Med; 2012; 26:3089-3103. Sauzet, O., Peacock, J. L. Estimating dichotomised outcomes in two groups with unequal variances: a distributional approach. Statist. Med; 2014 33 4547-4559 ;DOI: 10.1002/sim.6255. Sauzet, O., Ofuya, M., Peacock, J. L. Dichotomisation using a distributional approach when the outcome is skewed BMC Medical Research Methodology 2015, 15:40; doi:10.1186/s12874-015-0028-8. Peacock, J.L., Bland, J.M., Anderson, H.R.: Preterm delivery: effects of socioeconomic factors, psychological stress, smoking, alcohol, and caffeine. BMJ 311(7004), 531-535 (1995).
See Also
distdicho
, distdichoi
, distdichoigen
, regdistdicho
Examples
## Proportions of low birth weight babies among smoking and non-smoking mothers
## (data from Peacock et al. 1995). Returns distributional estimates, standard
## errors and distributional confidence intervals for differences in proportions,
## RR and OR of babies having a birth weight under 2500g (low birth weight)
## for group smoker (mother smokes) over the odds of LBW in group non-smoker
## (mother doesn't smoke)
# Formula interface
distdichogen(birthwt ~ smoke, cp = 2500, data = bwsmoke, exposed = 'smoker',
dist = 'sk_normal')
# Data stored in two vectors
bw_smoker <- bwsmoke$birthwt[bwsmoke$smoke == 'smoker']
bw_nonsmoker <- bwsmoke$birthwt[bwsmoke$smoke == 'non-smoker']
distdichogen(x = bw_smoker, y = bw_nonsmoker,
cp = 2500, tail = 'lower', dist = 'sk_normal')
## Body Mass Index (BMI) and parity. Returns distributional estimates, standard
## errors and distributional confidence intervals for difference in proportions,
## RR and OR of obese mothers (BMI of >30kg/m^2) for group_par=1 (multiparity)
## over the odds of obesity in group_par=0 (primiparity)
distdichogen(bmi ~ group_par, cp = 30, data = bmi, exposed = '1',
tail = 'upper', dist = 'sk_normal')