0% found this document useful (0 votes)
110 views

Lab 4

The document discusses using R code and output from Lab 4 notes to analyze relationships between variables in two datasets: 1) A roses dataset analyzing the relationship between number of roses sold and selling price. There is a strong negative linear relationship with a correlation of -0.95. 2) A climate dataset analyzing the relationship between CO2 levels and global temperature. There is a strong positive linear relationship with a high correlation. The regression model predicts that for every 1 ppm increase in CO2, temperature increases by 0.98 degrees C. 3) Questions ask about visualizing relationships in scatterplots, calculating correlations and least squares regression lines, and using the climate regression model to predict temperatures for specific CO2 levels

Uploaded by

cracking khalif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
110 views

Lab 4

The document discusses using R code and output from Lab 4 notes to analyze relationships between variables in two datasets: 1) A roses dataset analyzing the relationship between number of roses sold and selling price. There is a strong negative linear relationship with a correlation of -0.95. 2) A climate dataset analyzing the relationship between CO2 levels and global temperature. There is a strong positive linear relationship with a high correlation. The regression model predicts that for every 1 ppm increase in CO2, temperature increases by 0.98 degrees C. 3) Questions ask about visualizing relationships in scatterplots, calculating correlations and least squares regression lines, and using the climate regression model to predict temperatures for specific CO2 levels

Uploaded by

cracking khalif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Part I: 10 points total

Use the output obtained in the Lab 4 notes (related to the roses data set) to answer the questions in

Part I.

1. (2 points) Using the scatterplot, describe the relationship between number of roses sold and

selling price (direction, linear or curved, strength, outliers or other deviations from the pattern).

### MAKE A SCATTERPLOT

with(ROSES, plot(number, price,


main="Number of Roses vs Wholesale Price",
xlab="Number of Roses Sold Around Mother's Day",
ylab="Price of a Dozen Roses ($)",
pch=16))

2. (2

points) Is

it

appropriate to use the correlation coefficient in this problem? Explain. (Your explanation should be

in reference to the scatterplot – what kind of relationship between the two variables must exist to

use the correlation coefficient to accurately describe the strength of the relationship?)

Its appropriate to use the correlation coefficient when:


 The relationship between the response and explantory varibles is linear
 There are no influential outliers
Yes, these are satisfied in this problem.

3. (1 point) Regardless to your answer to question #2 above, report the correlation coefficient.

### CORRELATION COEFFICIENT

with(ROSES, cor(number, price))

## [1] -0.9568285

4. (2 points) Write the equation of the least-squares regression line. Define the terms in the

equation. (i.e. state what “x” and ˆy represent in the context of the problem.)

### MODEL SUMMARY

summary(mod)

##
## Call:
## lm(formula = price ~ number)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.2577 -0.8941 -0.3015 1.4926 2.8510
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 55.2515197 1.8568565 29.75 4.67e-14 ***
## number -0.0028964 0.0002351 -12.32 6.68e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.86 on 14 degrees of freedom
## Multiple R-squared: 0.9155, Adjusted R-squared: 0.9095
## F-statistic: 151.7 on 1 and 14 DF, p-value: 6.684e-09

5. (2 points) Interpret the slope in the least-squares regression equation in the context of the

problem.

Slope: For every additional flower sold the wholesale price for a dozen roses sold decreases by $0.003.Y-intercept: The

wholesale price of zero roses is $55.25.


6. (1 point) Predict the number of roses sold when the wholesale selling price of a dozen roses is

$35.50. (Use R to obtain this value.)

### NUMBER OF ROSES FOR $35 PRICE PER DOZEN

## NOTE: THERE MAY BE SMALL ROUNDING ERRORS


(35-55.2515197)/(-0.0028964)

## [1] 6991.962

$60.It is not appropriate to calcuate the number of roses for $60 since is value
is outside of the slope of our data. Therefore, this would be extrapolation.

Part 2: 12 points total

Use the data to answer the following questions. (Note: the “year” variable is not used in the

analysis.)

7. (1 point) Which variable (CO2 or temperature) is the response variable and which is the

explanatory variable?

We know that explanatory variable is independent, we can say that response variable is harvest. The hair temperature is

its own variable. Our temperature is the explanatory variable. We can conclude that the explanatory variable is

temperature and response valuable response readable is harvest of deep harvest of the drop and this is the required

solution.

8. (1 point) Generate and include a properly labeled scatterplot showing the relationship between

carbon dioxide level and temperature. (Use the R code on pages 1 and 2 of the Lab 4 notes to

generate the scatterplot, changing the name of the data set, variable names, title, and labels for the

axes.)
9. (2 points) Based on the scatterplot, describe the relationship between carbon dioxide level and

temperature (linearity, direction, strength, and any deviations from the pattern).

What this tells us is that is a positive tightly packed scatterplot. It is positive because it is going from left to

right and it is strong because the correlation coefficient is strong

10. (1 point) Using the general R code at the bottom of page 2 of the Lab 4 notes, obtain and report

the correlation coefficient to describe the strength of the linear relationship between CO2 and

temperature. A goal is to predict temperatures for different levels of carbon dioxide. To do so, we

will use the least-squares regression equation. Using the appropriate R code from page 3 of the Lab

4 notes, generate the linear model (i.e. least-squares regression model). From that model, obtain the

y-intercept and slope.

11. (2 points) Write the least-squares regression equation. Define the terms in the equation (i.e. state

what

“x” and ˆy represent in the context of the problem.)


12. (2 points) Interpret the slope of the least-squares regression equation in the context of the

problem.

13. (1 point) In 2015, CO 2 was 400.83 parts per million on top of Mauna Loa. What does our

model (i.e.

least-squares regression equation) predict the global temperature to be for this CO 2 level? Use the

predict() command at the bottom of page 3 of the Lab 4 notes to find this predicted value:

predict(mod, data.frame(explanatory = value))

14. (2 points) What does our model predict the global temperature for October 11, 2021 (when CO

2 was recorded as 413.78 ppm)? (Use R to obtain this value using the predict() command on page 3

of the Lab 4 notes.).

15. According to our model, at what CO 2 level would result in a predicted global temperature 2

degrees Celsius above the November 1850 temperature? Again using our model, what year would

this happen? (Note: the last year of data in the climate data set is 2017.) Show or explain how you

obtained the answers to these two questions.

You might also like