当我跑步时gam.check(my_spline_gam),我得到以下输出.
Method: GCV Optimizer: magic
Smoothing parameter selection converged after 9 iterations.
The RMS GCV score gradiant at convergence was 4.785628e-06 .
The Hessian was positive definite.
The estimated model rank was 25 (maximum possible: 25)
Model rank = 25 / 25
Basis dimension (k) checking results. Low p-value (k-index<1) may
indicate that k is too low, especially if edf is close to k'.
k' edf k-index p-value
s(x) 24.000 22.098 0.849 0.06
Run Code Online (Sandbox Code Playgroud)
我的问题是我是否可以将这个p值分别提取到表中.
capture.output结合一点字符串操作使用-
gam_obj <- capture.output(gam.check(b,pch=19,cex=.3))
gam_tbl <- gam_obj[12:length(gam_obj)]
str_spl = function(x){
p_value <- strsplit(x, " ")[[1]]
output_p <- as.numeric(p_value[length(p_value)])
}
p_values <- data.frame(sapply(gam_tbl, str_spl))
Run Code Online (Sandbox Code Playgroud)
输出
| 归档时间: |
|
| 查看次数: |
418 次 |
| 最近记录: |