






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Section 1: Introduction (10 pts) Correlation is when two numerical variables are associated. The correlation coefficient is a quality that describes the strength and direction of an association between two numbers of variables measured on a sample of subjects or units. Correlation reflects the amount of scatter in a scatter plot of the two variables. Unlike linear regression, correlation fits no line to the data. The correlation coefficient measures the tendency of two numerical variables to change together along a line. Regression is the method used to predict values of one numerical variable from values of another. A line fitted to the data is the regression line and the line is used to predict the response variable based on the explanatory variable. Like correlation, linear regression measures aspects of the linear relation between two numerical variables. However, regression fits a line through the data to predict one variable from another and to measure how steeply one variable changes with changes in the other. It measures strength of association between two variables, reflecting the amount of scatter in the data. The learning objectives is to calculate a correlation coefficient and the coefficient of determination. Other learning outcomes include testing hypotheses about correlation, using the non-parametric Spearman’s correlation, estimating slopes of regressions, testing regression models, plotting regression lines and examining residual plots for deviations from the assumptions of linear regression.
b. Do the data require any transformation before analysis using linear regression? telomere_inheritance <- lm(offspring_telomere_length ~ father_telomere_length, data = telomere_inheritance) telomere_inheritance Call: lm(formula = offspring_telomere_length ~ father_telomere_length, data = telomere_inheritance) Coefficients: (Intercept) father_telomere_length 0.2252 0. c. Estimate an equation that predicts the offspring telomere length from its father’s. Is there evidence that the father’s telomere length predicts his offspring’s value? The regression equation is: y = 0.2134 + 0.9971*x with a p-value of 4.792e-05. Therefore, there is significant evidence to suggest that the father's telomere length predicts his offspring's value.
c. Assume that the difference between the shapes of these curves is real. What would you conclude about the difference in the way 2nd graders and 4th graders perceive numbers? In conclusion, the difference in the way 2nd^ graders and 4th^ graders perceive numbers at different magnitudes.
geom_point() + theme_minimal() + xlab("Brain mass g") + ylab("Body mass kg") b. Find a transformation (for either or both variables) that makes the relationship between these two variables linear. log_body<- log(mammals$body_mass_kg) log_brain<- log(mammals$brain_mass_g) c. Is there statistical evidence that brain size is correlated with body size? Assume that the species data are independent. library(readr) mammals <- read_csv("DataForLabs/mammals.csv") View(mammals) t.test(mammals$brain_mass_g, mammals$body_mass_kg) Welch Two Sample t-test
lm(formula = brain_mass_g ~ body_mass_kg, data = mammals) Coefficients: (Intercept) body_mass_kg 91.0045 0. Call: lm(formula = brain_mass_g ~ body_mass_kg, data = mammals) Residuals: Min 1Q Median 3Q Max -810.07 -88.52 -79.64 -13.02 2050. Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 91.00454 43.55257 2.09 0.0409 * body_mass_kg 0.96650 0.04766 20.28 <2e-16 ***
Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 334.7 on 60 degrees of freedom Multiple R-squared: 0.8727,Adjusted R-squared: 0. F-statistic: 411.2 on 1 and 60 DF, p-value: < 2.2e-
g. [ OPTIONAL – hint: try using filter() from the dplyr package.] Which species has the highest brain size relative to that predicted by its body size? Which species has the smallest brain relative to that predicted by its body size? Section 3: Feedbacks (bonus) a. What have you learned in this lab? (5 pts) In this lab we learnt about correlation and regression in a data set. We learnt how to use the cor() function to calculate the correlation coefficient as well as the linear regression. b. What do you enjoy the most? (5 pts) I enjoyed the most about this lesson was the discussions with my peers to further understand the topic and the demonstrations using R studio. The best part of this lab was understanding the relationship between the two variables and determining if the data had meaning. c. What do you find confusing and hard to understand? (5pts) In this lab, the most confusing thing for me to understand was analyzing the meaning of the data or the linear regression. It is confusing to understand if my data showed a relationship or not because for me, numbers are hard to understand and convert into words.