R and R Commander plus IPSUR Tutorial

- G. Andy Chang & G. Jay Kerns

 

1.      Download/Install R and R Commander

 

Option 1: Installing R and R Commander

·         For Windows Users: http://gchang.people.ysu.edu/r/Install R Software Windows.pdf

o   If you wish to install a ready to use package, click here to download a Ready-To-Use R and R Commander+IPSUR software (R.zip file) for Windows only (YouTube) (Download and unzip this R.zip file, version 3.6.1. This is for beginners or students who are not comfortable with the software installation.)

·         For Mac Users: http://gchang.people.ysu.edu/r/Install R Software Mac.pdf

o   R Commander Installation Notes for PC/Mac/Linux (Mac users should read this if having problems setting up R Commander, especially about installing XQuartz.)

o   A fix (using Terminal mode) for “can not see the list of options in dropdown menu when using Mac to run R Command” (YouTube).

 

Option 2: Installing R, RStudio, and R Commander

 

Install R and RStudio:

·         For Windows users: https://www.youtube.com/watch?v=VLWaED9jTiA (by  Yusri Yusup)

·         For Mac users: https://www.youtube.com/watch?v=Y20P3u3c_1c (by  Yusri Yusup)

 

Install R Commander from RStudio:

·         For Windows users: https://www.youtube.com/watch?v=aXUyG140v48 (by Collin Burton) [Mac users need to install XQuartz in order to run R Commander.]

 

 

Option 3: Installing R and R Commander with IPSUR Plugin

·         Click here for instructions on installing R and R Commander+IPSUR for Windows, Mac, and Linux  (For version 3.6.0, you will need to use the install.packages command in this instruction for installing Rcmdr or any other packages.) [Mac users need to install XQuartz in order to run R Commander.]

·         Click here to download a Ready-To-Use R and R Commander+IPSUR software (R.zip file) for Windows only (YouTube) (Download and unzip this R.zip file, version 3.6.1. This is for beginners or students who are not comfortable with the software installation. The best way to install R software is installing the latest version as shown in the following link.)

 

Other useful information:

o    YouTube Video on R Commander Demo Part 1

o    YouTube Video on R Commander Demo Part 2

 

2.      R and R Commander References

 

R Commander Reference:

·         Instructions for Using R Commander with IPSUR - G. Andy Chang & G. Jay Kerns

·         Getting Started With R Commander - John Fox

·         R Commander Introduction - Natasha Karp

 

        R Code Reference:

·         http://www.r-tutor.com/elementary-statistics - R Tutorial: Reference for R codes

·         http://www.statmethods.net/index.html - Quick-R: Reference for R codes

·         http://ggplot2.org/ - ggplot: R graphics package

·         Examples of Basic R Codes for Descriptive Statistics

·         https://cran.r-project.org/doc/contrib/Seefeld_StatsRBio.pdf - Using R with Biological Examples

 

 

3.      R Commander Instructions

(Some of the instruction materials were made based on R version 2.*.*. The newer edition of R Commander moved some of the options into additional Option tab.)

 

How to Start R Commander with IPSUR Plugin (Video) (YouTube)

How to set to SDI window environment [text]

 

Data Processing

Import Excel File (Video) (YouTube) [Example Excel data: example.xlsx ; example.xls]

Create a New R Data file using R Code [text]  (data.frame and save functions)

Create Data Frame and Use Editor [text]  (data.frame, save, and edit functions)

Converting to Factor Variable (Video) (YouTube) [Example R data: Practice.rda]

Converting Factor Variable to Numeric Variable [text]

Compute New Variable (Video) (YouTube) [BMI Example R data: Practice1.rda]

Recode a Numeric Variable to a Factor or Numeric Variable (YouTube)

Create a Subset of a Data Set by Removing Varibles using R Subset Function (YouTube)

Create a Subset of a Data Set by Removing Cases (YouTube)

Remove Missing Value Cases (YouTube)

 

Descriptive Statistics

One Qualitative Variable

Making a Bar Chart (Video) (YouTube) [Example R data: Practice1.rda]

Bar Chart & Pie Chart [text]

 

Insert R Graph into Word Document (Video) (YouTube) [Example R data: Practice1.rda]

 

One Quantitative Variable

Histogram (Video) (YouTube) [Example R data: Practice1.rda]

-    Produce histogram and re-label the x and y axis

Normality Tests (Video) (YouTube) [Example R data: Practice1.rda]

-    Normality test for one variable and its subgroups

Histogram, Stem Plot & Strip Chart [text]

Quantile-comparison Plot & Normality Test [text]

Normality Tests for Subgroups [text]

Box Plot and Side-by-side Box plot [text]

 

Relation between Two Qualitative Variables

      Contingency Table [text]

 

Relation between Two Quantitative Variables

      Scatter Plot [text]

 

Display Time Sequence Data

      Line Graph [text]

 

Time Plot (YouTube):   

o    Use Linegraph option: https://youtu.be/B5g6vTJiY_M [3:13]

o    Use Plot of Means option to make time plot [3:23] with x-axis having 8:00, 9:00, ...

 

Bivariate Analysishttps://youtu.be/hMEGfad1zbU  [8:31]  for Cluster bar chart, scatter plot, side-by-side boxplot.

 

 

Probabilities

Binomial [text]

Hypergeometric [text]

Negative Binomial [text]

Geometric [text]

Poisson [text]

Exponential [text]

Normal Probability [text]

Chi-squared Quantile or Critical Value [text]

 

Statistical Inference [Test of statistical hypotheses and confidence intervals]

One Sample Inference for Mean

One Sample t-Test [text]

Compute p-value for t-Test (Video)

 

Two Samples Inference

Paired Sample T-Test and Confidence Interval for Mean Paired Difference (YouTube)

Paired Sample t-Test [text]

Two Independent Sample t-Test [text]

Test of Equality of Variances [text]

·         Confidence Interval Estimate for Variance [text]

 

One Way ANOVA

One Way ANOVA F-test (Video) (YouTube)

One-way ANOVA [text]

Compute p-value for ANOVA F-Test (Video)

 

Inference on Proportions

[Video] Confidence Interval for One Proportion using frequency/counts data. [3:26]

[Video] Hypothesis Test for One Proportion – with frequency data using prop.test() [3:08]

[Text] Tests of One Proportion & Equality of Two Proportions using frequency/counts data

 

*Test of One Proportion using raw data should be pretty straight forward using R Commander. You only need to select the proper variable, and the rest would be the same as in R Commander instruction videos above.

 

Contingency Table Analysis for Categorical Data

Chi-Square Test for Independence with Raw Data (Video) [The convert numeric variable to factor option in Data Editor is not available in the new version of R Commander. You need to use the Data option to do it.]

Chi-Square Test for Independence with Organized Data (Video)

Chi-square Test for Independence [text]

MacNemar Test example output [text] [R code, R Document]

Mantel-Haneszel Test example output [text] [R code, Reference link for R code]

 

Nonparametric Tests

Signed Rank Test (YouTube) [Good for one sample or paired sample]

Signed Rank Test for One Sample (Video) (YouTube)

Signed Rank Test for Paired Sample (Video) (YouTube)

Wilcoxon Rank Sum Test/Two Independent Samples Test (Video) (YouTube)

Kruskal Wallis Test/One Way ANOVA Test (Video)

 

Correlation and Regression

Simple Linear Regression (Video) [Example R data: WeightAgeHeight.RData]

Multiple Regression part 1: Model Building and Diagnostics (Video)

Multiple Regression part 2: Prediction Interval (Video) [R code]

Compute and Test for Linear Correlation & Linear Regression [text]

 

Logistic Regression

Logistic Regression part 1: Model Setup and Building (Video) (YouTube) [Data: Logistic.RData]

Logistic Regression part 2: Probability Prediction (Video) (YouTube) [R code]

               

Survival Analysis

Survival Analysis: Compare Survival Functions and Cox Regression

 

 

Any questions and comments please contact Andy Chang at gchang@ysu.edu