Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: problem with squared term
From
Prabhat <[email protected]>
To
[email protected]
Subject
Re: st: problem with squared term
Date
Sun, 21 Mar 2010 03:50:42 +0900
Thank you so much Michae!
I think your analysis captures it very well.
However, I have two new queries-
1. Why am I not getting this problem with ktotppt and ktotpptsq (here
totppt is total rainfall)?
2. The coefficient on cw1ksq is significant and positive. So, if I get
similar result for my variable i.e. kavgtemp, shold I say that it is
"inverted U" kind of relation (and not linear) ? I mean it is straight
forward but still would like to confirm if there is some trick.
Thanks again!
Regards,
Prabhat
On Sun, Mar 21, 2010 at 3:32 AM, Michael Norman Mitchell
<[email protected]> wrote:
> Dear Prabhat
>
> The coefficient for kavgtemp is the linear effect of average temperature
> **when all other variables are held constant at zero**. This influences the
> size of the coefficient when a variable is interacted with (multiplied by)
> other variables. In this case, it is when kavgtemp is multiplied by itself,
> forming the squared term. So, kavgtemp reflects the instantaneous linear
> slope when average temperature is equal to 0.
>
> The because of the squared term, the linear slope will change over the
> values of average temp. So, perhaps you might want to see the linear slope
> when the average temp is at the mean. Using the "auto" dataset, here is an
> example showing weight predicting mpg. The first example is like yours,
> where the coefficient for weight changes, and the second example uses
> centering around the mean.
>
> . ***
> . * Example 1
> . clear
>
> . sysuse auto
> (1978 Automobile Data)
>
> . generate wt1k = weight / 1000
>
> . generate wt1ksq = wt1k*wt1k
>
> .
> . regress mpg wt1k
>
> Source | SS df MS Number of obs =
> 74
> -------------+------------------------------ F( 1, 72) =
> 134.62
> Model | 1591.99024 1 1591.99024 Prob > F =
> 0.0000
> Residual | 851.469221 72 11.8259614 R-squared =
> 0.6515
> -------------+------------------------------ Adj R-squared =
> 0.6467
> Total | 2443.45946 73 33.4720474 Root MSE =
> 3.4389
>
> ------------------------------------------------------------------------------
> mpg | Coef. Std. Err. t P>|t| [95% Conf.
> Interval]
> -------------+----------------------------------------------------------------
> wt1k | -6.008687 .5178782 -11.60 0.000 -7.041058
> -4.976316
> _cons | 39.44028 1.614003 24.44 0.000 36.22283
> 42.65774
> ------------------------------------------------------------------------------
>
> . regress mpg wt1k wt1ksq
>
> Source | SS df MS Number of obs =
> 74
> -------------+------------------------------ F( 2, 71) =
> 72.80
> Model | 1642.522 2 821.261002 Prob > F =
> 0.0000
> Residual | 800.937455 71 11.2808092 R-squared =
> 0.6722
> -------------+------------------------------ Adj R-squared =
> 0.6630
> Total | 2443.45946 73 33.4720474 Root MSE =
> 3.3587
>
> ------------------------------------------------------------------------------
> mpg | Coef. Std. Err. t P>|t| [95% Conf.
> Interval]
> -------------+----------------------------------------------------------------
> wt1k | -14.15806 3.883535 -3.65 0.001 -21.90161
> -6.414512
> wt1ksq | 1.324401 .6257594 2.12 0.038 .0766722
> 2.57213
> _cons | 51.18308 5.767884 8.87 0.000 39.68225
> 62.68391
> ------------------------------------------------------------------------------
>
> . ***
> . * Example 2, center wt1k
> . summarize wt1k
>
> Variable | Obs Mean Std. Dev. Min Max
> -------------+--------------------------------------------------------
> wt1k | 74 3.019459 .7771936 1.76 4.84
>
> . generate cwt1k = wt1k - r(mean)
>
> . generate cwt1ksq = cwt1k*cwt1k
>
> .
> . regress mpg cwt1k
>
> Source | SS df MS Number of obs =
> 74
> -------------+------------------------------ F( 1, 72) =
> 134.62
> Model | 1591.99025 1 1591.99025 Prob > F =
> 0.0000
> Residual | 851.469214 72 11.8259613 R-squared =
> 0.6515
> -------------+------------------------------ Adj R-squared =
> 0.6467
> Total | 2443.45946 73 33.4720474 Root MSE =
> 3.4389
>
> ------------------------------------------------------------------------------
> mpg | Coef. Std. Err. t P>|t| [95% Conf.
> Interval]
> -------------+----------------------------------------------------------------
> cwt1k | -6.008687 .5178782 -11.60 0.000 -7.041058
> -4.976316
> _cons | 21.2973 .3997628 53.27 0.000 20.50038
> 22.09421
> ------------------------------------------------------------------------------
>
> . regress mpg cwt1k cwt1ksq
>
> Source | SS df MS Number of obs =
> 74
> -------------+------------------------------ F( 2, 71) =
> 72.80
> Model | 1642.52201 2 821.261005 Prob > F =
> 0.0000
> Residual | 800.93745 71 11.2808092 R-squared =
> 0.6722
> -------------+------------------------------ Adj R-squared =
> 0.6630
> Total | 2443.45946 73 33.4720474 Root MSE =
> 3.3587
>
> ------------------------------------------------------------------------------
> mpg | Coef. Std. Err. t P>|t| [95% Conf.
> Interval]
> -------------+----------------------------------------------------------------
> cwt1k | -6.160112 .5108358 -12.06 0.000 -7.178689
> -5.141534
> cwt1ksq | 1.324401 .6257594 2.12 0.038 .0766721
> 2.57213
> _cons | 20.50813 .5398843 37.99 0.000 19.43163
> 21.58463
> ------------------------------------------------------------------------------
>
> Note, now, the coefficient for cwt1k is the linear effect of weight on mpg
> when weight is at the average. If you choose a higher or lower value for the
> centering (say 1sd above the mean, or 1sd below the mean), you will get
> different values.
>
> I hope this helps,
>
> Michael N. Mitchell
> See the Stata tidbit of the week at...
> http://www.MichaelNormanMitchell.com
>
> On 2010-03-20 10.42 AM, Prabhat wrote:
>>
>> Dear all,
>>
>> I have come across a strange problem. I am trying to estimate the
>> coefficients for temperature and rainfall using WLS, where my
>> dependent variable is rice yield.
>> Now, when I am including the square term for the average temperature,
>> I am getting a very high and impossible estimate for the temperature
>> variable. It should be somewhere between 100-300, but after including
>> square term I am getting -3500.
>> I have just included OLS results here.
>>
>> Any comment will be appreciated.
>>
>>
>> Regards,
>> Prabhat Barnwal
>> International University of Japan
>>
>>
>>> . regress kyrice kavgtemp kavgtempsq ktotppt ktotpptsq ksdtemp
>>
>> Source | SS df MS Number of obs =
>> 735
>> -------------+------------------------------ F( 5, 729) =
>> 13.16
>> Model | 21551254.8 5 4310250.95 Prob> F =
>> 0.0000
>> Residual | 238840813 729 327628.001 R-squared =
>> 0.0828
>> -------------+------------------------------ Adj R-squared =
>> 0.0765
>> Total | 260392067 734 354757.585 Root MSE =
>> 572.39
>>
>>
>> ------------------------------------------------------------------------------
>> kyrice | Coef. Std. Err. t P>|t| [95% Conf.
>> Interval]
>>
>> -------------+----------------------------------------------------------------
>> kavgtemp | -3591.648 855.2294 -4.20 0.000 -5270.655
>> -1912.642
>> kavgtempsq | 67.01803 15.34115 4.37 0.000 36.89993
>> 97.13613
>> ktotppt | 1.053627 .5836936 1.81 0.071 -.0922936
>> 2.199548
>> ktotpptsq | -.0005872 .0003753 -1.56 0.118 -.001324
>> .0001496
>> ksdtemp | -196.4774 56.57082 -3.47 0.001 -307.5386
>> -85.41624
>> _cons | 49759.5 11888.92 4.19 0.000 26418.9
>> 73100.1
>>
>> ------------------------------------------------------------------------------
>> -> . regress kyrice kavgtemp ktotppt ktotpptsq ksdtemp
>>
>> Source | SS df MS Number of obs =
>> 735
>> -------------+------------------------------ F( 4, 730) =
>> 11.39
>> Model | 15298828.3 4 3824707.07 Prob> F =
>> 0.0000
>> Residual | 245093239 730 335744.163 R-squared =
>> 0.0588
>> -------------+------------------------------ Adj R-squared =
>> 0.0536
>> Total | 260392067 734 354757.585 Root MSE =
>> 579.43
>>
>>
>> ------------------------------------------------------------------------------
>> kyrice | Coef. Std. Err. t P>|t| [95% Conf.
>> Interval]
>>
>> -------------+----------------------------------------------------------------
>> kavgtemp | 143.2145 22.12018 6.47 0.000 99.78776
>> 186.6413
>> ktotppt | .9560253 .5904461 1.62 0.106 -.2031498
>> 2.1152
>> ktotpptsq | -.00057 .0003799 -1.50 0.134 -.0013158
>> .0001758
>> ksdtemp | -213.2879 57.13459 -3.73 0.000 -325.4556
>> -101.1202
>> _cons | -2107.959 622.1736 -3.39 0.001 -3329.422
>> -886.4957
>> *
>> * 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/
>
*
* 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/