Version: | 0.1.4 |
Date: | 2018-05-10 |
Title: | A Simple R Package for Classical Parametric Statistical Tests and Confidence Intervals in Large Samples |
Author: | Cqls Team |
Maintainer: | Pierre Lafaye de Micheaux <lafaye@unsw.edu.au> |
Depends: | R (≥ 1.8.0) |
Description: | One and two sample mean and variance tests (differences and ratios) are considered. The test statistics are all expressed in the same form as the Student t-test, which facilitates their presentation in the classroom. This contribution also fills the gap of a robust (to non-normality) alternative to the chi-square single variance test for large samples, since no such procedure is implemented in standard statistical software. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
URL: | https://www.r-project.org |
Packaged: | 2018-05-10 09:59:30 UTC; lafaye |
NeedsCompilation: | no |
Repository: | CRAN |
Date/Publication: | 2018-05-10 12:15:54 UTC |
DIG NHLBI Teaching Dataset
Description
A clinical trial focused dataset was developed using the Digitalis Investigation Group (DIG). This dataset was designed to replicate the results found in the February 1997 New England Journal of Medicine article. Note that statistical processes such as permutations within treatment groups were used to completely anonymize the data; therefore, inferences derived from the teaching dataset may not be valid. The DIG Trial was a randomized, double-blind, multicenter trial with more than 300 centers in the United States and Canada participating. The purpose of the trial was to examine the safety and efficacy of Digoxin in treating patients with congestive heart failure in sinus rhythm. Data on 5281 male and 1519 female collected.
Format
This data frame contains the following columns:
- ID
-
Patient ID
- TRTMT
-
(0=Placebo, 1=Treatment)
- AGE
-
Calculated: age at randomization
- RACE
-
Q5: Race, 1=White 2=Nonwhite
- SEX
-
(1 = male or 2 = female)
- EJFPER
-
Q3: Ejection fraction (percent)
- EJFMETH
-
Q3A: Ejection Fraction method
- CHESTX
-
Q6: Chest X-ray (CT-Ratio)
- BMI
-
Calculated: Body Mass Index (kg per M-squared)
- KLEVEL
-
Q9A: Serum Potassium level
- CREAT
-
Q9: Serum Creatinine (mg per dL)
- DIGDOSER
-
Q10: Recommended Digoxin dose
- CHFDUR
-
Q12: Duration of CHF (months)
- RALES
-
Q13: Rales
- ELEVJVP
-
Q14: Elevated jugular venous pressure
- PEDEMA
-
Q15: Peripheral Edema
- RESTDYS
-
Q16: Dyspnea at Rest
- EXERTDYS
-
Q17: Dyspnea on Exertion
- ACTLIMIT
-
Q18: Limitation of activity
- S3
-
Q19: S3 Gallop
- PULCONG
-
Q20: Pulmonary congestion
- NSYM
-
Calculated: Sum of Q13-Q20, Y or N status
- HEARTRTE
-
Q21: Heart Rate (beats per min)
- DIABP
-
Q22: Diastolic BP (mmHg)
- SYSBP
-
Q22: Sysolic BP (mmHg)
- FUNCTCLS
-
Q23: NYHA Functional Class
- CHFETIOL
-
Q24: CHF Etiology
- PREVMI
-
Q25: Previous Myocardial Infarction
- ANGINA
-
Q26: Current Angina
- DIABETES
-
Q27: History of Diabetes
- HYPERTEN
-
Q28: History of Hypertension
- DIGUSE
-
Q29: Digoxin within past week
- DIURETK
-
Q30: Potassium sparing Diuretics
- DIURET
-
Q31: Other Diuretics
- KSUPP
-
Q31A: Potassium supplements
- ACEINHIB
-
Q32: Ace inhibitors
- NITRATES
-
Q33: Nitrates
- HYDRAL
-
Q34: Hydralazine
- VASOD
-
Q35: Other Vasodilators
- DIGDOSE
-
Q36: Dose of Digoxin per Placebo prescribed
- CVD
-
Hosp: Cardiovascular Disease
- CVDDAYS
-
Days randomization to First CVD Hosp
- WHF
-
Hosp: Worsening Heart Failure
- WHFDAYS
-
Days randomization to First WHF Hosp
- DIG
-
Hosp: Digoxin Toxicity
- DIGDAYS
-
Days rand. to First Digoxin Tox Hosp
- MI
-
Hosp: Myocardial Infarction
- MIDAYS
-
Days randomization to First MI Hosp
- UANG
-
Hosp: Unstable Angina
- UANGDAYS
-
Days rand. to First Unstable Angina Hosp
- STRK
-
Hosp: Stroke
- STRKDAYS
-
Days randomization to First Stroke Hosp
- SVA
-
Hosp: Supraventricular Arrhythmia
- SVADAYS
-
Days rand. to First SupraVent Arr. Hosp
- VENA
-
Hosp: Ventricular Arrhythmia
- VENADAYS
-
Days rand. to First Vent. Arr. Hosp
- CREV
-
Hosp: Coronary Revascularization
- CREVDAYS
-
Days rand. to First Cor. Revasc.
- OCVD
-
Hosp: Other Cardiovascular Event
- OCVDDAYS
-
Days rand. to First Other CVD Hosp
- RINF
-
Hosp: Respiratory Infection
- RINFDAYS
-
Days rand. to First Resp. Infection Hosp
- OTH
-
Hosp: Other noncardiac, nonvascular
- OTHDAYS
-
Days rand. to 1st Other Non CVD Hosp
- HOSP
-
Hosp: Any Hospitalization
- HOSPDAYS
-
Days randomization to First Any Hosp
- NHOSP
-
Number of Hospitalizations
- DEATH
-
Vital Status of Patient 1=Death 0=Alive
- DEATHDAY
-
Days till last followup or death
- REASON
-
Cause of Death
- DWHF
-
Primary Endpt: Death or Hosp from HF
- DWHFDAYS
-
Days rand. to death or Hosp from WHF
Source
NHLBI Teaching Dataset
References
The effect of digoxin on mortality and morbidity in patients with heart failure . The Digitalis Investigation Group. N En gl J Med. 1997 Feb 20;336(8):525-33
Examples
data(DIGdata)
Asymptotic tests
Description
Performs one and two sample asymptotic (no gaussian assumption on distribution) parametric tests on vectors of data.
Usage
asymp.test(x,...)
## Default S3 method:
asymp.test(x, y = NULL,
parameter = c("mean", "var", "dMean", "dVar", "rMean", "rVar"),
alternative = c("two.sided", "less", "greater"),
reference = 0, conf.level = 0.95, rho = 1, ...)
## S3 method for class 'formula'
asymp.test(formula, data, subset, na.action, ...)
Arguments
x |
a (non-empty) numeric vector of data values. |
y |
an optional (non-empty) numeric vector of data values. |
parameter |
a character string specifying the parameter under testing, must be one of "mean", "var", "dMean" (default), "dVar", "rMean", "rVar" |
alternative |
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter. |
reference |
a number indicating the reference value of the parameter (difference or ratio true value for two sample test) |
conf.level |
confidence level of the interval. |
rho |
optional parameter (only used for parameters "dMean" and "dVar") for penalization (or enhancement) of the contribution of the second parameter. |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when
the data contain |
... |
further arguments to be passed to or from methods. |
Details
Asymptotic parametric test and confidence intervals are based on the following unified statistic :
\frac{\hat{\theta}(Y)-\theta}{\hat{\sigma_{\hat{\theta}}(Y)}}
which asymptotically follows a N(0,1)
.
\theta
stands for the parameter under testing
(mean/variance, difference/ratio of means or variances).
The term \hat{\sigma_{\hat{\theta}}(Y)}
is calculated by the ad-hoc seTheta function (see seMean
).
Value
A list with class "htest" containing the following components:
statistic |
the value of the unified |
p.value |
the p-value for the test. |
conf.int |
a confidence interval for the parameter appropriate to the specified alternative hypothesis. |
estimate |
the estimated parameter depending on whether it wasa one-sample test or a two-sample test (in which case the estimated parameter can be a difference/ratio in means/variances). |
null.value |
the specified hypothesized value of parameter depending on whether it was a one-sample test or a two-sample test. |
alternative |
a character string describing the alternative hypothesis. |
method |
a character string indicating what type of asymptotictest was performed. |
data.name |
a character string giving the name(s) of the data. |
Author(s)
J.-F. Coeurjolly, R. Drouilhet, P. Lafaye de Micheaux, J.-F. Robineau
References
C oeurjolly, J.F. Drouilhet, R. Lafaye de Micheaux, P. Robineau, J.F. (2009) asympTest: a simple R package for performing classical parametric statistical tests and confidence intervals in large samples, The R Journal
See Also
t.test
, var.test
for normal distributed data.
Examples
## one sample
x <- rnorm(70, mean = 1, sd = 2)
asymp.test(x)
asymp.test(x,par="mean",alt="g")
asymp.test(x,par="mean",alt="l",ref=2)
asymp.test(x,par="var",alt="g")
asymp.test(x,par="var",alt="l",ref=2)
## two samples
y <- rnorm(50, mean = 2, sd = 1)
asymp.test(x,y)
asymp.test(x,y,"rMean","l",.75)
asymp.test(x,y,"dMean","l",0,rho=.75)
asymp.test(x,y,"dVar")
## Formula interface
asymp.test(uptake~Type,data=CO2)
se functions
Description
se functions compute the Standard Error of respectively mean, variance, difference of means, of variances and ratio of means and variances.
Usage
seMean(x,...)
## Default S3 method:
seMean(x,...)
seVar(x,...)
## Default S3 method:
seVar(x,...)
seDMean(x,...)
## Default S3 method:
seDMean(x, y, rho = 1, ...)
seDMeanG(x,...)
## Default S3 method:
seDMeanG(x, y,...)
seDVar(x,...)
## Default S3 method:
seDVar(x, y, rho = 1, ...)
seRMean(x,...)
## Default S3 method:
seRMean(x, y, r0,...)
seRVar(x,...)
## Default S3 method:
seRVar(x, y, r0,...)
Arguments
x |
a (non-empty) numeric vector of data values. |
y |
an optional (non-empty) numeric vector of data values. |
rho |
optional parameter for penalization (or enhancement) of the contribution of the second parameter. |
r0 |
an optional parameter for ratio of means (seRMean) or variances (seRVar). It acts as parameter r in seDMean and seDVar. Defaults are mean(x)/mean(y) in seRMean and var(x)/var(y) for seRVar. |
... |
further arguments to be passed to or from methods. |
Details
se functions performs classical standard error estimation for parameters mean, variance, difference of means or variances, ratio of means or variances.
Value
Return the value of the estimated standard error for the corresponding parameter.
Author(s)
J.-F. Coeurjolly, R. Drouilhet, P. Lafaye de Micheaux, J.-F. Robineau
References
Coeurjolly, J.F. Drouilhet, R. Lafaye de Micheaux, P. Robineau, J.F. (2008) asympTest: a simple R package for performing classical parametric statistical tests and confidence intervals in large samples, The R Journal
See Also
asymp.test
that used estimated standard error
for asymptotic parametric tests.
Examples
x <- rnorm(70, mean = 1, sd = 2)
y <- rnorm(50, mean = 2, sd = 1)
## mean statistic
asymp.test(x)$stat
mean(x)/seMean(x)
## variance statistic
asymp.test(x,param="var",alt="l",param0=2)$stat
(var(x)-2)/seVar(x)
## difference of means statistic
asymp.test(x,y)$stat
(mean(x)-mean(y))/seDMean(x,y)