Bookmark and Share

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

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

Re: st: GAMFIT failure despite updated gam

From   "Matthew Baldwin, MD" <[email protected]>
To   [email protected], Nick Cox <[email protected]>
Subject   Re: st: GAMFIT failure despite updated gam
Date   Fri, 30 Sep 2011 10:30:29 -0400


 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...


Quoting Nick Cox <[email protected]>:

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).


On Thu, Sep 29, 2011 at 10:18 PM, Matthew Baldwin, MD
<[email protected]> 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

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

*   For searches and help try:

Matthew Baldwin, MD
Clinical Fellow
Department of Pulmonary, Allergy, and Critical Care Medicine
New York Presbyterian Hospital
Columbia University College of Physicians and Surgeons
P: 917-899-2187
C: 917-846-7560

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index