Presentation is loading. Please wait.

Presentation is loading. Please wait.

SAME THING?.

Similar presentations


Presentation on theme: "SAME THING?."— Presentation transcript:

1 SAME THING?

2 Regression and correlation
Diferencia?

3 Vamos a ‘models’ A formal representation of any biological process.
Simplify Patterns Drivers Predictions Etc.

4

5

6

7

8 Correlation tests Parametric Pearson Non-parametric
Spearman (o Kendall’s tau etc.)

9 Appropriate data For Pearson correlation, two interval/ratio variables.  Together the data in the variables are bivariate normal.  The relationship between the two variables is linear.  Outliers can detrimentally affect results. For Kendall correlation, two variables of interval/ratio or ordinal type. For Spearman correlation, two variables of interval/ratio or ordinal type. For linear regression, two interval/ratio variables.  The relationship between the two variables is linear.  Residuals are normal, independent, and homoscedastic.  Outliers can affect the results unless robust methods are used.

10 Hypotheses For correlation, null hypothesis:  The correlation coefficient (r, tau, or rho) is zero.  Or, there is no correlation between the two variables. For linear regression, null hypothesis:  The slope of the fit line is zero.  Or, there is no linear relationship between the two variables. Interpretation For correlation, reporting significant results as “Variable A was significantly correlated to Variable B” is acceptable.  Alternatively, “A significant correlation between Variable A and Variable B was found.”  Or, “Variables A, B, and C were significantly correlated.” For linear regression, reporting significant results as “Variable A was significantly linearly related to Variable B” is acceptable.  Alternatively, “We found a significant linear regression between Variable A and Variable B.”

11 Test for normal distribution residuals
When using Pearson’s test:

12

13 Spearman alternative

14 Spearman example Melfi and Poyser (2007) observed the behavior of 6 male colobus monkeys (Colobus guereza) in a zoo. By seeing which monkeys pushed other monkeys out of their way, they were able to rank the monkeys in a dominance hierarchy, from most dominant to least dominant. This is a ranked variable; while the researchers know that Erroll is dominant over Milo because Erroll pushes Milo out of his way, and Milo is dominant over Fraiser, they don't know whether the difference in dominance between Erroll and Milo is larger or smaller than the difference in dominance between Milo and Fraiser. 

15 After determining the dominance rankings, Melfi and Poyser (2007) counted eggs of Trichuris nematodes per gram of monkey feces, a measurement variable. They wanted to know whether social dominance was associated with the number of nematode eggs, so they converted eggs per gram of feces to ranks and used Spearman rank correlation.

16 cor.test( ~ Sodium + Calories, + data=Data, + method = "pearson", + conf.level = 0.95) Pearson's product-moment correlation data: Sodium and Calories t = , df = 43, p-value = 1.737e-13 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: sample estimates: cor cor.test( ~ Sodium + Calories, + data=Data, + method = "spearman", + conf.level = 0.95) Spearman's rank correlation rho data: Sodium and Calories S = , p-value = 5.443e-12 alternative hypothesis: true rho is not equal to 0 sample estimates: rho Warning message: In cor.test.default(x = c(1287L, 1164L, 1177L, 1262L, 1271L, 1222L, : Cannot compute exact p-value with ties cor.test( ~ Sodium + Calories, + data=Data, + method = "kendall", + conf.level = 0.95) Kendall's rank correlation tau data: Sodium and Calories z = , p-value = 3.774e-10 alternative hypothesis: true tau is not equal to 0 sample estimates: tau Warning message: In cor.test.default(x = c(1287L, 1164L, 1177L, 1262L, 1271L, 1222L, : Cannot compute exact p-value with ties

17 (en literatura) “Mean temperature and minimum monthly rainfall were significantly correlated, r = .54, p < .05.“ “We found a weak but significant correlation between mean temperature and minimum monthly rainfall (r = .54, p < .05).“

18 Regression Linear Logistic Multiple Etc.

19 Difference lm() and glm(). Careful!
lm() fits models following the form Y = Xb + e, where e is Normal (0 , s^2). glm() fits models following the form f(Y) = Xb + e. However, in glm both the function f(Y) (the 'link function') and the distribution of the error term e can be specified. Hence the name - 'generalized linear model'.

20

21

22

23 Input = (" Continuous  Factor                     62          A  63          A  64          A  65          A  66          A  67          A  68          A  69          A  70          A  71          A   72          A  73          A  74          A  75          A  72.5        B        73.5        B        74.5        B  75          B        76          B  77          B        78          B  79          B        80          B  81          B        82          B  83          B        84          B  85          B        86          B ") Data = read.table(textConnection(Input),header=TRUE) model = glm(Factor ~ Continuous,              data=Data,              family = binomial(link="logit")) summary(model)

24

25

26 oven<-read.csv("C:/oven.csv")
Forest OVEN OVENglm = glm(formula = OVEN ~ Forest, family=binomial)

27 summary(OVENglm) Call: glm(formula = OVEN ~ Forest, family = binomial) Deviance Residuals: Min 1Q Median 3Q Max Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) Forest <2e-16 (Intercept) * Forest *** --- Signif. codes: 0 ‘***’ ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: on 1273 degrees of freedom Residual deviance: on 1272 degrees of freedom AIC: Number of Fisher Scoring iterations: 7

28 The most difficult one:
Models with multiple variables, multiple regressions. Multiple correlations

29


Download ppt "SAME THING?."

Similar presentations


Ads by Google