Hi Andrew,

mgcv matches the knots to the smooth arguments by name. If an element of 
'knots' has
no name it will be ignored. The following will do what you want...

dumb.example = gam(y~s(x,k=3),knots=list(x=dumb.knots))

best,
Simon

On 29/11/12 23:44, Andrew Crane-Droesch wrote:
Dear List,

I'm using GAMs in a multiple imputation project, and I want to be able
to combine the parameter estimates and covariance matrices from each
completed dataset's fitted model in the end.  In order to do this, I
need the knots to be uniform for each model with partially-imputed
data.  I want to specify these knots based on the quantiles of the
unique values of the non-missing original data, ignoring the NA's.  When
I fit the GAM with the imputed data included, I don't want mgcv to use
the data that it is supplied to figure out the knots, because this will
lead to un-comparable results when the many fitted models are combined.

Here is a caricatured example of what I want to do:

#Random data
x = runif(1000,0,1)
y = (log(x^2)+x^3)/sin(x)
example = gam(y~s(x))
plot(example)

#But I want to define my own knots
dumb.knots = c(.7,.8,.9)
dumb.example = gam(y~s(x,k=3),knots=list(dumb.knots))
plot(dumb.example)
dumb.example2 = gam(y~s(x,k=3))
plot(dumb.example2)

Dumb example 1 is the same as dumb example 2, but it shouldn't be.

Once I figure out how to do this, I'll take the fitted coefficients from
each model and average them, then take the vcv's from each model and
average them, and add a correction to account for within and between
imputation variability, then plug them into a gamObject$coeffient and
gamObject$Vp matrix, plot/summarize, and have my result.  Comments
welcome on whether or not this would be somehow incorrect would be
welcome as well.  Still have a lot to learn!

Thanks,
Andrew

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to