Name:_______________________ ENS 495 Fall 2016 12/15/2016 Test 3: Regression

```
#This is the test key.
#Notes regarding the test will be sent via email
#and the course Facebook page
# https://www.facebook.com/groups/930301587096169/?ref=bookmarks
#COrrect answers are flagged with the text
# "**CORRECT**"
```

All questions are weighted as 2 points unless otherwise stated.

**Question 1:** Which **TWO** statements in the list below about correlation analysis are **TRUE** and can be used to complete the following sentence:

**Correlation analysis investigates/determine if…** (circle 2 answers)

- There is a significant relationship between 2 variables
**CORRECT!** - The relationship between variables is positive or negative
**CORRECT!** - The relationship between 3 or more variables is significant
- The relationship between a binomial variable and a numeric variable is significant.
- One variable is physically or biological causing change in another

**Question 2:** Regression analysis is **different** than correlation analysis for which of the following reasons (that is, what does regression analysis assume or do that correlation analysis does not or can not?)

`#This question should be re-worded if used in teh future`

- It can determine if there is a positive or negative relationship between y and x.
- It assumes no causal relationship between y and x.
- It cannot be used for prediction
- It assumes a directional relationship between variables, such as y is caused by x.
**CORRECT!**

**Question 3:** What mathematical method is used to fit a regression line to data?

- Maximum Entropy
- Least Squares
**CORRECT!** - Correlation analysis
- Mean square error (MSE)
- All of the above
- None of the above

**Question 4:** When you fit a regression line to data, the **TWO** parameters that describe form of the line through the scatterplot are: (circle 2 answers)

- Slope
**CORRECT!** - p-value
- F-statistic
- Standard error (SE)
- R^2
- Intercept
**CORRECT!**

**Question 5:** When you run a regression, **uncertainty** about the true value of the slope of the line can be characterized

- p-value for the regression model
- Standard error (SE) and/or confidence interval (CI)
**CORRECT!** - F-statistics for the model
- R^2 value

**Question 6** For the following questions consider the graph above

**6a:** Which line in the graph above represents the **NULL Hypothesis** or model (Ho)? (1 point)

- Line 1 (Flat dashed line)
**CORRECT!** - Line 2 (Angled solid line)

**6b:** For the graph above, which line represents the **Alternative Hypothesis** or model (Ha)? (1 point)

- Line 1 (Flat dashed line)
- Line 2 (Angled solid line)
**CORRECT!**

**6c)** Just looking at the graph, which hypothesis do you think is most likely to be true? (1 point)

- Null hypothesis (Ho)
- Alternative hypothesis (Ha)
**CORRECT!**

**6d)** What term best characterizes Line 1

- Positive slope (+)
- Negative slope (-)
- Slope of zero (0)
**CORRECT!** - The term “slope” is not relevant

**6e)** What is the **“word equation”** that would be appropriate for a regression model for these data in the plot?

- Ozone ~ Intercept + Slope*Temp
**CORRECT!** - Temp ~ Intercept + Ozone*Temp
- Ozone ~ Temp
- y ~ mx + b

**Question 7)** A model using temp and ozone was fit to these data usig the lm() function in R. The following output was produced using the summary() command.

` Estimate Std. Error t value Pr(>|t|) `

Intercept -146.9955 18.2872 -8.038 9.37e-13 * Temp 2.4287 0.2331 10.418 < 2e-16 *

**7a)** Write the full **mathematical equation** described by this output.

**7b)** In the output above, what is the p-value? Write it below.

**7c)** How do you interpret this p-value.

- Significant
- Non-significant
- Marginally significant
- Not enough information
- p-values are dumb

**Question 8)** **TRUE / FALSE** (circle one) Regression, ANOVA and t-tests are all fundamentally **different** methods that require different statistical approaches. (1 point)

**Question 9)** In the figure above, the left-hand size of the plot shows a scatter plot of the data. The right hand side shows a regression line through the data.

What are the **vertical lines** drawn from the regression line up or down to each data point?

- Residuals
- Intercepts
- Slopes
- Least squares
- Mean square errors (MSE)

**Question 10)** The above plot show diagnostics from the scatter plot in the previous question.

**10a)** Which **TWO** plots provide information on the normality of the data? (circle 2 answers)

- Plot a
- Plot b
- Plot c
- Plot e

**10b)** Which plot provides information about whether there are any **outliers** and/or **influental points** in the data set?

- Plot a
- Plot b
- Plot c
- Plot e

**10c)** Is there a outer/influential point in this data set, and if so what is it? (1 point)

- There is not an outlier/influential point
- There is an influential point and it is _________

**Question 11:** When doing regression, the process involves calculating the residuals of the regression model and doing what mathematically to them to determine the line that best fits the data?

- Doing nothing to them. The line of best fit is determined using the raw residuals
- Getting rid of the negative sign (-) by taking the absolute value (abs) of the residual
- Getting rid of the negative sign (-) by squaring the residual (eg, residual^2)
- Cubing the residuals, ie I(residual^3)

**Question 12:** The standard error (SE) of the slope of a regression line represents:

- Variation in the slope due to non-random sampling
- Error due to non-normal residuals
- Uncertainty about the true slope of the line
- Variation in the intercept
- All of the above
- None of the above

**Question 13:** The value of R^2 from a regression tells us:

- How well the model fits the data
- If the line is significantly different from zero
- If the p-value is small
- If the slope is positive or negative
- None of the above
- All of the above

**Question 14:** **TRUE / FALSE:** If you have a very low p-value (highly significant difference), you you must also have a very high R^2 value. Therefore, R^2 is highly correlated with p-values. (1 point)

**Question 15:** What are the key assumptions of regression? (4 points)

**Question 16:** Which of your 4 key assumptions is the most important to pay attention to (1 point; refer to to the list you made for question 17)

- Assumption 1

- Assumption 2

- Assumption 3

- Assumption 4

**Question 17:** The left-hand graph above shows a plot raw data, and the right hand graph shows a diagnostic plot.

**17a)** What assumption of regression analysis does this diagnostics plot tell us about? (refer to the list you made above)

- Assumption 1

- Assumption 2

- Assumption 3

- Assumption 4

**17b)** Do these data appear to violate this assumption?

- Yes, assumption violated.
- No

**17c)** Assuming these data do indeed violate this assumption, what could be done to try to fix the problem?

- Nothing
- Remove outliers
- Log transformation of predictor (x)
- Log transformation of response (y)
- Collect more data

**Question 18:** Which of the following things does the **log tranformation** **NOT** do

- Improve normality of the residuals
- Make the variance more constant
- Reduce impact of non-random sampling
- Reduce the impact of outliers

**Question 19)** Which **two** statements are true about outliers

- All outliers are bad data points that should be removed
- Regression models assume that there are no outliers
- All outliers occur due to errors during data collection or data entry.
- Diagnostics techniques such as plot cannot identify outliers
- Outliers can occur due to real but extreme observations

```
x <- runif(100,1,10)
y <- 10.0 + 12.0*x + -0.872*x^2 + -0.0072*x^3 + -0.000972*x^4 + rnorm(length(x),0,10)
scatter.smooth(x,y, main = "Question 20")
```

**Question 20)** For the following questions consider this scatter plot of variable y plotted against variable x.

**20a)** The line through the data was not draw using regression but instead using a technique use to help visualize curvey data. What is the name of this type of line? (1/2 point)

- A curvey line
- Logistic model
- 2-way ANOVA (aka 2 x 2 ANOVA)
- A smoother
- None of the above
- All of the above.

**20b)** What is the technical name for a such as this that is not straight? (1/2 point)

- Logistic
- Curvey
- Residual
- Asymptote
- Non-linear

**Question 21)** What R code would you add to a regression to model a curvey line? Assume the predictor is called “x” (1 point)

- I
- I()
- I(x)
- I(x^2)
- I(x^3)
- I(1/x)
- none of the above

**Question 22) Logistic regression** is used to model

- Binomial predictors
- Categorical response w/2+ levels (red, blue, green)
- Numeric responses
- Binomial responses (alive/dead)
- Numeric predictors
- None of the above
- All of the above

**Question 23)** Which of these **TWO** statements are true about **logistic regression** (circle 2)

- Confidence intervals cannot be greater than 1
- Confidence intervals cannot be less than 0
- Confidence intervals cannot be calculated
- Confidence intervals should be calculated from percentages

**Question 24)** This plot shows three sets of data (diamonds, circles, triangles) and regression lines running through them. **What statement is true about these lines?**

- They all have the same intercept
- They all have the same slope
- They are all all significantly different from 0
- They all represent an alternative hypothesis.
- They are all random

**Question 25)** The figure above, in the top-left panel, shows scatter plot of raw data with a regression line and a “confidence band” (aka “confidence ellipse”) around the line. This line represents uncertainty about the true values of the parameters that define the line. In panels a, b, and c are shown 3 other possible regression lines as thick lines plotted with the original regression line (now thin and dotted) and confidence band.

**Of the 3 alternative regression lines, which ones are possible alternatives that are consistent with the data?** (1 point)

- Fig a (upper right)
- Fig b (lower left)
- Fig c (lower right)
- All are consistent with the data
- None are consistent with the data

**Question 26)** In the plot above, the raw data used previously is plotted with it 95% Confidence Band. Panels a, b and c represent similar regression lines fit to alternative data sets with **different sample sizes.**

**Why do the confidence bands change size? (1 point)**

- When sample sizes are small there are more
**outliers**and confidence bands are big. When sample sizes are large confidence bands ar narrow. - When sample sizes are small parameters are
*not*estimated with precision and confidence bands are big. When sample sizes are large parameters can be estimated precisely and confidence bands are narrow. - Change in the error bands is not related to sample size and is just due to random error.
- None of the above
- All of the above

**Question 27** The plot above shows four hypothetical regression lines with different intercepts and slopes

**27a)** Which plots have positive (+) slopes? (circle all that apply; 1 point)

- Plot a)
- Plot b)
- Plot c)
- Plot d)
- None

**27b)** Which plots have negative (-) slopes? (circle all that apply; 1 point)

- Plot a)
- Plot b)
- Plot c)
- Plot d)
- None

**27c)** Which plots have zero (0) slopes? (circle all that apply; 1 point)

- Plot a)
- Plot b)
- Plot c)
- Plot d)
- None

**27d)** Which plots have positive intercepts? (circle all that apply; 1 point)

- Plot a)
- Plot b)
- Plot c)
- Plot d)
- None

**27e)** Which plots have negative intercepts? (circle all that apply; 1 point)

- Plot a)
- Plot b)
- Plot c)
- Plot d)
- None

`## [1] "Plant" "Type" "Treatment" "conc" "uptake"`

**Question 28)** In a lab experiment researchers were interested in the effect of carbon dioxide concentration (CO2) in the air the rate at which plants can use CO2 for photosynthesis. Their response variable was CO2 uptake rate (“uptake”) and their predictor variable was CO2 concentation (“conc”).

**28a)** Write the R code to represents a “null” hypothesis (Ho); that is, a model that assumes “update” **does not** change with “conc” (1 point)

**28a)** Write the R code to represents a “alternative” hypothesis (Ho); that is, a model that assumes “uptake” **does** change with “conc” (1 point)

**28a)** Assume that the null model is called “m.null” and the alternative model is called “m.alt”. Write the one line of R code used to test whether the null hypothesis should be rejected.

`anova(m.null,m.alt)`

```
## Analysis of Variance Table
##
## Model 1: uptake ~ 1
## Model 2: uptake ~ conc
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 29 1470.7
## 2 28 1436.8 1 33.933 0.6613 0.423
```

`summary(m.alt)`

```
##
## Call:
## lm(formula = uptake ~ conc, data = CO2[i.use, ])
##
## Residuals:
## Min 1Q Median 3Q Max
## -11.0375 -5.1557 0.2152 6.7416 10.0625
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 21.420631 3.037488 7.052 1.14e-07 ***
## conc 0.004017 0.004940 0.813 0.423
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.163 on 28 degrees of freedom
## Multiple R-squared: 0.02307, Adjusted R-squared: -0.01182
## F-statistic: 0.6613 on 1 and 28 DF, p-value: 0.423
```

**Question 29** Above is partial R output from an analysis of the data in question 28.

**Question 29a)** What hypothesis does this data support?

- Ho
- Ha

**Question 29b)** Write a sentence using this output to describe the results of this study.

**Question 30** Which plot indicates a violation of an assumption of regression modeling?

- The left-hand plot
- The right-hand plot
- Neither plot

**Question 31** You are reading an old paper from the Journal of Aquatic Ecology and the author’s state “The regression analysis we conducted was highly significant (p < 0.0001), supporting our hypothesis that pH impacted the abundance of insects in southwestern PA streams.”

**31a** What can you conclude about the slope of the regression model from this p-value?

- The slope is very likely to be positive (+)
- The slope is very likely to be negative (-)
- The slope is very likely to be zero (0)
- Has a slope that is very likely to be different than zero (0)

**31b** What can you conclude about the R^2 value of the regression model from this p-value?

- The R^2 value is very high (near 0.8).
- The R^2 value is very low (near 0.1).
- The R^2 value is highly significant.
- There is no information in this statement about R^2