R Statistics Essential Training
Creating crosstabs for categorical variables
- look at the structure of the dataset using
str()
Convert table to data frame with one row per observation
Check first five rows of data using head()
Create contingency table for survived
and Class
- Call also get cell, row, and column %
- With rounding to get just 2 decimal places
- Multiplied by 100 to make %
Chi-squared test
Additional tables
- Observed frequencies (same as ttab)
Analysis of Variance
Comparing means with ANOVA
- fill in and run , all have the same variance of
64
draw a boxplot
Combine vectors into a single data frame
Stack data to get one column with outcome
and second columns with group
Conduct one-way ANOVA
- Formula result is F(3, 116) = 3.24, p = .025
Post-hoc comparisons
- define 4 variables with 40 observations , all have the same variance of
81
with mean
30,34,36,41
- do a post hoc test and save it in an object