# Outline Research Question: What determines height? Data Input Look at One Variable Compare Two Variables Children’s Height and Parents Height Children’s.

## Presentation on theme: "Outline Research Question: What determines height? Data Input Look at One Variable Compare Two Variables Children’s Height and Parents Height Children’s."— Presentation transcript:

Outline Research Question: What determines height? Data Input Look at One Variable Compare Two Variables Children’s Height and Parents Height Children’s Height and Gender Graphic Packages: ggplot2

What factors are most responsible for height?

X1X2X3Y Galton’s Family Height Dataset

Galton’s Notebook on Families & Height

> getwd() [1] "C:/Users/johnp_000/Documents" > setwd()

Dataset Input Function Filename Object h <- read.csv("GaltonFamilies.csv")

str() summary() Data Types: Numbers and Factors/Categorical

Steps Continuous Categorical Histogram Scatter Boxplot Child’s Height Dad’s Height Gender Continuous Type Variable Mom’s Height

Frequency Distribution, Histogram hist(h\$child)

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) Mode, Bimodal

Grammar of Graphics formations Legend Axes Seven Components ggplot2 built using the grammar of graphics approach

Asst. Professor of Statistics at Rice University ggplot2 plyr reshape rggobi profr Hadley Wickman and ggplot2 http://ggplot2.org/

In ggplot2 a plot is made up of layers. ggplot2 Plot

ggplot2 library(ggplot2) h.gg <- ggplot(h, aes(child)) h.gg + geom_histogram(binwidth = 1 ) + labs(x = "Height", y = "Frequency") h.gg + geom_density()

ggplot2 h.gg <- ggplot(h, aes(child)) + theme(legend.position = "right") h.gg + geom_density() + labs(x = "Height", y = "Frequency") h.gg + geom_density(aes(fill=factor(gender)), size=2)

Box Plot

Children’s Height vs. Gender boxplot(h\$child~gender,data=h, col=(c("pink","lightblue")), main="Children's Height by Gender", xlab="Gender", ylab="")

Descriptive Stats: Box Plot

Subset Males men<- subset(h, gender=='male')

Subset Females women <- subset(h, gender==‘female')

Children’s Height: Males hist(men\$childHeight)

Children’s Height: Females hist(women\$child)

ggplot2 library(ggplot2) h.bb <- ggplot(h, aes(factor(gender), child)) h.bb + geom_boxplot() h.bb + geom_boxplot(aes(fill = factor(gender)))

Steps Continuous Categorical Histogram Scatter Boxplot Child’s Height Dad’s Height Gender Continuous Y X1, X2 X3 Type Variable Mom’s Height

Correlation

?cor cor(h\$father, h\$child) 0.2660385

Scatterplot Matrix: pairs()

Correlations Matrix library(car) scatterplotMatrix(heights)

ggplot2

Analytics & History: 1st Regression Line The first “Regression Line”

Steps Continuous Categorical Histogram Scatter Boxplot Child’s Height Dad’s Height Gender Continuous Type Variable Mom’s Height

Appendix

.net BIRT cytoscape flot gephi gnuplot graphite iDashboards Incanter Java JMP Javascript: Raphael Highcharts Arbor jfreecharts BI Tools Spotfire Cognos MicroStrategy LogiXML MDX Mondrian octave openlayers OpenViz PhP Powerpoint precog Prezi processing Ptotobi Silverlight splunk SSRS talend webGL Wijmo WPF Xcelcuis XLMiner May, 2013 N=172 What software do you use for creating charts or data visualizations?

Easy to Use Interactive Standard Visualizations Steep Learning Curve Visualization and Reporting

http://public.tableausoftware.com/views/PapelbonPitchFX/PapelbonPitchFX BI Software: Tableau

http://rcharts.io/gallery/

https://plot.ly/r/

http://shiny.rstudio.com/gallery/movie-explorer.html

The next data visual was produced with about 150 lines of R code

Data Viz Tutorials

Download ppt "Outline Research Question: What determines height? Data Input Look at One Variable Compare Two Variables Children’s Height and Parents Height Children’s."

Similar presentations