|
6 | 6 | #'@param include_betas Logical. Print a summary that includes posterior summaries |
7 | 7 | #'of all linear predictor beta coefficients (including spline coefficients)? |
8 | 8 | #'Defaults to \code{TRUE} but use \code{FALSE} for a more concise summary |
| 9 | +#'@param smooth_test Logical. Compute estimated degrees of freedom and approximate |
| 10 | +#'p-values for smooth terms? Defaults to \code{TRUE}, but users may wish to set |
| 11 | +#'to \code{FALSE} for complex models with many smooth terms |
9 | 12 | #'@param digits The number of significant digits for printing out the summary; |
10 | 13 | #' defaults to \code{2}. |
11 | 14 | #'@param ... Ignored |
|
28 | 31 | #'For `coef.mvgam`, either a \code{matrix} of posterior coefficient distributions |
29 | 32 | #'(if \code{summarise == FALSE} or \code{data.frame} of coefficient summaries) |
30 | 33 | #'@export |
31 | | -summary.mvgam = function(object, include_betas = TRUE, digits = 2, ...){ |
| 34 | +summary.mvgam = function(object, |
| 35 | + include_betas = TRUE, |
| 36 | + smooth_test = TRUE, |
| 37 | + digits = 2, ...){ |
| 38 | + |
| 39 | +#### Smooth tests #### |
| 40 | + if(smooth_test){ |
| 41 | + object$mgcv_model <- compute_edf(object$mgcv_model, |
| 42 | + object, |
| 43 | + 'rho', |
| 44 | + 'sigma_raw') |
| 45 | + |
| 46 | + if(!is.null(object$trend_call)){ |
| 47 | + object$trend_mgcv_model <- compute_edf(object$trend_mgcv_model, |
| 48 | + object, |
| 49 | + 'rho_trend', |
| 50 | + 'sigma_raw_trend') |
| 51 | + } |
| 52 | + } |
32 | 53 |
|
33 | 54 | #### Standard summary of formula and model arguments #### |
34 | 55 | if(!is.null(object$trend_call)){ |
@@ -252,8 +273,8 @@ if(!is.null(attr(object$mgcv_model, 'gp_att_table'))){ |
252 | 273 | print(rbind(alpha_summary, rho_summary)) |
253 | 274 | } |
254 | 275 |
|
255 | | -if(any(!is.na(object$sp_names))){ |
256 | | - gam_sig_table <- summary(object$mgcv_model)$s.table[, c(1,3,4), drop = FALSE] |
| 276 | +if(any(!is.na(object$sp_names)) & smooth_test){ |
| 277 | + gam_sig_table <- summary(object$mgcv_model)$s.table[, c(1,2,3,4), drop = FALSE] |
257 | 278 | if(!is.null(attr(object$mgcv_model, 'gp_att_table'))){ |
258 | 279 | gp_names <- unlist(purrr::map(attr(object$mgcv_model, |
259 | 280 | 'gp_att_table'), 'name')) |
@@ -676,8 +697,8 @@ if(!is.null(object$trend_call)){ |
676 | 697 | print(rbind(alpha_summary, rho_summary)) |
677 | 698 | } |
678 | 699 |
|
679 | | - if(any(!is.na(object$trend_sp_names))){ |
680 | | - gam_sig_table <- summary(object$trend_mgcv_model)$s.table[, c(1,3,4), drop = FALSE] |
| 700 | + if(any(!is.na(object$trend_sp_names)) & smooth_test){ |
| 701 | + gam_sig_table <- summary(object$trend_mgcv_model)$s.table[, c(1,2,3,4), drop = FALSE] |
681 | 702 | if(!is.null(attr(object$trend_mgcv_model, 'gp_att_table'))){ |
682 | 703 | gp_names <- unlist(purrr::map(attr(object$trend_mgcv_model, 'gp_att_table'), 'name')) |
683 | 704 | if(all(rownames(gam_sig_table) %in% gsub('gp(', 's(', gp_names, fixed = TRUE))){ |
|
0 commit comments