Ecological theory and data analysis
Some R code
- t.test(extra~group, data = sleep, paired = TRUE)
- cor.test(c(1:10), c(11:20))
Correlation is not slope but if one goes up the other goes up (x and y are correlated)
c = ‘combine’
- Anova(m1,m2): compares model 1 and 2
- Drop1: drop explanatory variables one by one
Distributions
Types of distributions that best represent data of variables
Normal (Gaussian) distribution in R
Histogram in R
,Poisson distribution in R (only positive discrete values, thus no fractions nor negatives)
Lambda parameter (only 1)
glm with family/argument set to poisson
means log link is used
Binomial distribution in R (only 2 possibilities)
Beta distribution in R (limited by 0 and 1, no negative values, but useful for continuous data (fractions))
Look at Wikipedia for the different shape parameters (shape1=1, shape2=4)
, Gamma distribution (continuous, positive data)
Can for example go down very low to almost zero; Poisson often go to that extreme
Negative binomial distribution (large, positive integers)
When the variance is much larger than the mean (variance>mean) (Poisson distribution cannot do this)
Multinomial distribution in R (limited outcomes, but more than 2)
Some R code
- t.test(extra~group, data = sleep, paired = TRUE)
- cor.test(c(1:10), c(11:20))
Correlation is not slope but if one goes up the other goes up (x and y are correlated)
c = ‘combine’
- Anova(m1,m2): compares model 1 and 2
- Drop1: drop explanatory variables one by one
Distributions
Types of distributions that best represent data of variables
Normal (Gaussian) distribution in R
Histogram in R
,Poisson distribution in R (only positive discrete values, thus no fractions nor negatives)
Lambda parameter (only 1)
glm with family/argument set to poisson
means log link is used
Binomial distribution in R (only 2 possibilities)
Beta distribution in R (limited by 0 and 1, no negative values, but useful for continuous data (fractions))
Look at Wikipedia for the different shape parameters (shape1=1, shape2=4)
, Gamma distribution (continuous, positive data)
Can for example go down very low to almost zero; Poisson often go to that extreme
Negative binomial distribution (large, positive integers)
When the variance is much larger than the mean (variance>mean) (Poisson distribution cannot do this)
Multinomial distribution in R (limited outcomes, but more than 2)