# Formulating and fitting a nonlinear model that looks like a product of linear models

I've got a dataset that I'd like to model, and it seems like the best model would be of the form:

$y = (\beta_1 x_1 + \beta_2 x_2 + \beta_3 x_3) \cdot (\beta_4 x_4 + \beta_5 x_5 + \beta_6 x_6) + \epsilon$.

The $\beta_4$ through $\beta_6$ are independent of each other and have a linear effect on $y$ once modulated by the $\beta_1$ through $\beta_3$, which are independent of each other but scale the effect of the other predictors. I would expect the residuals of the above model to be fairly normal. If I want to fit this model in R, I can use a nonlinear model fitting routine such as nls(), it seems. But is there a better approach? This looks like the sort of model that might be a special case with a name and an optimized fitting approach. Is it?

• Why do you think this would be the best model? I am asking because the same line of thinking would probably lead to a good way of inferring the $\beta$s. – highBandWidth Jan 28 '12 at 3:36
• You can fit this model directly in JAGS. This would also set you up for trying alternative models. – Jack Tanner Jan 28 '12 at 14:40
• Have you tried taking the logs of all your covariates (i.e., x's) and then fitting a linear model? – gung - Reinstate Monica Jan 28 '12 at 21:43

You may need to enlighten me what the non-linear part of the model is (as @gung alluded to in the comments, although you don't need to take the logarithms to "make it" a linear model).

You can use the distributive rule of multiplication to see that all you have specified is a model of a series of interactions. Because I don't feel like writing out all those interactions, I'll show what I mean with fewer initial parameters/independent variables.

$y = (\beta_1x_1 + \beta_1x_2) \cdot (\beta_3x_3 + \beta_4x_4)$

Can then be represented as a series of interactions;

$y = \beta_1\beta_3(x_1x_3) + \beta_1\beta_4(x_1x_4) + \beta_2\beta_3(x_2x_3) + \beta_2\beta_4(x_2x_4)$

Good new is this is a linear equation (see What does linear stand for in linear regression for more description on why this is a linear equation). And hence, you can use OLS to fit the model. Bad news is, the paramters as specified in your original equation are not identified (e.g. you can't estimate what $\beta_2$ is, you can only estimate the product of $\beta_2\beta_4$ etc.) This isn't a problem of linear vs non-linear though.

I can't say whether such a model is appropriate, and many think that it is innapropriate to specify a model with interactions without the main effects included. See this other question on the site, Including the interaction but not the main effects in a model for discussion on that issue.

• Hm, well-written answer, but it would fairly drastically increase the degrees of freedom. I rather simplified the problem for this question, and so this approach would change the number of free parameters in my actual problem from about $11+5$ to about $11\cdot 5$, and, as you note, lose identifiability. – Harlan Jan 30 '12 at 12:44
• @Harlan, there are considerable complications evaluating the model as initially proposed. The terms within the parenthesis would be considered formative measurement models, and would need further information to identify those parameters anyway. See Bollen & Bauldry (2011). – Andy W Jan 30 '12 at 12:49