# Basic Interactions of Continuous Variables

The basic model considered is

pizza = ві + в2аде + вз income + e (5.14)

It is proposed that as a person grows older, his or her marginal propensity to spend on pizza declines-this implies that the coefficient в3 depends on a person’s age.

вз = в4 + вьаде (5.15)

Substituting this into the model produces

pizza = в1 + в2аде + в3іпсоте + e4(income x аде) + e (5.16)

This introduces a new variable, income x аде, which is an interaction variable. The marginal effect of unit increase in аде in this model depends on тсоте and the marginal effect of an increase in тсоте depends on аде.

The interaction could be created in gretl using the genr or series command. The data for the following example are found in the pizza4■gdt dataset.  2 

Model 1: OLS, using observations 1-40
Dependent variable: pizza    Sum squared resid R2

F(3, 36) Log-likelihood Schwarz criterion

The marginal effect of age on pizza expenditure can be found by taking the partial derivative of the regression function with respect to age  dE (pizza)

= p2 + PAincome age

Comparing the marginal effect of another year on average expenditures for two individuals, one with \$25,000 in income

= b2 + b4 x 25 = -2.977 + (-0.1232)25 = -6.06. (5.18)

To carry this out in a script with income at \$25,000 and \$90,000

1 open "@gretldirdatapoepizza4.gdt"

2 series inc_age=income*age

3 ols pizza const age income inc_age

4 scalar me1 = \$coeff(age)+\$coeff(inc_age)*25

5 scalar me2 = \$coeff(age)+\$coeff(inc_age)*90

6 printf "nThe marginal effect of age for one

7 with \$25,000/year income is %.2f.n",me1

8 printf "nThe marginal effect of age for one

9 with \$90,000/year income is %.2f.n",me2

This yields:

The marginal effect of age for one with \$25,000/year income is -6.06. The marginal effect of age for one with \$90,000/year income is -14.07.