---
title: "Homework 01 Solutions"
date: "2022-09-02"
output: 
  pdf_document:
    keep_tex: true
    fig_caption: true
header-includes:
  - \usepackage{amsmath}
  - \usepackage{amsthm}
  - \usepackage{hyperref}
  - \usepackage{xcolor}
  - \DeclareMathOperator{\Cov}{Cov}
  - \DeclareMathOperator{\Corr}{Corr}
  - \DeclareMathOperator{\Var}{Var}
  - \DeclareMathOperator{\upmodels}{\perp \!\!\! \perp}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, include = TRUE, message = FALSE)
# library(knitr)
```


\def\red#1{\textcolor{red}{#1}}
\def\blue#1{\textcolor{blue}{#1}}
\let\bar\overline
\let\ul\underline

\frenchspacing


\begin{center}
\Large
36-617: Applied Linear Models\\
Fall 2022\\
Solutions
\end{center}


```{r}

library(arm)  ## includes lme4, MASS, Matrix
library(ggplot2); theme_set(theme_bw())
library(gridExtra) ## to arrange ggplots...
```



# Problem 1:  ISLR second Ed. p. 123 \#8.  

```{r}

## You can use
##
##           getCRANmirrors(all = FALSE, local.only = FALSE)
##
## to get a listing of all the CRAN mirrors from which you can get 
## packages to install...

## install.packages("ISLR2",repos="https://cran.case.edu/")  # only have to do this once...

library(ISLR2)  ## do this once in every R session where you want to use this library.

```
## 1(a)

Use the \verb|lm()| function to perform a simple linear regression with
\verb|mpg| as the response and \verb|horsepower| as the predictor. Use the
\verb|summary()| function to print the results. Comment on the output.
For example:
\begin{enumerate}
\item[i.] Is there a relationship between the predictor and the response?
\item[ii.] How strong is the relationship between the predictor and
the response?
\item[iii.] Is the relationship between the predictor and the response
positive or negative?
\item[iv.] What is the predicted mpg associated with a horsepower of
98? What are the associated 95\% confidence and prediction
intervals?
\end{enumerate}

```{r}
data(Auto)
str(Auto) ## get a quick "look" at the data...

lm.0 <- lm(mpg ~ horsepower,data=Auto)

summary(lm.0)
```

\em

The estimated coefficient on \verb|horsepower|, $\hat\beta_1$, is highly significantly different from zero ($p$-value $<$ $2\times10^{-16}$ is very small!!), and the $R^2$ value is moderately high, $R^2 = 0.6059$, so there appears to be a moderately strong relationship between the variables.  Since $\hat\beta_1=-0.157845<0$, the relationship is negative, i.e. \verb|mpg| appears to decrease as \verb|horsepower| increases.

Using the code
```{r}
new.data <- data.frame(mpg=0,horsepower=98)

predict(lm.0,newdata=new.data,interval="confidence")

predict(lm.0,newdata=new.data,interval="prediction")
```
we see that when $\verb|horsepower|=98$,
\begin{itemize}
\item The fitted \verb|mpg|, $\hat y$, is 24.46708
\item The 95\% CI is $(23.97308, 24.96108)$
\item The 95\% PI is $(14.8094, 34.12476)$
\end{itemize}

\rm

## 1(b)

Plot the response and the predictor. Use the \verb|abline()| function
to display the least squares regression line.

\em

```{r}
plot(mpg ~ horsepower,data=Auto)
abline(lm.0)
```

Note that you can get a "prettier" plot with ggplot\ldots

```{r}
ggplot(data=Auto,aes(x=horsepower,y=mpg)) +
  geom_point() +
  geom_smooth(method='lm')
```
\begin{quote}
(The shaded region around the regression line in the ggplot version is made by computing the 95\% confidence interval for \verb|mpg|, $\hat y$, for every \verb|horsepower|, $x$, in the figure.  If you don't want that in the figure, you can specify \verb|se=FALSE| as another argument to the \verb|geom_smooth| function.)
\end{quote}

It is always good to look at the data and compare it to the fitted model somehow.  In this case, the plots confirm that there is a reasonably strong negative relationship between \verb|horsepower| and \verb|mpg|, but it does not in fact appear to be a linear relationship. 

\rm


## 1(c)

Use the \verb|plot()| function to produce diagnostic plots of the least
squares regression fit. Comment on any problems you see with
the fit.

\em

```{r}
par(mfrow=c(2,2))

plot(lm.0)
```

\begin{itemize}
\item
In the Residual vs. Fitted plot we see that the data cloud of residuals is curved, reflecting the curvature in the raw data in the plot we made before.  We also see some fanning as $\hat y$ increases, suggesting perhaps that the error variance is not constant across all observations.
\item
The normal qq plot looks reasonably good, but we might like to see a blown-up version of it to investigate possible outliers (obs 334 looks like an outlier in the residual vs. fitted plot for example).
\item
The scale-location plot is exhibiting some of the same curvature as the residual vs. fitted plot, and the nonparametric smooth (the red like) suggests perhaps some nonconstant variance.  That's not unusual: if the functional form is wrong, it sometimes manifests itself as non-constant variance (since one part of the true nonlinear relationship may be better fitted with a straight line than some other part).
\item The Residuals vs. Leverage plot does not show any particularly bad points.  Although there are some data point in the NE corner of the plot, the residual is still modest so the leverage doesn't come much into play.  No data points have Cook's Distance above 0.5 (in fact, the level curve for Cook's distance = 0.50 is outside the plotting range of the graph).
\end{itemize}
\rm

# Problem 2. ISLR second Ed. p. 123--124, \#9.  


## 2(a)

Produce a scatterplot matrix which includes all of the variables
in the data set.

\em

```{r}

## Note that I should remove the column "name" before making the scatterplot matrix,
## because it is not a numeric variable.

library(GGally)
ggpairs(Auto[,-grep("name",names(Auto))])

## you can also make a simpler plot with 
##
##    pairs(Auto)
##
```
Note that this plot also gives us a nonparametric marginal density estimate (i.e. a smooth histogram) for each variable, the correlations between the variables, and a crude set of p-values for the test of whether each correlation is significantly different from zero.

\rm

## 2(b)

Compute the matrix of correlations between the variables using
the function \verb|cor()|. You will need to exclude the name variable, \verb|cor()|
which is qualitative.

\em

The correlations are already calculated above, but let's do it again with the \verb|cor()| function.

```{r}
options(width=999)
round(cor(Auto[,-grep("name",names(Auto))]),2)

```


\rm



## 2(c)

Use the \verb|lm()| function to perform a multiple linear regression
with \verb|mpg| as the response and all other variables except name as
the predictors. Use the \verb|summary()| function to print the results.
Comment on the output. For instance:
\begin{enumerate}
\item[i.] Is there a relationship between the predictors and the response?
\item[ii.] Which predictors appear to have a statistically significant
relationship to the response?
\item[iii.] What does the coefficient for the year variable suggest?
\end{enumerate}
\em

```{r}
Nameless_Auto <- Auto[,-grep("name",names(Auto))]

lm.1 <- lm(mpg ~ . , data=Nameless_Auto)
## Note the use of "." to stand for "all the variables in the data frame 
## except for the y-variable (mpg, in this case)"...

summary(lm.1)
```

There appears to be a relationship between the predictors and the response, \verb|mpg|: 4 of the 7 predictors have coefficients that appear to be significantly different from zero, and the $R^2$ is a more respectable 0.8215.  

The four predictors with an apparently statistically significant relationship with the response are:
\begin{itemize}
\item \verb|displacement|
\item \verb|weight|
\item \verb|year|
\item \verb|origin|
\end{itemize}

The coefficient estimate 0.750773 for \verb|year| is significantly different from zero, so it makes sense to try to interpret it:

The value 0.750773 suggests that the average miles per gallon (\verb|mpg|) for cars has been going up by about 3/4 mile per gallon per year, over the years covered by this data set.

\rm


## 2(d)

Use the \verb|plot()| function to produce diagnostic plots of the linear
regression fit. Comment on any problems you see with the fit.
Do the residual plots suggest any unusually large outliers? Does
the leverage plot identify any observations with unusually high
leverage?

\em

```{r}
par(mfrow=c(2,2))

plot(lm.1)

```

\begin{itemize}
\item
The Residual vs. Fitted plot shows that the data cloud of residuals is still curved, suggesting that there is some nonlinearity that simply adding more different variables to the regression did not fix.  There is still some fanning out of the data as $\hat y$ increases, suggesting non-constant error variance.  At least obs. \#334 no longer looks like an outlier.

\item
The normal qq plot looks reasonably good, much as it did before.  There's some suggestion thsat the upper tail might be a bit long, but nothing really concerning.
\item
The scale-location plot still has some curvature in it, again suggesting some nonlinearity that we haven't fixed in our model, but the nonparametric smooth is fairly flat now, so we might not worry too much about the fanning we saw in the residuals vs. fitted plot.
\item The Residuals vs. Leverage plot looks fairly good.  There is one data point \#14, with relatively high leverage, but a very modest residual so it probably is not affecting the fitted regression function very much.  Although one of the level curves for Cook's Distance = 0.50 appears in the plot, there are no points with Cook's Distance above 0.5.
\end{itemize}

\rm

## 2(e)

Use the \verb|*| and \verb|:| symbols to fit linear regression models with
interaction effects. Do any interactions appear to be statistically
significant?

\em
We will learn about / review variable selection methods soon, but for now it suffices to fit a bunch of interactions and see which ones have significant $t$-statistics.  Here are a few useful things to know about the notation, before we begin fitting things:
\begin{itemize}

\item We put the {\em two-way interaction}, or product, x1$\times$x2 in the model with the model notation \verb|x1:x2|

\item We almost always want to include all lower-order terms with an interaction (this is called the "\ul{hierarchy principle}"), so it is better to say \verb|x1*x2|, which expands to \verb|1 + x1 + x2 + x1:x2|

\item If we try this with three variables, we get a {\em three-way interaction,} with all lower order terms: \verb|x1*x2*x3| expands to \verb|1 + x1 + x2 + x3 + x1:x2 + x1:x3 + x2:x3 + x1:x2:x3|.

\item The notation \verb|(x1+x2+x3)^3| is equivalent to \verb|x1*x2*x3|.  The notation \verb|(x1+x2+x3)^2| is equivalent to \verb|x1*x2 + x1*x3 + x2*x3|, which is in turn equivalent to \verb|1 + x1 + x2 + x3 + x1:x2 + x1:x3 + x2:x3| (i.e., all the two-way interactions, along with the corresponding lower-order terms.)

\item Recall that \verb|.| represents the additive model with all variables in the data frame except for the $y$-variable.  Hence \verb|.^2| is the model with all 2-way interactions (and all lower order terms), \verb|.^3| is the model with all 3-way interactions (and all lower order terms), and similarly with \verb|.^4|, \verb|.^5|, etc.

\item It is rare to see 4-way interactions in real data, and 3-way interactions are fairly uncommon.  Often, it suffices to look at main effects and 2-way interactions.

\end{itemize}

Let's fit
```{r}
lm.2 <- lm(mpg ~ .^2, data=Nameless_Auto)

lm.3 <- lm(mpg ~ .^3, data=Nameless_Auto)
```

From the summary for \verb|lm.2|
```{r}
summary(lm.2)
```
we see (ignoring predictors that are only significant at the 0.10 level):

\begin{itemize}

\item \verb|displacement|, \verb|accelleration| and \verb|origin| are all significant main effects.

\item \verb|displacement:year|, \verb|accelleration:year| and \verb|accelleration:origin| are all significant 2-way interactions.

\end{itemize}
So initially the model we would think of would be
\begin{verbatim}
mpg ~ displacement + accelleration + origin + displacement:year + accelleration:year +
         accelleration:origin
\end{verbatim}
but, following the "hierarchy principle" that any interaction should bring with it all of its lower-order interactions, we should really be looking at 
\begin{verbatim}
mpg ~ displacement + accelleration + origin + year + displacement:year + 
         accelleration:year + accelleration:origin
\end{verbatim}
or, more succinctly,
\begin{verbatim}
mpg ~ displacement*year + accelleration*year + accelleration*origin              (1)
\end{verbatim}

From the summary for \verb|lm.3|
```{r}
summary(lm.3)
```
we see

\begin{itemize}

\item No significant main effects

\item \verb|displacement:horsepower|, \verb|horsepower:accelleration|, \verb|horsepower:year|, \verb|weight:origin|, and \verb|accelleration:origin| are significant two-way interactions

\item \verb|cylinder:horsepower:weight|, \verb|displacement:horsepower:year|, \verb|horsepower:accelleration:year|, \verb|horsepower:accelleration:origin|, and \verb|weight:year:origin| are all significant three-way interactions.

\end{itemize}
which we could write (using \verb|*| to make sure we are following the "hierarchy principle") as
\begin{verbatim}
mpg ~ cylinder*horsepower*weight + displacement*horsepower*year + 
         horsepower*accelleration*year + horsepower*accelleration*origin + 
         weight*year*origin                                                      (2)
\end{verbatim}
Note that all the two-way interactions listed above (and a few more) are included in this model, and all the main effects \verb|cylinder|, \verb|horsepower|, \verb|weight|, \verb|displacement|, \verb|year|, and \verb|accelleration| are also included in the model (even though they weren't by themselves significant). 

Just for kicks, I also looked at 
```{r eval=FALSE}
summary(lm(mpg ~ .^4, data=Nameless_Auto))
```
and it turns out that none of the 4-way interactions appear to be significant, so we will not pursue this, or any higher-order models, any further.

Note that models (1) and (2) are rather different.  This is in part because interactions share some variability with their lower order terms, and the $t$-statistics measure the importance of a variable or interaction \ul{\em after} all other variables and interactions have been included in the model.  If the $t$-statistic is for a variable that has similar variability to something that is already in the model, then the $t$-statistic will undervalue its variable.

In general, $t$-statistics are good for an initial quick skim of the variables in a model, but they do not say anything about overall fit, predictive power, etc., of the model.

\rm

## 2(f)

Try a few different transformations of the variables, such as
\verb|log(X)|, \verb|sqrt(X)|, \verb|X^2|, etc. Comment on your findings.

\em

We haven't talked about a principled way to proceed with this in class yet (though you may remember some principled approaches from your earlier work with regression models!).  For now we will just try to build a little on the little bit of EDA we did in problem 2(a).

I will try two different ideas to guide transformations here:
\begin{itemize}

\item Remove asymmetry (skewing) in all variables that exhibit it, and see if that improves the casewise diagnostic plots.

\item Leave the $y$ variable, \verb|mpg|, alone, and try to transform some of the $X$ variables so that the distribution of $\hat y$ more closely follows the distribution of $y$.

\end{itemize}

Here's the first idea in action:

Scanning the density plots from problem 2(a), it looks like \verb|mpg|, \verb|displacement|, \verb|horsepower| and \verb|weight| are the continuous variables with least symmetric distributions, and all of them are right skewed. (The other variables are either not very skewed, or are discrete and so transformations are not appropriate.) We'll quickly try \verb|log()| and \verb|sqrt()| on each of them to see what improves their distributions more...

```{r}
ggpairs(sqrt(Nameless_Auto[,c("mpg","displacement","horsepower","weight")]))

ggpairs(log(Nameless_Auto[,c("mpg","displacement","horsepower","weight")]))

## it looks like sqrt() works well for mpg, and log() works reasonably well 
## for displacement, horsepower and weight.

## it is possible to be fussier about the transformations, but then you have to 
## figure out how to explain a very fussy transformation to your co-worker or
## client.

data_p1 <- Nameless_Auto

data_p1 <-data_p1[,-grep("mpg",names(data_p1))]
data_p1$sqrt_mpg <- sqrt(Nameless_Auto$mpg)

data_p1 <-data_p1[,-grep("displacement",names(data_p1))]
data_p1$log_displacement <- log(Nameless_Auto$displacement)

data_p1 <-data_p1[,-grep("horsepower",names(data_p1))]
data_p1$log_horsepower <- log(Nameless_Auto$horsepower)

data_p1 <-data_p1[,-grep("weight",names(data_p1))]
data_p1$log_weight <- log(Nameless_Auto$weight)

lm.p1.1 <- lm(sqrt_mpg ~ ., data=data_p1)
par(mfrow=c(2,2))
plot(lm.p1.1)

lm.p1.2 <- lm(sqrt_mpg ~ .^2, data=data_p1)
par(mfrow=c(2,2))
plot(lm.p1.2)

lm.p1.3 <- lm(sqrt_mpg ~ .^3, data=data_p1)
par(mfrow=c(2,2))
plot(lm.p1.3)
```
There's not a lot to distinguish these residual plots, and so I will invoke the "principle of parsimony" and just choose to examine the first model more closely (although there are indeed slight improvments in the residuals for the other models, perhaps especially the third one).  

From the summary
```{r}
summary(lm.p1.1)
```
we see that all of the predictors except for \verb|cylinder| and \verb|year| and \verb|log_displacement| are significant.  The model we would end up with, then, is
\begin{verbatim}
sqrt_mpg ~ accelleration + year + origin + log_horsepower + log_weight           (3)
\end{verbatim}

Here's the second idea in action:

\begin{itemize}

\item Looking back at the scatter plots in problem 2(a), it looks like \verb|mpg| has the most nonlinear relationships with \verb|displacement|, \verb|horsepower|, and \verb|weight|.

\item Since \verb|sqrt(mpg)| worked well before, I'm guessing that when we leave \verb|mpg| alone, we should square the predictors.  

\item A variation of the "hierarchy priniple" says that when you include a power of a predictor in a model you should include all lower-order powers as well.  

\end{itemize}
Here's an initial model that implements these ideas:
```{r}
data_p2 <- Nameless_Auto
data_p2$displacement2 <- (data_p2$displacement)^2
data_p2$horsepower2 <- (data_p2$horsepower)^2
data_p2$weight2 <- (data_p2$weight)^2

lm.p2.1 <- lm(mpg ~ ., data=data_p2)
par(mfrow=c(2,2))
plot(lm.p2.1)
```
These residual plots look about the same to me as the plots for \verb|lm.p1.1|, so let's see what predictors look significant here:
```{r}
summary(lm.p2.1)
```
The significant predictors here are \verb|horsepower|, \verb|weight|, \verb|year|, \verb|origin|, \verb|horsepower2| and \verb|weight2|, so the model we would get is
\begin{verbatim}
mpg ~ horsepower + weight + year + origin + horsepower2 + weight2                (4)
\end{verbatim}

\noindent
\bf Aside:\rm

The models (1), (2), (3) and (4) seem really different.  How could we choose between them? There are basically three perspectives on model choice:

\begin{description}

\item[Fit/Validity.]  Sheather's textbook is dominated by this perspective.  The two main questions are: Does the model fit the data, and can we verify that the assumption of the model actually hold?

\item[Predictive Accuracy.] The ISLR book is dominated by this perspective.  The main question is, regardless of how well the model fits or how valid the assumptions are, does the model provide a good "machine" for predicting future observations?  This is where issues like the bias-variance tradeoff for mean-squared prediction error come into play.

\item[Scientific/Policy Usefulness.] The Gelman-Hill book is dominated by this perspective.  Does the model agree with or improve on existing theory for how the data is generated?  Is it useful for making new scientific inferences and/or new social policy decisions, etc.? 

\end{description}
Notice that I say each book is "dominated" by a particular perspective.  No good statistician only approaches modeling and inference from just one perspective, and neither do these books.  You can find some of each perspective in all three books, and you will find it useful to approach your work from combinations of these perspectives as well.  But each book tends to emphasize one perspective over the others, as I have indicated above.
\rm


# Problem 3.


## Problem 3(a)

The \texttt{kidiq.csv} file is in the same directory as this assigment.   Read it into a data frame in R with a command like \verb|kidiq <- read.csv("kidiq.csv",header=TRUE)|.  Use the \texttt{cbind()} command to create:
\begin{itemize}
\item \texttt{y} $=$ a column vector (matrix with one column), from the column \texttt{kid.score} in \texttt{kidiq}.
\item \texttt{X} $=$ a matrix with (a) the first column containing all 1's; (b) the second column containing the column \texttt{mom.hs} from \texttt{kidiq}; and (c) the third colummn containing the column \texttt{mom.iq} from \texttt{kidiq}.
\end{itemize}
Use \texttt{dim()} to verify that \texttt{y} is $434\times1$, and \texttt{X} is $434\times3$.  Use the \texttt{head()} command to print out the first few rows of \texttt{y} and \texttt{X}, and turn the results of the \texttt{dim()} and \texttt{head()} commands in.


```{r}
kidiq <- read.csv("kidiq.csv",header=TRUE)
str(kidiq)

y <- cbind(kidiq$kid.score)
X <- cbind(1, with(kidiq, cbind(mom.hs,mom.iq)))

dim(y)
dim(X)

head(y)
head(X)
```


## Problem 3(b)

Compute $V = (X^TX)^{-1}$ in R, and show the result (V should be a $3\times3$ matrix; why?).

```{r}
V <- solve(t(X) %*% X)
print(V)
```

\em

\verb|X| is $434\times3$, so \verb|t(X)| is $3\times 434$. Therefore \tt t(X)\%*\%X \rm\em multiplies a $3\times434$ matrix with a $434\times3$ matrix; the inner dimensions cancel and the result has the outer dimensions, $3\times3$.  Finally the inverse of a square matrix has the same dimensions as the original matrix, $3\times3$ in this case.

\rm

## Problem 3(c)

Compute $\hat\beta = (X^TX)^{-1}X^Ty$ in R, and show the result.\label{beta-hats}

```{r}
beta.hat <- V %*% t(X) %*% y
print(beta.hat)
```

## Problem 3(d)

Calculate the residual vector $y- X\hat\beta$ in R, and use the result to compute the residual variance $s^2$ (don't forget to divide by $n-k$; what are $n$ and $k$ here?).  Show the resulting $s^2$.

```{r}
n <- dim(X)[1]
k <- dim(X)[2]
res.var <- t(y - X%*%beta.hat) %*% (y - X%*%beta.hat) / (n-k) 
print(res.var)  
## this is s^2
```

## Problem 3(e)

Calculate the matrix $\Var(\hat\beta) = (X^TX)^{-1} s^2$ in R, and extract the square roots of the diagonal elements of this matrix.  These are the standard errors $SE(\hat\beta_0)$, $SE(\hat\beta_1)$, and $SE(\hat\beta_2)$. \label{SEs}

```{r}
var.beta <- V * c(res.var)
beta0.sd <- sqrt(var.beta[1,1])
beta1.sd <- sqrt(var.beta[2,2])
beta2.sd <- sqrt(var.beta[3,3])

cbind(beta.hat, c(beta0.sd, beta1.sd, beta2.sd))

res.sd <- sqrt(res.var)
print(res.sd)
## This is s, the residual SE.
```


## Problem 3(f)

Compare your values for $\hat\beta_0$, $\hat\beta_1$, $\hat\beta_2$ (from part \ref{beta-hats}), and their standard errors (from part \ref{SEs}) with the result of running 
\begin{verbatim}
summary(lm(kid.score ~ mom.hs + mom.iq, data=kidiq))
\end{verbatim}
Comment on any similarities or differences.  

```{r}
summary(lm(kid.score ~ mom.hs + mom.iq, data=kidiq))
```

\em

The estimated $\hat\beta$'s, $SE(\hat\beta)$'s, and $s$, are identical with the results of the raw matrix calculations, to as many displayed decimal places as they have in common.

\rm

# Problem 4. 

In the folder for this hw assignment you will find a pdf called "An IMRAD paper on wine", based on Example 1.2.4 in Sheather.  This paper is based only on EDA, not on any more sophisticated methods.

## Problem 4(a)

Read the slides "IMRAD: What goes into each section", a pdf of which is in the same folder as this assignment.  (There is nothing to turn in for this part).

## Problem 4(b)

Does the paper appropriately address each of the parts of an IMRAD paper as described the "IMRAD: What goes into each section" pdf?  

For each section below, either say "yes this section has the right content", or say "no" and describe what is missing and/or what needs to be moved to another section of the paper or deleted.
\begin{itemize}
\item Abstract
\item Introduction
\item Methods
\item Results
\item Discussion
\end{itemize}
Later we will see (and write) more complex versions of IMRAD and IDMRAD papers; this is just a first taste!

\em

\renewcommand{\labelitemii}{$\circ$}

Here are some possible "good" answers.  Your answers may be a bit different, but as long as they are thoughtful and take into account some of the important features of each section of an IMRAD paper (as described in the slides I asked you to read), you should be fine.

\begin{itemize}
\item Abstract \\
{\rm 
{\bf Yes, this section has the right content.} 

\em The slides on IMRAD don't discuss Abstracts, but a good rule of thumb is that the abstract should have about as many sentences as there are main sections in the paper; each sentence gives the ``highlight'' for the corresponding section of the paper.  In this case, the first sentence summarizes the intrduction; the second and third sentences summarize the methods section; Sentences 4-7 summarize the results; and sentence 8 summarizes the discussion.  (It is a little awkward because the answer to the main question of the paper, that Parker's ratings have a bigger impact than Coates', comes in the middle of the abstract instead of toward the end where the summary of the discussion is, but otherwise it seems fine.)
}
\item Introduction \\
{\rm 
{\bf Yes, it mostly does a good job.} \em  

\begin{itemize}
\item $+$ Provides a rationale and aim for the study (``determine whether Parker or Coates has a grweater effect on wine prices'')
\item $+$ Supplies sufficient background (pretty much the whole first paragraph)
\item $-$ Doesn't do much lit review (What would previous literature be like, for this article?  Would it be about wine?  Would it be about the reliability and accuracy of wine critics?  Would it be on what makes a critic or ``influencer'' believable?)
\item $+$ Brief, clear to the point, and in present tense
\item Doesn't address some of the ``optional'' items, like study design, main results, etc.
\end{itemize}
}
\item Methods \\
{\rm 
{\bf Yes, this is not too bad, and is fairly typical of the methods section of a ``data analysis'' paper.}

\begin{itemize}

\item $+$ It adequately addresses ``Who? What? When? Where? How? Why?''.

\item $+$ It says where the data came from.

\item $-$ It does not describe study design (how each wine was selected for the study, how it was extracted from Parker's and Coates' publications, etc.).

\item $+$ It does describe all the variables in the study, and therefore also describes how the effect (Parker vs Coates) was measured.

\item $+$ It describes the data analysis method (pure EDA in this case)!

\item $-$ It would probably be better if the graphs themselves appeared in the Results section, since the Methods section should not contain any Results or Discussion material.

\item For this paper there do not appear to be any ethical considerations to discuss, but for other papers there would be, such as ethical aspects of data collection \& study design, confidentiality of individuals' data, etc.

\end{itemize}
}
\item Results \\
{\rm 
{\bf Yes this section has the right content, for such a short simple paper.} \em 

Because the methods are so simple and the EDA was already shown in the Methods section (it really didn't belong there, it should have been here in the Methods section), so what we have here is a description of how the EDA was used to get results for each research question, and the reasoning behind each of the results.

There is one paragraph for each research question announced in the Introduction (in a paper with more involved analyses, there might be one subsection for each research question, rather than just one paragraph, with corresponding subsections back in the Methods section).  The paragraphs summarize the analyses and give appropriate conclusions (in a paper with more involved analyses, e.g. regression analysis etc., there might also be tables listing coefficient estimates \& standard errors, graphs showing predicted values, etc.).

}
\item Discussion \\
{\rm 
{\bf Not quite the right content.}  

\em The first paragraph should summarize the main results of the paper.  The first paragraph here is a mixture of new results (should be in the results section!) and study limitations (should come later in the discussion!).  The first sentence of the last paragraph would be better as the first sentence of the Discussion.  The remaining text describes further limitations and other considerations, which is fine.  
}
\end{itemize}





\rm



