# Statistics with R, part 2

## Data types

• Independent
• Measurements
• Factors
• Dependent
• Measurements
• Counts (in different classes)
• Species Composition

## Statistical tests

A simple classification of tests, based on input data class:

 independent variable: Continuous Nominal(Y/N, live/die..., or Categorical) dependent variable: Continuous (measurement) scatterplots, cor.test, lm, glm box plots, t.tests, wilcox.test, lm, glm Continuous (counts) glm(..., family=poisson) glm(..., family=poisson), wilcox.test Nominal or categorical logistic regression (glm, family=binomial) contingency tables, chisq.test, fisher.test
```x <- c(1,2,3,4,4,5,6,8,9,10)
y <- c(2,3,4,4,5,6,8,8,9,11)
plot(y~x)
cor.test(x,y)
wilcox.test(x,y)
summary( lm(y ~ x) )
xy.lm <- lm(y ~ x)
xy.lm
abline(xy.lm)

bird <- c("b","g","g","g","g","b","b","b","b","b")
build <- c("r","w","r","r","r","w","w","w","w","w")
table(bird,build)
chisq.test(bird, build)
bird2 <- c(bird,bird)
build2 <- c(build,build)
table(bird2,build2)
chisq.test(bird2, build2)
```