Type: | Package |
Title: | R Commander Plug-in for the EZR (Easy R) Package |
Version: | 1.68 |
Date: | 2024-6-30 |
Author: | Yoshinobu Kanda |
Maintainer: | Yoshinobu Kanda <ycanda-tky@umin.ac.jp> |
Depends: | R (≥ 4.2.0) |
Imports: | Rcmdr (≥ 2.8.0), readstata13 |
Suggests: | abind, aod, aplpack, brant, car, clinfun, cmprsk, consort, foreign, ggplot2, lawstat, meta, metatest, netmeta, multcomp, mvtnorm, Matching, plotly, pROC (≥ 1.15.0), survivalROC, survRM2, tableone, readxl, lmerTest, swimplot, currentSurvival, rstatix |
Description: | EZR (Easy R) adds a variety of statistical functions, including survival analyses, ROC analyses, metaanalyses, sample size calculation, and so on, to the R commander. EZR enables point-and-click easy access to statistical functions, especially for medical statistics. EZR is platform-independent and runs on Windows, Mac OS X, and UNIX. Its complete manual is available only in Japanese (Chugai Igakusha, ISBN: 978-4-498-10918-6, Nankodo, ISBN: 978-4-524-26158-1, Ohmsha, ISBN: 978-4-274-22632-8), but an report that introduced the investigation of EZR was published in Bone Marrow Transplantation (Nature Publishing Group) as an Open article. This report can be used as a simple manual. It can be freely downloaded from the journal website as shown below. This report has been cited in more than 10,000 scientific articles. |
Copyright: | The functionos in EZR package were programmed by Y. Kanda, except for the following functions. dot.plot(), prop.conf(), Cochran.Q.test(), pairwise.prop2.test(), pairwise.pairedt.test(), pairwise.kruskal.test(), pairwise.friedman.test(), pairwise.logrank.test(), pairwise.gray.test(), Steel.Dwass(), Steel(), pdunnet(), Mantel.Byar() were modified from the corresponding functions distributed by professor Aoki (http://aoki2.si.gunma-u.ac.jp/R). crr() and cuminc() were derived from cmprsk package. nrisk() was modified from survplot package (http://www.cbs.dtu.dk/~eklund/survplot/). epi.test() and epi.kappa() were derived from epiR package. jonckheere.test(), ph2simon() and ph2single() were derived from clinfun package. Functions of meta-analysis were derived from meta and metatest packages. Functions of matched-pair analysis were derived from Matching. Functions of receiver-operating characteristics curve analyses were derived from pROC package. Many dialog functions in EZR were modified from the corresponding functions in Rcmdr package and RcmdrPlugin.survivalT package. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
URL: | https://www.nature.com/articles/bmt2012244.pdf https://www.jichi.ac.jp/saitama-sct/SaitamaHP.files/statmedEN.html |
NeedsCompilation: | no |
Packaged: | 2024-06-22 15:03:23 UTC; KANDA |
Repository: | CRAN |
Date/Publication: | 2024-06-25 07:20:02 UTC |
Rcmdr Plug-In Package for the EZR (Easy R especially for medical statistics)
Description
This package provides an R Commander plug-in EZR (Easy R), which adds a variety of statistical functions, including survival analyses, ROC analyses, metaanalyses, sample size calculation, and so on, to the R commander. EZR enables point-and-click easy access to a variety of statistical functions as shown below, especially for medical statistics. A report that introduced the investigation of EZR was published in Bone Marrow Transplantation (Nature Publishing Group) as an Open article. This report can be used as a simple manual. It can be freely downloaded from the journal website (URL: https://www.nature.com/articles/bmt2012244.pdf). A complete manual of EZR is available only in Japanese (Chugai Igakusha, ISBN: 978-4-498-10918-6, URL: http://www.chugaiigaku.jp/item/detail.php?id=3342, Nankodo, ISBN: 978-4-524-26158-1, URL: https://www.nankodo.co.jp/g/g9784524261581/, Ohmsha, ISBN: 978-4-274-22632-8, URL: https://www.ohmsha.co.jp/book/9784274226328/)
Details
Package: | RcmdrPlugin.EZR |
Type: | Package |
Version: | 1.68 |
Date: | 2024-6-30 |
License: | GPL (>= 2) |
Installation of EZR
See https://www.jichi.ac.jp/saitama-sct/SaitamaHP.files/statmedEN.html for detailed information. Briefly, EZR is platform-independent. RcmdrPlugin.EZR should be installed with R commander (Rcmdr) and the other packages that Rcmdr or EZR depends on. Packages required by EZR can be easily installed at the same time with the installation of EZR by copying and pasting the following command to the R console window after " > ".
install.packages(pkgs="RcmdrPlugin.EZR", dependencies=TRUE)
After installation, R commander can be started by the command, library(Rcmdr)
from the R console. Packages required by Rcmdr are installed at the first start-up of R commander. EZR can be loaded by selecting RcmdrPlugin.EZR from the "Tools" > "Load Rcmdr plug-in(s)" menu. Answer "Yes" to "Restart now?".
On Windows, EZR plugin package will be loaded when R commander is started, if the following sentence is added to the Rprofile.site file in etc folder in the R folder (C:\Program Files\R\R-X.XX.X\etc).
options(Rcmdr=list(plugins="RcmdrPlugin.EZR"))
In addition, if the following phrase is added to the command in "Target:" column on the "Shortcut" tab of the "Property" of "R" shorcut on the desktop (which can be opened by right-clicking on the shortcut), R commander will start at the same time with launching R.
R_DEFAULT_PACKAGES="Rcmdr"
Therefore, if these two options were added, EZR can be started just by double-clicking on the "R" shortcut on the desktop.
In OS X, these can be done by opening the Terminal.app located in the Utilities folder, followed by copying and pasting the following command.
echo "options(Rcmdr=list(plugins='RcmdrPlugin.EZR'))" >> ~/.Rprofile
echo "library(Rcmdr)" >> ~/.Rprofile
echo "local({" >> ~/.Rprofile
echo "old <- getOption('defaultPackages')" >> ~/.Rprofile
echo "options(defaultPackages = c(old, 'Rcmdr'))" >> ~/.Rprofile
echo "})" >> ~/.Rprofile
The default data folder of Windows EZR can be changed by right-clicking on this "R" shortcut on the desktop, selecting "Properties", and replacing the folder name in the "Start in:" column on the "Shortcut" tab.
EZR statistical functions
EZR includes following statistical functions.
For discrete variables
Frequency distributions/cr
Confidence interval for a proportion
One sample proportion test
Confidence interval for a difference between two proportions
Confidence interval for a ratio of two proportions
Compare two proportions (Fisher's exact test and Chi-square test)
Compare proportions of two paired samples (McNemar test)
Compare proportions of more than two paired samples (Cochran Q test)
Cochran-Armitage test for trend in proportions
Logistic regression
Ordinal logistic regression
Multinomial logistic regression
For continuous variables
Numerical summaries
Smirnov-Grubbs test for outliers
Kolmogorov-Smirnov test for normal distribution
Confidence interval for a mean
Single-sample t-test
Two-variances F-test
Two-sample t-test
Paired t-test
Bartlett's test
One-way ANOVA
Repeated-measures ANOVA
Multi-way ANOVA
ANCOVA
Test for Pearson's correlation
Linear regression
Linear Mixed Model
For nonparametric tests for continuous variables
Mann-Whitney U test
Wilcoxon's signed rank test
Kruskal-Wallis test
Friedman test
Jonckheere-Terpstra test
Spearman's rank correlation test
For survival analysis
Kaplan-Meier survival curve and logrank test
Logrank trend test
Current survival
Cox proportional hazard regression
Cox proportional hazard regression with time-dependent covariate
Cumulative incidence of competing events and Gray test
Fine-Gray proportional hazard regression for competing events
Fine-Gray proportional hazard with time-dependent covariate
For diagnostic test analysis
Accuracy of qualitative test
Kappa statistics for agreement of two tests
Compute positive and negative predictive values
ROC curve analysis for quantitative test
Compare two ROC curves
ROC curve analysis for time-to-event data
Cronbach's alpha coefficient for reliability
For matched-pair analysis
Extract matched controls
Mantel-Haenzel test for matched proportions
Conditional logistic regression for matched-pair analysis
Stratified Cox proportional hazard regression for matched-pair analysis
For meta-analysis and meta-regression test
Meta-analysis and meta-regression test for proportions
Meta-analysis and meta-regression test for means
Meta-analysis and meta-regression test for hazard ratios
Network meta-analysis
For smaple size and power calculation
Calculate sample size from control and desired response rates
Calculate sample size from proportion and confidence interval
Calculate sample size or power for comparison with specified proportion
Calculate sample size or power for comparison between two proportions
Calculate sample size for non-inferiority trial of two proportions
Calculate sample size for selection design in randomized phase II trials
Calculate sample size from standard deviation and confidence interval
Calculate sample size or power for comparison between two means
Calculate sample size for non-inferiority trial of two means
Calculate sample size or power for comparison between two paired means
Calculate sample size or power for comparison between two survival curves
Calculate sample size for non-inferiority trial of two survival curves
For drawing graphs
Bar graph(Frequencies)
Pie chart(Frequencies)
Stem-and-leaf display
Histogram
QQ plot
Bar graph(Means)
Line graph(Means)
Line graph(Repeated measures)
Boxplot
Dot chart
Violin plot
Ordered chart (Waterfall plot)
Swimmer plot
Sankey diagram
Scatterplot
Scatterplot matrix
Adjusted survival curve
Adjusted cumulative incidence curve
Stacked cumulative incidences
Statistical functions from original R commander
Principal-components analysis
Factor analysis
k-means cluster analysis
Hierarchical cluster analysis
Summarize hierarchical clustering
Add hierarchical clustering to data set
Linear hypothesis
Variance-inflation factor
Breusch-Pagan test for heteroscedasticity
Durbin-Watson test for autocorrelation
RESET test for nonlinearity
Bonferroni outlier test
Basic diagnostic plots
Residual quantile-comparison plot
Component+residual plots
Added-variable plots
Influence plot
Effect plots
Basic operations in EZR
These EZR functions can be started by point-and-click access using the items on the menu bar. See EZRdialogs
for details. R commander automatically creates and executes corresponding R commands that appear in the "Script window". Results are shown in the "Output window". If any errors or warnings are noted, messages will appear in the "Message window". The created commands can be saved by selecting "File" > "Save script" on the menu bar. The output can be saved by selecting "File" > "Save output". By saving the commands, users can reproduce the analyses and can also share the procedure with the other investigators.
The following EZR functions can be executed by typing the commands in the "Script window" and clicking on the "Submit" button.
Following functions are built to create a formatted table for presentation.
w.twoway(table, filename)
function copies the results of two-way table analyses to the clipboard or text file.
w.ttest(table, filename)
function copies the results of t-test to the clipboard or text file.
w.survival(table, filename)
function copies the results of survival analyses to the clipboard or text file.
w.ci(table, filename)
function copies the results of cumulative incidence analyses to the clipboard or text file.
w.multi(table, filename)
function copies the results of multivariate regression analyses to the clipboard or text file.
"table" can be omitted except for logistic regression analysis and Fine & Gray proportinal hazard regression analysis, in which "odds" and "crr.table" should be specified for "table"(default is "cox.table" to copy the results of Cox proportional hazard regression analysis).
If "filename" is omitted, the formatted table will be copied to the clopboard, which can be pasted into a spreadsheet.
Mantel.Byar()
functon is for Mantel-Byar test and Simon and Makuch plot, which should be performed after executing "Cox proportional hazard modeling with time-dependent covariate".
rmean.table()
functon is for restricted mean survival time analysis, that should be used after "Kaplan-Meier survival curve and logrank test" analysis.
rmean.table.adjusted()
functon is for adjusted restricted mean survival time analysis, that should be used after "Adjusted survival curve" analysis.
Translations
EZR comes with translations from English into Japanese.
Author(s)
Yoshinobu Kanda <ycanda-tky@umin.ac.jp>
Maintainer: Yoshinobu Kanda <ycanda-tky@umin.ac.jp>
References
Its complete manual is available only in Japanese (Chugai Igakusha, ISBN: 978-4-498-10918-6, URL: http://www.chugaiigaku.jp/item/detail.php?id=3342, Nankodo, ISBN: 978-4-524-26158-1, URL: https://www.nankodo.co.jp/g/g9784524261581/, Ohmsha, ISBN: 978-4-274-22632-8, URL: https://www.ohmsha.co.jp/book/9784274226328/), but a report that introduced the investigation of EZR was published in Bone Marrow Transplantation (Nature Publishing Group) as an Open article. This report can be used as a simple manual. It can be freely downloaded from the journal website as shown below.
Yoshinobu Kanda (2013).
Investigation of the freely available easy-to-use software EZR for medical statistics.
Bone Marrow Transplantation (Open article, URL: https://www.nature.com/articles/bmt2012244.pdf).
EZR web site: Division of Hematology, Saitama Medical Center, Jichi Medical University. URL: https://www.jichi.ac.jp/saitama-sct/SaitamaHP.files/statmedEN.html
EZR dialogs
Description
EZR dialogs enable point-and-click easy access to a variety of statistical functions.
Details
EZR dialogs enable point-and-click easy access to a variety of statistical functions.
To select more than one variable in the list box, click on variables pressing Ctrl key, and to deselct one of the selected variables, click on the variable to deselect pressing Ctrl key.
To perform analyses in a subset of the samples, type an R expression into the box labelled "Condition to limit samples for analysis". For example, to perform analysis in male patients aged at least 60 years old, type Age >= 60 & Sex == "Male"
into the box, assuming that Age
and Sex
variables indicate age and sex of the patients, respectively.
Cautions in multivariate analyses using EZR
When a categorical variable with more than two categories is to be analyzed in Fine and Gray regression modeling, dummy variables should be created before an analysis, although such dummy variables are automatically created in multiple regression, logistic regression and Cox proportional hazards regression in R. For example, if a user wants to evaluate the effect of three types (A, B, and C) of treatments, information for which is included in the categorical variable Tx
as "A", "B" and "C", they would select "Active data set" > "Variables" > "Create dummy variables" from the EZR menu to make three categorical variables named Tx.Dummy.A
, Tx.Dummy.B
, and Tx.Dummy.C
.
Tx.Dummy.A
has a value of 1 for patients who received treatment A and 0 for others. Users should choose one of the three categories as a reference and input dummy variables for the other two categories into the regression model.
The stepwise selection function of explanatory variables based on Akaike information criterion and Bayesian information criterion only accepts dummy variables automatically created by R, whereas stepwise selection based on P-value also accepts dummy variables created by a user using EZR. If the option for a "Wald test for overall P-value for factors with >2 levels" is selected in the dialog of the regression analyses, the overall P-value for the categorical variable will be calculated.
Survival curves adjusted for other factors by the mean of covariates method, in which average values of covariates are entered into the Cox proportional hazards model, can be drawn by selecting "Graphs" > "Adjusted survival curve".
References
Read follwing article for details. It can be freely downloaded from the journal website as shown below.
Yoshinobu Kanda (2012).
Investigation of the freely available easy-to-use software EZR for medical statistics.
Bone Marrow Transplantation (Open article, URL: https://www.nature.com/articles/bmt2012244.pdf).
Plot a Histogram
Description
This function is a wrapper for the hist
function in
the base
package, permitting percentage scaling of the
vertical axis in addition to frequency and density scaling.
This function is modified from the Hist() function in the Rcmdr package.
HistEZR() package in RcmdrPlugin.EZR uses hist2() insted of hist(). In hist2(),
the method to set breakpoints between histogram cells was changed from
"Sturges" to "Scott".
Usage
HistEZR(x, scale=c("frequency", "percent", "density"), xlab=deparse(substitute(x)),
ylab=scale, main="", ...)
Arguments
x |
a vector of values for which a histogram is to be plotted. |
scale |
the scaling of the vertical axis: |
xlab |
x-axis label, defaults to name of variable. |
ylab |
y-axis label, defaults to value of |
main |
main title for graph, defaults to empty. |
... |
arguments to be passed to |
Value
This function returns NULL
, and is called for its side effect —
plotting a histogram.
See Also
Examples
data(iris, package="datasets")
HistEZR(iris$Petal.Length, scale="percent")
Inverse probability of treatment weighting using stabilized weights based on propensity score
Description
Return stabilized weights calculated based on propensity score and assess balance of covariates between the groups.
Usage
IPTW.ATE(GLM)
Arguments
GLM |
an object of class "glm", usually, a result of a call to glm. |
Details
By putting the result of a logistic regression analysis to calculate propensity scores into IPTW.ATE(), this function returns a stabilized weight variable calculated based on propensity scores and assesses the balance of covariates between the groups.
Value
an object of class "glm"
mantel-Byar test
Description
Performs Mantel-Byar test for comparison of survival data with a time-dependent covariate.
Usage
Mantel.Byar(Group = NULL, Event = TempTD$endpoint_td,
StartTime = TempTD$start_td, StopTime = TempTD$stop_td,
method = c("SAS", "Tominaga"), plot=0, landmark=0)
Arguments
Group |
the name of the time-dependent covariate. If NULL, the last column name of the TempTD dataset will be used. |
Event |
a vector for event. |
StartTime |
a vector for starting time. |
StopTime |
a vector for stopping time. |
method |
method for analysis. "SAS" or "Tominaga" |
plot |
plot=1, 2, or 3 to plot Simon and Makuch survival curves. Line discrimination with colors (plot=1), line types (plot=2), or width (plot=3). |
landmark |
landmark for Simon and Makuch plot. |
Details
Performs Mantel-Byar test for comparison of survival data with a time-dependent covariate. This function should be performed just after executing "Cox proportional hazard modeling with time-dependent covariate" from the EZR menu. If plot is set to 1, Simon and Makuch plot is drawn with a landmark as specified.
Ship weight data for linear regression
Description
Weights of ships with males, females, cats, and ants on them.
Usage
data(ShipWeight)
Format
Weight_Kg: | Weight of each ship |
Male: | Number of males on each ship |
Female: | Number of females on each ship |
Cat: | Number of cats on each ship |
Ant: | Number of ants on each ship |
Note
Sample file for linear regression.
Modified version of hist()
Description
The modified points from the original hist() are 1) hist2() uses Scott argorithm instead of Sturges. 2) hist2() adds a group below the lowest group created by hist().
Usage
hist2(x, breaks="scott", plot=TRUE, ...)
Arguments
x |
a vector of values for which the histogram is desired. |
breaks |
see hist() for details. |
plot |
logical. If TRUE (default), a histogram is plotted. |
... |
further arguments and graphical parameters passed to plot.histogram and thence to title and axis (if plot = TRUE). |
Details
See hist() for details.
See Also
Conditional Element Selection
Description
ifelse2 returns a value with the same shape as test which is filled with elements selected from either yes or no depending on whether the element of test is TRUE or FALSE. Modified from ifelse.
Usage
ifelse2(test, yes, no)
Arguments
test |
an object which can be coerced to logical mode. |
yes |
return values for true elements of test. |
no |
return values for false elements of test. |
Details
The only difference from ifelse
is that, when missing valuses in test
, ifelse
gives missing values in the result, whereas ifelse2
gives values for false elements of test.
See Also
caluculation of restricted mean survival
Description
Caluculate and compare restricted mean survival.
Usage
rmean.table(x=km, tau=NULL, plot=0)
rmean.table.adjusted(x=coxmodel, tau=NULL)
Arguments
x |
survfit object |
tau |
specify a value of the truncation time point for the restricted mean survial calculation, e.g.,tau=365. When tau=NULL, the default value (i.e., the minimum of the largest observed "event" time in each of the two groups) is used. |
plot |
plot=1 to plot estimated area. |
Details
rmean.table() function calculates restricted mean survival with a truncation time point as specified by tau option. Also tests the difference in the restricted mean survival, if there are only two groups. This function should be perfomed after "Kaplan-Meier survival curve and logrank test" function of EZR (or after executing survfit() command). rmean.table() function does not support stratified analysis. rmean.table.adjusted() function calculates adjusted restricted mean survival. This function should be perfomed after "Adjusted survival curve" function of EZR.
Calculate standardized difference to assess balance of covariates in unweighted and weighted dataset.
Description
Calculate standardized difference to assess balance of covariates in unweighted and weighted dataset.
Usage
st.diff.binom(factor, group)
st.diff.multinom(factor, group)
st.diff.categor(factor, group)
st.diff.numeric(numeric, group)
st.diff.binom.w(factor, weight, group)
st.diff.multinom.w(factor, weight, group)
st.diff.categor.w(factor, weight, group)
st.diff.numeric.w(numeric, weight, group)
Arguments
factor |
factor variable in vector for balace assessment. |
numeric |
numeric variable in vector for balace assessment. |
group |
group variable in vector for balace assessment. |
weight |
weight variable in vector for balace assessment of weighted dataset. |
Details
st.diff.binom(), st.diff.multinom(), st.diff.categor() and st.diff.numeric() functions calculate standardized difference of factor variables and numeric variables, respectively, in unweighted dataset. st.diff.binom.w(), st.diff.multinom.w(), st.diff.categor.w() and st.diff.numeric.w() functions calculate standardized difference of factor variables and numeric variables, respectively, in weighted dataset. st.diff.binom() and st.diff.binom.w() are for binomial factors, st.diff.multinom() and st.diff.multinom.w() are for multinomial factors, and st.diff.categor() and st.diff.categor() are for factors irrespective of levels.
Create a formatted table for presentation
Description
Creates a formatted table for presentation and outputs to a file or clipboard.
Usage
w.multireg(table = multireg.table, filename = "clipboard", CI = 0, signif = 0, en = 1)
w.multi(table = cox.table, filename = "clipboard", CI = 0, signif = 0, en = 1)
w.twoway(table = Fisher.summary.table, filename = "clipboard", en = 1)
w.ttest(table = summary.ttest, filename = "clipboard", en = 1)
w.survival(table = km.summary.table, filename = "clipboard", en = 1)
w.ci(table = ci.summary.table, filename = "clipboard", en = 1)
Arguments
table |
a table to output. |
filename |
a filename for output. If omitted, a formatted table is copied to the clipboard. |
CI |
If 0, confidence intervals are shown in parentheses. |
signif |
Number of significant digits. |
en |
If 1, creat a table in English. |
Details
w.twoway(table, filename)
function copies the results of two-way table analyses to the clipboard or text file.
w.ttest(table, filename)
function copies the results of t-test to the clipboard or text file.
w.survival(table, filename)
function copies the results of survival analyses to the clipboard or text file.
w.ci(table, filename)
function copies the results of cumulative incidence analyses to the clipboard or text file.
w.multireg(table, filename)
function copies the results of multiple regression to the clipboard or text file.
w.multi(table, filename)
function copies the results of multivariate regression analyses to the clipboard or text file.
"table" can be omitted except for logistic regression analysis and Fine & Gray proportinal hazard regression analysis, in which "odds" and "crr.table" should be specified for "table"(default is "cox.table" to copy the results of Cox proportional hazard regression analysis).
If "filename" is omitted, the formatted table will be copied to the clopboard, which can be pasted into a spreadsheet.
These functions should be performed after executing corresponding analyses from the EZR menu.