# Optimal Advertising: Nonlinear Combinations of Parameters

The optimal level of advertising, adverto, is defined in this example to be the amount that maximizes net sales. Andy will advertise up to the point where another dollar of expenditure adds at least one dollar of additional sales-and no more. At this point the marginal effect is equal to one,

e3 + 2^4 adverto = 1 (5.8)   Solving advert in terms of the parameters

which is nonlinear in the parameters of the model. A consistent estimate of the optimal level of advertising can be obtained by substituting the least squares estimates for the parameters on the right-hand side. Estimating the standard error via the Delta method requires some calculus, but it is quite straightforward to do in gretl.

The Delta method is based on a first-order Taylor’s series expansion of a function that involves the parameters of the model. It relies on the asymptotic normality of the estimator you are using. Let в be a 2 x 1 vector of parameters; an intercept and slope. Consider a possibly nonlinear function of a parameters g(@). Also, let’s say that we estimate a set of parameters в using an estimator called b and that b ~ N (в, V). So far, we’ve described the least squares estimator of the simple regression. Then, by the Delta theorem, the nonlinear function evaluated at the estimates has the following approximate distribution:

g(b) H N(g(e),G(e)VG(e)T) (5.10)

where G(e) = дд(в)/двТ. In order to use the Delta Method, you have to take the partial deriva­tives of the function, which in our example is a hypothesis, with respect to each parameter in the model. That is, you need the Jacobian.

 1 -2в4 1 – вз2в4   In the example, g(@) = 1 — вз/2^4• Taking the derivatives with respect to each of the parame­ters, ві, в2, в3, and в4 yields:    Note that the derivatives with respect to в1 and в2 are 0. To use the Delta method, simply replace the unknown parameters in equation (5.9) with least squares estimates. Then to get the estimated standard error of A, substituted estimates into the derivatives d3 and d4, and compute

This looks harder to do than it actually is. The gretl script to compute the variance and standard error is:

1 ols sales const price advert a2 —vcv

2 matrix b = \$coeff

3 matrix cov = \$vcv

4 scalar lambda = (1-b)/(2*b)

5 scalar d3 = -1/(2*b)

6 scalar d4 = -1*(1-b)/(2*b~2)

7 matrix d = { 0, 0, d3, d4}

8 scalar v = d*cov*d’

9 scalar se = sqrt(v)

10 scalar lb = lambda – critical(t,\$df,.025)*se

11 scalar ub = lambda + critical(t,\$df,.025)*se

12 printf "nThe estimated optimal level of advertising is \$%.2f.n",1000*lambda

13 printf "nThe 95%% confidence interval is (\$%.2f, \$%.2f).n",1000*lb,1000*ub

The first line estimates the model using least sqaures and the —vcv option is used to print the covariance matrix. In line 2 the entire set of coefficents is saved into a vector (a one row matrix in this case) called b. This will make the syntax that follows easier since each coefficient can be referred to by its position in the vector, e. g., the third coefficient in b is b. In line 3 the covariance matrix is saved as cov. In line 4 the least squares estimates are substituted for the unknown parameters. In lines 5 and 6 the analytical derivatives are evaluated at the estimates. The matrix d is 1 x 4 and contains the derivatives of the hypothesis with respect to each of the parameters. The next line computes variance in equation (5.13). Finally, the square root is taken
to get the standard error and the confidence bounds are computed in lines 10 and 11 and printed in 12 and 13.

The estimated optimal level of advertising is \$2014.34. The 95% confidence interval is (\$1757.67, \$2271.01).

According to this estimate the optimal level of advertising is \$2014.34 and the 95% confidence interval is (\$1758, \$2271).

5.1 Interactions

Interaction among variables was introduced in the preceding section for creating polynomial terms. The concept is very general can be applied to any situation where the effect of a change in one variable on the mean of the dependent variable depends on another variable.