简体   繁体   English

等高线图的解释(mgcv)

[英]Interpretation of contour plots (mgcv)

When we plot a GAM model using the mgcv package with isotropics smoothers, we have a contour plot of something like this: When we plot a GAM model using the mgcv package with isotropics smoothers, we have a contour plot of something like this:

  • x axis for one predictor,一个预测变量的 x 轴,
  • y axis for another predictor,另一个预测变量的 y 轴,
  • the main is a function s(x1, x2) (isotropic smother).主要是 function s(x1, x2)(各向同性窒息)。

Suppose that in this model we have many other isotropic smoothers like: y ~ s(x1, x2) + s(x3, x4) + s(x5, x6)假设在这个 model 中,我们有许多其他各向同性平滑器,例如:y ~ s(x1, x2) + s(x3, x4) + s(x5, x6)

My doubts are:我的疑问是:
When interpreting the contour plot for s(x1, x2) what happen to the others isotropic smoothers?在解释 s(x1, x2) 的轮廓 plot 时,其他各向同性平滑器会发生什么情况?
They are "fixed in their medians"?他们是“固定在他们的中位数”?
Can we interpret as(x1, x2) plot separately?我们可以分别解释为(x1, x2) plot 吗?

Because this model is additive in the functions you can interpret the functions (the separate s() terms) separately, but not necessarily as separate effects of covariates on the response.因为这个 model 在函数中是附加的,所以您可以单独解释函数(单独s()项),但不一定是协变量对响应的单独影响。 In your case there is no overlap between the covariates in each of the bivariate smooths, so you can also interpret them as the effects of the covariates on the response separately from the other smoothers.在您的情况下,每个二元平滑器中的协变量之间没有重叠,因此您也可以将它们解释为协变量对响应的影响,与其他平滑器分开。

All of the smooth functions are typically subject to a sum to zero constraint to allow the model constant term (the intercept) to be an identifiable parameter.所有平滑函数通常都受到总和为零的约束,以允许 model 常数项(截距)成为可识别的参数。 As such, the 0 line in each plot is the value of the model constant term (on the scale of the link function or linear predictor).因此,每个 plot 中的 0 线是 model 常数项的值(在链接 function 或线性预测器的范围内)。

The plots shown in the output from plot.gam(model) are partial effects plots or partial plots. plot.gam(model)中的 output 中显示的图是部分效应图或部分图。 You can essentially ignore the other terms if you are interested in understanding the effect of that term on the response as a function of the covariates for the term.如果您有兴趣将其他术语理解为该术语的协变量的 function 对响应的影响,则基本上可以忽略其他术语。

If you have other terms in the model that might include one or more covariates in another terms, and you want to look at how the response changes as you vary that term or coavriate, then you should predict from the model over the range of the variables you are interested in, whilst holding the other variables at some representation values, say their means or medians.如果您在 model 中有其他术语,可能在另一个术语中包含一个或多个协变量,并且您想查看响应如何随着您改变该术语或协变量而变化,那么您应该从 model预测变量范围您感兴趣,同时将其他变量保持在某些表示值,例如它们的平均值或中位数。

For example if you had例如,如果你有

model <- gam(y ~ s(x, z) + s(x, v), data = foo, method = 'REML')

and you want to know how the response varied as a function of x only, you would fix z and v at representative values and then predict over a range of values for x :并且您想知道响应如何变化为仅x的 function,您可以将zv固定为代表值,然后预测x的一系列值:

newdf <- with(foo, expand.grid(x = seq(min(x), max(x), length = 100),
                               z = median(z)
                               v = median(v)))
newdf <- cbind(newdf, fit = predict(model, newdata = newdf, type = 'response'))
plot(fit ~ x, data = newdf, type = 'l')

Also, see ?vis.gam in the mgcv package as a means of preparing plots like this but where it does the hard work.此外,请参阅?vis.gam vis.gam作为准备这样的图的一种方法,但它在哪里进行了艰苦的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM