# Calculate R-squared in multiple regression

Let's begin by listing all of the variables.

Response: The amount of time spent in the hospital

Explanatory: age, cholesterol level, blood pressure, and the hospital you are in.

Note that one patient cannot be in two hospitals at once, so there is no interaction term between hospitals.

Your regression equation should be in the form of

time = b0 + b1*age + b2*cholesterol + b3*blood pressure + b4*I(regional) + b5*I(general) + b6*I(charity) + e, where e is the noise.

Here we need 3 dummy variables, I(regional), I(general) and I(charity). If the patient is in either of these hospitals, then that particular dummy variables takes the value 1, and all others take the value 0. If the patient is in the city hospital, then all dummy variables take the value 0 (i.e. the base case).

the coefficients b4 to b6 tells you the differences between those hospitals and the the city hospital. For example, if b4 = -5, then it tells you that all else equal, a patient in the regional memorial hospital will spend 5 units time less than if she went to the city hospital. These coefficients ONLY tell you the differences (w.r.t. the base hospital); they suggest nothing about absolute times.

#### Solution Preview

Please see the attachment.

Let's begin by listing all of the variables.

Response: The amount of time spent in the hospital

Explanatory: age, cholesterol level, blood pressure, and the hospital you are in.

Note that one patient cannot be in two hospitals at once, so there is no interaction term between hospitals.

Your regression equation should be in the form of

time = b0 + ...

#### Solution Summary

The expert calculates the r-squared in multiple regression.