title: object of type 'closure' is not subsettable
body: <p>I am trying to compile this code that is running, but not compiling.</p>
  <pre><code>Error Message: Quitting from lines 40-42 (midterm.Rmd) 
  Error in data$Y_i1 : object of type 'closure' is not subsettable
  Calls: &lt;Anonymous&gt; ... withCallingHandlers -&gt; withVisible -&gt; eval -&gt; eval -&gt; mean
  Execution halted
  </code></pre>
  <p><strong>CODE</strong></p>
  <pre><code>**c) Using the dataset “potential_outcomes.Rda&quot; from Problem Set 1 (also loaded with this exam on bCourses), calculate the ATE and SE($\hat{ATE}$) using R. For the latter, assume that half of the units will be assigned to the treatment group in the experiment. Is the ATE a parameter or an estimator? How about SE($\hat{ATE}$)?**
  
  ```{r}
  ATE &lt;- mean(data$Y_i1) - mean(data$Y_i0)
  ATE ## Average Treatment Effect
  ```
  
  ```{r}
  N1 &lt;- length(data$Y_i1)
  N0 &lt;- length(data$Y_i0)
  N &lt;- 23 # Half of observations
  var1 &lt;- var(data$Y_i1)
  var0 &lt;- var(data$Y_i0)
  var1N &lt;- var1/N
  var0N &lt;- var0/N
  SEATE &lt;- sqrt(var1N + var0N)
  SEATE ## The Standard Error of the ATE
  ```
  
  The ATE is a parameter because it describes the box. There is no estimation required. The SE of the ATE on the other hand, approximates the true standard error for the difference in means. 
  </code></pre>