# Solved – Getting the equation from R’s lm when using a product

Similar to this question: How to translate the results from lm() to an equation? in which the top voted answer said how to get the form of an equation from `lm(y ~ x)` and equivalently for `lm(z ~ y + x)` and other sums, I'm wondering: how can the equation be obtained from the form of `lm(z ~ y*x)`?

I have:

``> summary(lm(log(z) ~ x*y))  Call: lm(formula = log(z) ~ x * y)  Residuals:       Min        1Q    Median        3Q       Max  -0.181142 -0.073755  0.000481  0.082088  0.200902   Coefficients:              Estimate Std. Error  t value Pr(>|t|)     (Intercept)  -9.85368    0.09304 -105.906  < 2e-16 *** x           -97.41166    6.28269  -15.505  < 2e-16 *** y            -2.26398    0.14243  -15.895  < 2e-16 *** x:y          91.69016    9.77390    9.381 6.95e-14 *** ``

It returns 4 coefficients — `(Intercept)`, `x`, `y`, and `x:y` — but I'm not sure how to put them together to get the final equation.

Is it simply that `x:y` term multiplied by `x*y` plus the intercept? That is, in this case \$log z = 91.69 xy -9.853\$?

Contents

The equation is \$widehat{log z} = -9.853 -97.41166x -2.26398y + 91.69xy\$ where \$widehat{log z}\$ is the estimated value of \$log z\$.

Rate this post