Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

title: POL 2504--Effects of Educational Television author: output: html_document --- In this exercise we're going to look at the effect of a educational television

title: "POL 2504--Effects of Educational Television" author: "" output: html_document ---

In this exercise we're going to look at the effect of a educational television program [The Electric Company](https://en.wikipedia.org/wiki/The_Electric_Company) that ran from 1971-77 on children's reading scores. We will investigate what reading gains, if any, were made by the 1st through 4th grade classes as part of a randomized experiment.

This exercise is based on:

> Joan G. Cooney (1976) [The Electric Company: Television and Reading, 1971-1980: A Mid-Experiment Appraisal](https://files.eric.ed.gov/fulltext/ED130635.pdf). Children's Television Network Report. The data comes from a two location trial in which treatment was randomized at the level of school classes.^[Classes were paired, but we will ignore that in the analysis] Each class was either treated (to watch the program) or control (to not watch the program). The outcome of interest is the score on a reading test administered at the end of each year called `post.score`. Note that these are distinct classes from all four years. The variables are:

------------------------------------------------------------------------------- Name Description -------------------- --------------------------------------------------------- `pair` The index of the treated and control pair (ignored here). `city` The city: Fresno ("F") or Youngstown ("Y") `grade` Grade (1 through 4) `supp` Whether the program replaced ("R") or supplemented ("S") a reading activity

`treatment` "T" if the class was treated, "C" otherwise (randomized) `pre.score` Class reading score *before* treatment, at the beginning of the school year `post.score` Class reading score at the end of the school year -------------------------------------------------------------------------------

## Question 0

Go to the `title` field at the beginning of this document and put in your name. Save this document under the name `yourname_hw1.Rmd`.

## Question 1

Read the data into an data frame named `electric`. What sort of variable has R assumed `grade` is? How will it be treated in a linear model if we use it as an independent variable? Under what circumstances would that be reasonable or unreasonable?

Make a new variable from `grade` that is a factor. How will a linear model treat this new variable? **Hint:** You may find that `summary` illuminates the new data set.

Finally, overwrite the existing treatment variable so that it is numerical: 1 when the class is treated and 0 when not.

## Question 2

Let's now consider the effect of treatment. First, fit a linear model that predict `post.score` with just treatment. Then fit a model uses your factor version of `grade` as well as treatment.

Summarise both models in terms of how much of the variance in `post.score` they "explain" and the median size of their errors.

Now, consider each model's treatment coefficient. Are the estimates of this coefficient *different* in the two models? Why do you think that is?

## Question 3 Now make another model that uses the factor version of `grade` and `pre.score` (the reading score before the year begins) to predict `post.score`. Is this model better? If so, in what ways?

## Question 4 Now let's consider the effect of treatment *within* each grade. We can use the `lm` function's `subset` argument to fit the model on just a subset of all the rows in the data set. For example, we can fit a model of the relationship of `post.score` to `treatment` and `pre.score` just in grade 2 like this:

``` mod <- lm(post.score ~ treatment + pre.score, data = electric, subset = grade == 2) ```

Fit a linear model predicting `post.score` using treatment and `pre.score` for each grade. Briefly comment on the result. There are now *four* treatment effects. How do they differ as grade increases?

## Bonus Question.

*Do this question if you want to challenge your coding skills. Your answer will not contribute to your grade (this is an opportunity for you to practice loops and functions), but you will still receive comments if you complete this question.*

Write a loop that will iteratively fit a regression for each grade. Follow these steps:

1. Define a function named `fit_reg` that returns the coefficient on treatment. The function should have two arguments: the entire data (`data_all`) and the grade (`grade_subset`). 2. Use a `for loop` and call the `fit_reg()` function for each grade (`1` to `4`). Store what the `fit_reg()` function returns in a variable. 3. Print out the coefficient on treatment using the `print()` function.

## Question 5

Knit the RMarkdown file (press the "Knit" button above) and read through the corresponding html file.

For the submission: submit your solution in an html file and (just for insurance) submit the corresponding R Markdown file with it.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Algebra And Trigonometry (Subscription)

Authors: Michael Sullivan

9th Edition

0321830741, 9780321830746

More Books

Students also viewed these Mathematics questions

Question

What is a process and process table?

Answered: 1 week ago

Question

What is Industrial Economics and Theory of Firm?

Answered: 1 week ago

Question

What is the meaning and definition of E-Business?

Answered: 1 week ago

Question

1. Effort is important.

Answered: 1 week ago