[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Steven Samuels <sjhsamuels@earthlink.net> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: Linear Regression |

Date |
Fri, 8 Aug 2008 10:28:56 -0400 |

Someone from StataCorp recently noted that it can be done with -nl-

/*******************************************/

sysuse auto

nl (mpg = {b0}+ {b1}*weight + {b2}*weight^2)

/********************************************/

No program with which I am familiar (SAS, R, SPSS, Stata) allows the simpler syntax that Meric would like to use. Either one must create a new variable or create names for all coefficients and supply them to the equation. If Meric is concerned about the effort of adding many polynomial terms, then -orthpoly- would be an easy approach.

-Steve

On Aug 8, 2008, at 9:39 AM, Nick Cox wrote:

I am not clear what your question is precisely.

But if you want to -regress- on something and its square, you need to

-generate- the square as a new variable before you can do it, unless it

exists already.

I am not clear what you mean by "efficient", but I don't think there is

another way to do it.

Nick

n.j.cox@durham.ac.uk

Meric Osman

I have a problem about writing my regression equation. I want to add

the variable and its square at the same time. Such as

y = a + a^2 + ...

Actually, I can do it by generating a new variable which is a*a, but I

don't wanna do that because it is not an efficient way.

*

* For searches and help try:

* http://www.stata.com/help.cgi?search

* http://www.stata.com/support/statalist/faq

* http://www.ats.ucla.edu/stat/stata/

* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Linear Regression***From:*Meric Osman <meo542@mail.usask.ca>

**st: RE: Linear Regression***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**Re: st: RE: Linear Regression** - Next by Date:
**st: Cramers V with weighted data** - Previous by thread:
**Re: st: RE: Linear Regression** - Next by thread:
**st: Cramers V with weighted data** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |