get_sum_output
is a helper function for model_trend
,
model_gam
, and model_gamm
and extracts from a list
of summary.gam
objects specific values defined in `varname`.
get_sum_output(sum_list, varname, cell = NULL)
sum_list | A list of summary objects created with summary.gam. |
---|---|
varname | A character naming the element to extract from the `sum_list`. |
cell | If more than one value is stored under `varname` you need to specify which one you want to pull with `cell`. |
The function returns a vector with the length of `sum_list` containing the extracted values.
# Using some models of the Baltic Sea demo data: sum_list <- purrr::map(model_gam_ex$model, ~mgcv::summary.gam(.) ) get_sum_output(sum_list, varname = "edf")#> [1] 1.921618 2.740511 1.000000 1.000000 3.519834 1.288505 2.120201 1.000002 #> [9] 1.739864 1.160793 1.000001 1.000000 1.000002 1.000001 1.000000 1.000000 #> [17] 1.000000 3.272188 1.096102 2.496702 1.000000 1.771744 1.000000 1.000000 #> [25] 1.000000 1.000000 1.000000 1.844621 1.000000 2.754318 1.000000 1.000000 #> [33] 3.357938 1.000000 1.559080 1.000000 1.137822 1.000000 1.000000 1.000000 #> [41] 1.000000 1.861183 1.000000 2.165295 1.617269 2.340655 1.000000 1.564503 #> [49] 1.000000 1.000000 3.337381 1.000000 1.000000 1.000000 1.000000 1.960560 #> [57] 1.000000 1.632750 1.000000 1.643545 1.000000 3.701285 3.335511 1.000000 #> [65] 1.519520 1.997382 1.141977 1.000000 3.913887 2.792943 1.000000 1.850246 #> [73] 1.000000 1.000000 2.109077 1.000000 1.000000 3.015632 1.000000 2.369817 #> [81] 1.833623 1.000000 1.000000 1.000000# Get p-val with cell argument: get_sum_output(sum_list, "s.table", cell = 4)#> [1] 1.454804e-01 7.780815e-02 6.991980e-01 6.821577e-01 1.182017e-03 #> [6] 4.546479e-02 7.497407e-02 8.828158e-01 1.909333e-02 2.023175e-01 #> [11] 9.315681e-01 4.105204e-01 3.232688e-02 7.005542e-01 9.057454e-05 #> [16] 7.980784e-01 2.828459e-01 1.723759e-01 9.608774e-01 1.516782e-01 #> [21] 8.169433e-01 3.862497e-01 5.173232e-01 3.697066e-01 8.955468e-01 #> [26] 2.450883e-01 7.258118e-01 4.875993e-01 6.324655e-03 3.257445e-01 #> [31] 7.159059e-01 6.167576e-01 2.547381e-02 6.754193e-02 4.071651e-01 #> [36] 1.373752e-02 7.225548e-01 6.498475e-01 9.693019e-01 1.434734e-01 #> [41] 3.652050e-01 1.990617e-01 5.601913e-02 5.457886e-02 2.567769e-01 #> [46] 6.307901e-02 1.932095e-01 3.468997e-03 3.610180e-01 2.494263e-01 #> [51] 9.160440e-02 7.534634e-02 4.302132e-01 1.269027e-01 9.633123e-01 #> [56] 2.271321e-01 1.107934e-01 4.954978e-01 7.722947e-02 1.402428e-01 #> [61] 7.103254e-02 1.705351e-03 2.692455e-03 6.483275e-01 1.142668e-01 #> [66] 2.322822e-01 6.038028e-01 7.746836e-01 1.060957e-04 2.314342e-02 #> [71] 1.215057e-01 3.179277e-01 1.827412e-02 7.340177e-01 8.337973e-02 #> [76] 1.826171e-01 2.897463e-01 2.849954e-01 9.617034e-01 2.150511e-01 #> [81] 2.260096e-01 1.820168e-02 5.454763e-02 7.252151e-03