在plot.gam()
我們注意到,plot()
叫上x$smooth[[i]]
,它是類的一個對象:
class(x$smooth[[i]])
[1] "tprs.smooth" "mgcv.smooth"
有是爲"mgcv.smooth"
類plot()
方法,正是這種正在使用的情節在一般情況下。 ?plot.gam
提到,這是用於大多數撫平默認方法,但也有某些類型的順利通過gam()
支持的具體方法(從?plot.gam
細節部分:
For smooth terms ‘plot.gam’ actually calls plot method functions
depending on the class of the smooth. Currently random effect and
Markov random field smooths have special methods, the rest use the
defaults described below.
出於某種原因,methods()
是沒有找到這些方法,但它們確實存在:
> mgcv:::plot.mgcv.smooth
function (x, P = NULL, data = NULL, label = "", se1.mult = 1,
se2.mult = 2, partial.resids = FALSE, rug = TRUE, se = TRUE,
scale = -1, n = 100, n2 = 40, pers = FALSE, theta = 30, phi = 30,
jit = FALSE, xlab = NULL, ylab = NULL, main = NULL, ylim = NULL,
xlim = NULL, too.far = 0.1, shade = FALSE, shade.col = "gray80",
shift = 0, trans = I, by.resids = FALSE, scheme = NULL, ...)
{
....
這可能與在methods()
一個bug這意味着plot.function
不顯示列表中的n,我當前的R可能不包含該修復。這種方法應該正常顯示,並且在這種情況下的一般建議是識別對象的類別(如上所示),然後使用methods()
和類似函數(例如showMethods()
)來確定該類的可用特定方法)返回的對象。
就在旁邊。 。 。當在函數調用中指定參數時,可以將參數的名稱截斷爲任何明確的。因此,如果簽名中只有一個參數_starts_帶有'P',則可以通過'P ='指定該參數。這不能回答你的問題,因此它只是一個評論。 – adamleerich