R Example
•Descriptive Statistics• Frequency and Histogram Diagrams• Standard Deviation
Excel
• Bar• Histogram• Box / CI’s• Line• Scatter• Pie
Correlation Matrix
BoxplotHistogram
Scatterplot
> getwd()[1] "C:/Users/johnp_000/Documents"
> setwd()
Revisiting the Height Dataset
Dataset Input
Function FilenameObject
str()
Data Types: Numbers and Factors/Categorical
summary()
ece
Frequency Distribution, Histogram
hist(h$childHeight)
Area = 1
Density Plot
plot(density(h$childHeight))
hist(h$childHeight,freq=F, breaks =25, ylim = c(0,0.14))curve(dnorm(x, mean=mean(h$childHeight), sd=sd(h$childHeight)), col="red", add=T)
Bimodal: two modes
Mode, Bimodal
Composite Charts
Boxplot (Box and Whiskers)
50th
75th
25th
Boxplot Options
Basic With Mean Split Data Among Predictors
Correlation
Covariance is High: r ~1
Covariance is Low: r ~0
Galton: Height Dataset
cor(h)Error in cor(h) : 'x' must be numeric
Initial workaround: Create data.frame without the Factors
cor() function does not handle Factors
Later we will RECODE the variable into a 0, 1
Excel correl() does not either
Data Types: Numbers and Factors/Categorical
Correlation Matrix for Continuous Variables
chart.Correlation(num2)PerformanceAnalytics package
Correlations Matrix: Both Types
library(car)scatterplotMatrix(heights)
Top Related