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: GAMFIT failure despite updated gam


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: GAMFIT failure despite updated gam
Date   Fri, 30 Sep 2011 15:39:52 +0100

Thanks for the thanks, but there is a small confusion here to which I
may have contributed.

As I understand it, GAMs in Stata are implemented in terms of cubic
smoothing splines, so the choice here is small, in terms of two
different spline-based methods. Spline experts could tie you in knots
[*] explaining the fine differences, but often in practice the results
are very similar.

Nick

* That's enough of these jokes. Please remove this one. - Statalist censor.

On Fri, Sep 30, 2011 at 3:30 PM, Matthew Baldwin, MD <mrb45@columbia.edu> wrote:
> Nick,
>
>  Thanks for this code, it's a very nice alternative.
>
>  I think you're ahead of many of us, but right, about cubic splines being
> better.  Clinician-scientists like myself are still using GAMs, and in fact,
> I think GAM use is still increasing at least in the pulmonary literature,
> e.g. Busse WW, et al.  New England Journal of Medicine, 2011; 364:1005.
>  We're just lagging behind the curve I guess...
>
> Matthew
>
> Quoting Nick Cox <njcoxstata@gmail.com>:
>
>> Back to Matthew's question after my digressions, although some points
>> in the digressions are highly pertinent.
>>
>> The documentation for -gam- on SSC does not mention Windows 7. No idea
>> whether that's the crucial detail.
>>
>> More positively, what Matthew wants here is a highly standard model
>> supported by -glm-.
>>
>> The only twist is wanting to model dependence on the x variable as a
>> smooth function of x using splines.
>>
>> I guess Matthew is likely to get good results with one or all of the
>> following approaches.
>>
>> 1. Creating a bundle of spline variables with -mkspline- and then  using
>> those.
>>
>> Here is a simple example:
>>
>> sysuse auto, clear
>>
>> mkspline w = weight, cubic nknots(3)
>>
>> ds w?
>>
>> glm foreign w? , f(binomial) link(logit)
>>
>> predict foreign_p
>>
>> gen weight_show = round(weight, 50)
>>
>> bysort weight_show foreign : gen foreign_show = ///
>> cond(foreign, foreign - (_n-1)/50, foreign + (_n-1)/50)
>>
>> scatter foreign_show  weight_show, ms(Oh)  sort ///
>> || mspline foreign_p weight, bands(200) legend(off) ///
>> ytitle("`: var label foreign'") xtitle("`: var label weight'")
>>
>> (Some of the code here is binning and stacking for a nicer plot.)
>>
>> 2. Using -mvrs- to similar effect (SJ 7-1).
>>
>> Nick
>>
>> On Thu, Sep 29, 2011 at 10:18 PM, Matthew Baldwin, MD
>> <mrb45@columbia.edu> wrote:
>>
>>>   Despite having downloaded the most uptodate gam program that includes
>>> gam,
>>> gamfit, gambig, gamhuge, gamhug2, unzipping it, and indicating to Stata
>>> where the program is, I still get the following error message below.
>>>
>>>   Of note, I run Windows 7, and initally received an r(603) message after
>>> running the code below, and after doing what was recommended: 'update
>>> all,
>>> update swap', and now running Stata 11 as an administrator, I still cant
>>> get
>>> the gam program to work.
>>>
>>> It worked previously on this computer with this code before it was
>>> rebuilt/reinstalled.  Any help is greatly appreciated.
>>>
>>> ssc desc gam
>>> ssc install gam
>>> !unzip gam.zip
>>>
>>> global GAMDIR C:\ado\plus\g\
>>> gam yvar xvar if dcyear > 2005, f(binomial) link(logit) df(xvar:3) big
>>> GAMFIT failure, $.out not found
>>> stats not found
>>> r(111);
>>

*
*   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   |   Site index