Statalist


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

Re: st: RE: Graphing quadratic relationship


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Graphing quadratic relationship
Date   Sun, 27 Sep 2009 08:59:34 -0400

But compare:

ssc inst locpr, replace
locpr died age, l c leg(off) loptions(leg(off))

You can also can change a few lines in -locpr- to add a quadratic option:

prog locpr2, sortpreserve
version 11.0
*/ coptions(string) Stub(str) SCatter Logit lbw BWidth(real 0) /*
*/ Combine Quadratic *]
  if "`quadratic'"=="" logit `1' `2' if `touse' `wt'
  else logit `1' c.`2'##c.`2' if `touse' `wt'


On Fri, Sep 18, 2009 at 5:35 PM, Hugh Robinson
<hugh.robinson@cfc.umt.edu> wrote:
> Stephanie,
>
> The cancer.dta data doesn't fit a quadratic very well, but do you mean something like this?  Coding is stata 9.2.
>
> sysuse cancer
> gen age2= age* age
> logit died  age age2
> predict yhatdied
> twoway (histogram age if (died == 1), percent yaxis(2) fcolor(sand) lcolor(none) legend(label(1 "Died")))(histogram age if (died==0), percent yaxis(2) fcolor(none) lcolor(black) legend(label(2 "Alive")))(connected yhatdied age, sort), xtitle(age) ytitle(probability death) legend(on) scheme(s2color) name(test)
>
> HR
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Stephanie L Kent
> Sent: Friday, September 18, 2009 11:36 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Graphing quadratic relationship
>
> Dear users,
>
> I would like to graph a relationship between a quadratic independent
> variable and my dependent variable to see how y varies acccording to x and
> x^2.  It's a logistic regression so my DV is 0-1 and I need to show how
> both the 0's and 1's vary according to x and x^2.  Any advice on how to get
> started is much appreciated!
>
> Sincerely,
> Stephanie
>

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index