[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

# Re: st: fracpoly model question

 From Tim Wade To statalist@hsphsun2.harvard.edu Subject Re: st: fracpoly model question Date Thu, 12 Mar 2009 20:45:47 -0400

not exactly sure what the problem is, but -fracpoly- also centers the
transformed variables:

(I'm using Stata 10 by the way)

. sysuse auto.dta, clear
(1978 Automobile Data)

. fracpoly reg price mpg, noscaling
........
-> gen double Impg__1 = mpg^-2-.0022047077 if e(sample)
-> gen double Impg__2 = mpg^-2*ln(mpg)-.0067432752 if e(sample)

Source |       SS       df       MS              Number of obs =      74
-------------+------------------------------           F(  2,    71) =   23.76
Model |   254596301     2   127298151           Prob > F      =  0.0000
Residual |   380469095    71  5358719.65           R-squared     =  0.4009
-------------+------------------------------           Adj R-squared =  0.3840
Total |   635065396    73  8699525.97           Root MSE      =  2314.9

------------------------------------------------------------------------------
price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
Impg__1 |    7070957    3149820     2.24   0.028     790394.2    1.34e+07
Impg__2 |   -2406544    1314637    -1.83   0.071     -5027857    214768.4
_cons |   5281.835   317.7363    16.62   0.000     4648.287    5915.384
------------------------------------------------------------------------------
Deviance:  1353.51. Best powers of mpg among 44 models fit: -2 -2.

. fracpred xhat

. nlcom  _b[Impg__1] *((20^-2)-0.0022047077)+
_b[Impg__2]*((20^-2)*(log(20))-0.0067432752)+_b[_cons]

_nl_1:  _b[Impg__1] *((20^-2)-0.0022047077)+
_b[Impg__2]*((20^-2)*(log(20))-0.0067432752)+_b[_cons]

------------------------------------------------------------------------------
price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_nl_1 |   5574.419   332.8972    16.75   0.000     4910.641    6238.197
------------------------------------------------------------------------------

. list xhat if mpg==20

+----------+
|     xhat |
|----------|
4. | 5574.419 |
8. | 5574.419 |
34. | 5574.419 |
+----------+

.
Tim

On Thu, Mar 12, 2009 at 7:16 PM, Chris Witte <eljefespeaks@yahoo.com> wrote:
> I am using stata 9.2.  Here are the coefficient estimates from my _fracpoly_ analysis:
>
> study1twsg       Coef.   Std. Err.      t    P>t     [95% Conf. Interval]
> Itemp__1    15093.12   4454.121     3.39   0.012     4560.802    25625.45
> Itemp__2   -10666.18    3136.84    -3.40   0.011    -18083.63   -3248.734
> Itemp__3    1945.114   569.9302     3.41   0.011     597.4436    3292.785
> _cons    .0053322   .0008244     6.47   0.000     .0033828    .0072815
> Deviance:  -113.24. Best powers of temp among 164 models fit: -2 -2 -2.
> Fractional polynomial model comparisons:
> temp             df       Deviance      Res. SD      Gain   P(term) Powers
> Not in model      0       -101.249      .002545        --     --
> Linear            1       -101.599      .002641     0.000    0.603  1
> m = 1             2       -101.796      .002617     0.197    0.714  3
> m = 2             4       -104.278       .00248     2.679    0.508  3 3
> m = 3             6       -113.237      .001764    11.638    0.196  -2 -2 -2
>
> so, given these coefficients and my 'x' having a value of 25, I think my linear regression equation for predicting y should be:
>
> y=.0053322+(15093.12*25^-2)+(-10666.18*25^-2*log(25))+1945.114*25^-2*(log(25))^2
>
> if this is correct, the equation is not yielding the same estimates as _fracpred_.  The above equation returns an answer of 1.467, while _fracpred_ (which I believe is correct) gives 0.003.
>
> What am I doing wrong?
>
> thanks a bunch in advance,
> Chris
>
>
> p.s. I know I'm not supposed to reply to a different thread with a new question, but I've tried to send this message twice as a new message and it has not gotten through.
>
>
>
>
>
> *
> *   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/

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