Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: fitting curves in regplot

 From Nick Cox To statalist@hsphsun2.harvard.edu Subject Re: st: fitting curves in regplot Date Sun, 26 Jun 2011 08:49:06 +0100

```Straight lines yes, as I have shown. Hyperbolas yes to a good
approximation, although you may need to pay attention to the -bands()-
option.

Nick

On Sun, Jun 26, 2011 at 2:21 AM, Arti Pandey <rtpandey@yahoo.com> wrote:
> Thanks Nick. I meant Nick J. Cox, the author of the paper I have mentioned.
> I am using regplot after -glm-. My question was can straight lines and smooth
> hyperbolas be generated in -regplot- with -mspline-.

> ----- Original Message ----
> From: Nick Cox <njcoxstata@gmail.com>
>
> Sorry, but I don't understand precisely what your question is. Note
> that there are several Nicks active on the list.
>
> -twoway mspline- is able to mimic straight lines, as a piecewise cubic
> can be piecewise linear. Consider
>
> . set obs 100
> obs was 0, now 100
>
> . gen x = _n
>
> . gen y = 42 + 32 * x
>
> . twoway line y x || mspline y x
>
> Nick
>
> On Sat, Jun 25, 2011 at 5:54 PM, Arti Pandey <rtpandey@yahoo.com> wrote:
>>
>>
>>
>> Hello
>> I am trying to fit curves after regression using glm. I am following Nick's
>> various online documents, especially the paper "Speaking Stata: Graphing Model
>> Diagnostics", The Stata Journal,2004, 4 No. 4, Pg 449-475". I am trying to get
>> the fitted curves to look like those in the paper. Choosing "lowess" for
>> plottype looks better but regplot doesnt allow us to play with bwidth.
>>
>> So my question is to Nick and anyone else who followed that paper, how can
>> mspline give such a perfect curve there. For example. the curve fit by type
>> shows perfect linear for one type, would mspline show that.
*
*   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/
```