2

What should I do in Deducer's Linear Regression Model Builder to produce a formula like the following

lm(ozone~temp*wind*rad+I(rad^2)+I(temp^2)+I(wind^2))

In the Outcomes text box I have the ozone variable and temp, wind and rad are in the Variables text box.

gd047
  • 29,749
  • 18
  • 107
  • 146

2 Answers2

2

In the dialog box that appears after choosing Linear Model, you will be entering temp, wind, and rad. Now you need to highlight all three and then select the [Three-way] button. (It will appear in the Model column as (temp+wind+rad)^3 which is equivalent to temp*wind*rad in R's formula syntax.) That will construct the first term. Now you need to highlight each variable in turn and for each one select [poly] and enter "2" to construct the second-order polynomial terms.

That may or may not give you exactly what you want, since poly constructed an orthogonal polynomial. Why not skip the rigomarole of the GUI and just enter this at the command line?:

lm(ozone~temp*wind*rad+I(rad^2)+I(temp^2)+I(wind^2), data=environmental)

I'm not sure what your real dataframe name might be but it has the same variables as the environmental dataframe that is part of the lattice package, so that is what I guessed.

IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • I have tried poly(vare,2) but the results are not the same. I guess that there must be a way to construct such a common formula. – gd047 Dec 28 '12 at 21:31
  • I told you how. Use the console entry. However, the "common formula" you are attempting to enter is fraught with potential for incorrect interpretation. It would be safer to stick with poly(vare,2) and that is why I suspect Deducer makes it less simple for newbs to take the "common" path. The poly-path is less subject to erroneous interpretation of the inferential statistics. – IRTFM Dec 28 '12 at 22:30
1

I found the answer here

terms can be hand edited by double clicking on them

gd047
  • 29,749
  • 18
  • 107
  • 146