# How to write fitted model using data from R?

I don't know how to write a fitted model. What I did was: Y hat = (1.222 * e^1) + (3.938 * e^-4 * sqft_living)

This is for the fitted model for waterfront = 0 group. However, I don't know how to do it for waterfront = 1 group? Can someone please give me some advice on this?

• Hello Mary, you look really close to your goal. Is your problem in interpreting the sqft_living:waterfront interaction term? – Roland Jul 26 at 9:40

Assuming that sqft_living is a numerical variable then we have

For waterfront = 0 then

Y <- 12.22 + 0.0003938*sqft_living


For waterfront = 1 then

Y <- 12.22 + 0.000393*sqft_living + 0.7814 + 0.00004796*sqft_living


The main effect for sqft_living can be interpreted as the increase in the outcome (ie the slope) associated with a 1 unit increase in sqft_living when waterfront is zero.

The main effect for waterfront can be interpreted as the difference in the intercepts (the value of the outcome when sqft_living is zero) between the two groups

The interaction can be interpreted as the difference in slope between the 2 groups.

It might be a good idea to centre the sqft_living variable if a zero value for sqft_living is not meaningful , and possibly rescale it (so that the estimate is not too small)