Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Test for significance of the difference between knee locations?


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Test for significance of the difference between knee locations?
Date   Thu, 18 Oct 2012 17:10:53 -0400

Jordan Silberman <silberman.stata@gmail.com>:
Do not test all coefs' equality if you want to test whether maxima or
minima are in the same position on the x axis. Rather solve for maxima
or minima by setting the first derivative to zero to find that the
extremum is where x equals the negative of the linear term's coef
divided by twice the quadratic term's coef (-b/2a in the usual
parlance, for y=ax^2+bx+c).

sysuse nlsw88, clear
*compare extremum positions for quadratics, e.g. for
*tw qfit wage age if union==0||qfit wage age if union==1
reg wage c.age##c.age##i.union, nohe
loc 1 (k1:-_b[age]/_b[c.age#c.age]/2)
loc 2 (k2:-(_b[age]+_b[1.union#c.age])/
loc 2 `2'(_b[c.age#c.age]+_b[1.union#c.age#c.age])/2)
nlcom `1' `2', post
test k1==k2
* or keep your command shorter
g a2=age^2
g ua=union*age
g ua2=union*a2
g na=(union==0)*age
g na2=(union==0)*a2
g nu=(union==0)
reg wage union ua ua2 nu na na2, hascons
test ua=na
nlcom (k1:-_b[na]/_b[na2]/2) (k2:-_b[ua]/_b[ua2]/2), post
test k1==k2

*do not test all 3 param like so:
reg wage union ua ua2 nu na na2, hascons
test ua=na
test ua2=na2, accum
test union=nu, accum


On Thu, Oct 18, 2012 at 4:25 PM, Jordan Silberman
<silberman.stata@gmail.com> wrote:
> Hi Stata folks,
>
> I'm searching for a method I can run in Stata that will allow me to
> test whether the location of the knee for one quadratic model
> significantly differs from that of another quadratic model.
>
> I have 2 quadratic models, each modeling a different category of
> healthcare costs as a function of age. Let's say, for illustrative
> purposes, that the knee of the first quadratic model occurs at age 45,
> and the knee for the second model occurs at age 55.
>
> Can anybody suggest a method for testing whether the former "knee age"
> differs significantly from the latter "knee age?" The idea is to test
> the hypothesis that there is a difference across the 2 models in the
> age at which the costs growth rate begins to increase.
>
> Any suggestions would be greatly appreciated.
>
> Thanks,
> Jordan
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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