 Download Download Presentation Review of yesterday

# Review of yesterday

Download Presentation ## Review of yesterday

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. Review of yesterday [ ] perm book www.ekolog.se/mstat

2. Reporting statistics • Birch twigs with flowers were • shorter than birch twigs without • flowers (t=2.7, p=0.014, N=30). • Use two significance digits • Or use p<0.0001

3. Copy-Paste Statistics Open your data set in R: library(xlsReadWrite) yourdata<-read.xls(file.choose()) attach(yourdata) names(yourdata)

4. Check for Errors names(yourdata) fix(yourdata) levels(your.x) is.numeric(your.y)

5. Check for Errors levels(your.x) ”with ” ”Without”

6. Addresses • x<-c(1,5,2,4) • x • 5 3 4 • x • 5

7. Ash seed dispersal

8. Acer twigs – plasticity

9. Birch – cost of reproduction

10. Parametric tests use a normal curve instead

11. Area under the curve 95% No. random samples 2,5% 2,5% Difference

12. Risk of by chance only < 5 % 95% No. random samples 2,5% 2,5% Difference

13. Risk by chance = 1,4 +1,4 = 2,8 % 95% No. random samples 1,4% 1,4% Difference

14. p-value • 2,8 % is the probability (p) that there is NO real difference. • p = 0,028 means that there is a 2,8% chance that the groups do not really differ, but that we by chance get the data points that we collected. • 2,8 % probability is ridiculously small! We don’t believe in that! • If it’s is not just due to chance, it must depend on something else… • … e.g., water quality. The habitats differ significantly. • p < 0,05 counts as ridiculously small

15. p-value is NOT! • p = 0.23 does NOT mean that there is NO difference. • There might be a difference, but we are not confident enough to state that. • The risk that the result is due to chance alone is too high. • p = 0.052 is very very close to ”ridiculously small” so there might indeed be a difference.

16. Intervals • Not really confidence intervals… • A confidence interval is around the estimated value. • There is a 95 % chance that the true mean or the true slope is within the confidence interval.

17. Confidence intervals

18. Intervals • We have calculated permutation critical values. • This interval includes the 95 % most likely values that you can get by chance alone (if there is no relationship or no difference). • If the actual value from a study is outside this critical interval, it means that the result is very unlikely to be an effect of chance alone. • Then the p-value is less than 5 % and the result is significant.

19. Critical values No. random samples Difference

20. Today: Categorical response variables

21. Categorical response variables • Logistic regression • 2×2-test

22. 16 14 12 10 8 6 4 Red ants Black ants Logistic regression 2  2 tables Categoric 1.0 Melica 0.8 0.6 Prob. of choosing Melica 0.4 0.2 0.0 Response variable Luzula 4.5 5.5 6.5 7.5 Ant size Regression Anova t-test Continuous - - Seed size Continuous Categoric Explanatory variable

23. Logistic regression • Binary response = Either… or…(i.e., categorical with 2 outcomes) • Continuous explanatory

24. Logistic regression • Examples: • Does seed size (x) affect germination (y)? • Does body fat reserves (x) affect survival (y) in hedge hogs? • Does flower size (x) affect pollination (y) or seed predation (y)?

25. Logistic regression • Easy to test in R! • But the test ”under the hood” is complicated. • Hard to make a neat graph. • stripchart(x~y) • Hard to give an intuitive effect.(cf. regression slope)

26. Logistic regression

27. p < 0.0001

28. Logistic regression

29. p = 0.24

30. Logistic regression

31. p = 0.090

32. Logistic regression

33. p = 0.0016

34. Break?

35. 16 14 12 10 8 6 4 Red ants Black ants Logistic regression 2  2 tables Categoric 1.0 Melica 0.8 0.6 Prob. of choosing Melica 0.4 0.2 0.0 Response variable Luzula 4.5 5.5 6.5 7.5 Ant size Regression Anova Continuous - - Seed size Continuous Categoric Explanatory variable

36. 2×2 = proportions • Binary respons = Either… or…(i.e., categorical with 2 alternatives) • Binary explantory = Either… or…(i.e., categorical with 2 alternatives) • Contingency tables • Fischer’s exact test  easy in R(super easy in R commander!) • Sometimes Chi-2 have been used • BUT, it does not give an exact p-value

37. 2×2 = proportion test • Examples: • Do men and women have different preferenses? • Does different ants prefer different seeds? • …

38. Lunches for students and lecturers lunchchoice ~ students.teachers

39. More than two groups • Avoid! • What is really the explanatory variable (x)? • Could you do a logistic regression instead? • But it is possible  Generalised linear model, something like a ”logistisk anova” (but it’s usually called a 3×2 contingency table)

40. Break? • No?

41. Before your study • What is your hypothesis? What would the result look like if your idea is correct? • What is your null hypothesis? • Draw graphs for Logistic regression!! • (Fake data – test to test)

42. Ant dispersal • Elaiosome

43. Do ants prefer seeds with large elaiosomes? Response: Elaiosome size (categorical) No explanatory

44. Ant preferences • Green pearl = Small elaiosome (ant candy) • Black pearl = Large elaiosome (ant candy) • Blue bag = All ants that collect seeds • Do ants select for larger elaiosomes? • Experiment: 30 ants (=30 pearls)

45. Ant preferences • Blue bag = All ants that collect seeds • ”By chance”-bag = equal numbers of • red and white pearls • Let’s pretend:White pearl = Large; Red pearl = Small •  what experient results can you get by chance?

46. random pearls...

47. Is this because of chance? • Is there a risk of more than 5 % that the pattern in the experiment is due to chance? • No!  Aha! Significant!Then it must be explained by something else (than chance). • E.g., that there is not 50 % ants with small elaiosomes and 50 % with large. • And that ants prefer large elaiosomes. • Well, yes...  Well, then our experiment result may be explained by chance effects (random sampling). And perhaps ants don’t care.

48. What is the chance (in percent) to get as clear pattern as you got in your experiment, only by chance? = p-value