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]

From |
Aaron Kirkman <ak1795mailserv@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Is there a way to use or emulate the behaviour of --predict-- with --by-- groups? |

Date |
Wed, 31 Oct 2012 13:35:57 -0500 |

Hi Nick, Just to clarify (for my benefit), do you mean using --ipolate-- on the log(y) and log(x) variables then exponentiating the new values of log(y)? Aaron On Wed, Oct 31, 2012 at 1:18 PM, Nick Cox <njcoxstata@gmail.com> wrote: > Did you think of interpolating the logs and then exponentiating? > > Regression of any flavour can't interpolate unless all the residuals > are zero; it can only smooth. If that's what you want, fine, but it is > not like -ipolate-. > > Nick > > On Wed, Oct 31, 2012 at 5:49 PM, Aaron Kirkman <ak1795mailserv@gmail.com> wrote: >> Thank you Maarten. The interaction term does exactly what I need. Once >> I added --set matsize 3000-- to my actual data set, the interpolation >> works well. >> >> On Wed, Oct 31, 2012 at 3:19 AM, Maarten Buis <maartenlbuis@gmail.com> wrote: >>> On Wed, Oct 31, 2012 at 1:40 AM, Aaron Kirkman wrote: >>>> I have data grouped by a variable called --group--, in this example, >>>> and I'm trying to use logarithmic interpolation on another variable. >>>> Linear interpolation using the --ipolate-- command works perfectly in >>>> --by-- group <snip> Unfortunately, this does not work with logarithmic >>>> interpolation and --regress--/--predict--. >>> >>> You can avoid the -by:- prefix by adding interactions to your linear >>> regression model: >>> >>> *---------- begin example ---------- >>> clear >>> quietly input str1 group x y >>> A 1 1000 >>> A 2 . >>> A 3 3000 >>> A 4 . >>> B 5 45 >>> B 6 . >>> B 9 20 >>> end >>> >>> encode group, gen(groupnum) >>> gen lx = ln(x) >>> >>> reg y i.groupnum##c.lx >>> >>> predict y_loginterp, xb >>> *----------- end example ----------- >>> >>> Notice that the observation A 4 is not strictly speaking an >>> interpolation but an extrapolation. You'll want to be more careful in >>> those situations. > * > * 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/ * * 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/

**Follow-Ups**:**Re: st: Is there a way to use or emulate the behaviour of --predict-- with --by-- groups?***From:*Nick Cox <njcoxstata@gmail.com>

**References**:**st: Is there a way to use or emulate the behaviour of --predict-- with --by-- groups?***From:*Aaron Kirkman <ak1795mailserv@gmail.com>

**Re: st: Is there a way to use or emulate the behaviour of --predict-- with --by-- groups?***From:*Maarten Buis <maartenlbuis@gmail.com>

**Re: st: Is there a way to use or emulate the behaviour of --predict-- with --by-- groups?***From:*Aaron Kirkman <ak1795mailserv@gmail.com>

**Re: st: Is there a way to use or emulate the behaviour of --predict-- with --by-- groups?***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**Re: st: Search Notes** - Next by Date:
**Re: st: SSM and GLLAPRED** - Previous by thread:
**Re: st: Is there a way to use or emulate the behaviour of --predict-- with --by-- groups?** - Next by thread:
**Re: st: Is there a way to use or emulate the behaviour of --predict-- with --by-- groups?** - Index(es):