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)

Arguments

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`.

Value

The function returns a vector with the length of `sum_list` containing the extracted values.

See also

Examples

# 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.337382 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.455635e-01 7.719958e-02 6.991983e-01 6.821579e-01 9.539812e-04 #> [6] 4.631689e-02 7.539967e-02 8.828124e-01 1.871878e-02 2.021004e-01 #> [11] 9.315649e-01 4.104841e-01 3.215409e-02 7.005543e-01 7.382023e-05 #> [16] 7.980791e-01 2.827565e-01 1.725010e-01 9.182195e-01 1.519263e-01 #> [21] 8.169444e-01 3.853007e-01 5.173233e-01 3.696555e-01 8.955471e-01 #> [26] 2.449802e-01 7.258123e-01 4.851479e-01 6.210798e-03 3.251312e-01 #> [31] 7.159061e-01 6.167581e-01 2.545820e-02 6.735817e-02 4.031123e-01 #> [36] 1.359406e-02 6.892301e-01 6.498481e-01 9.693019e-01 1.433137e-01 #> [41] 3.651521e-01 1.988939e-01 5.583602e-02 5.490926e-02 2.559344e-01 #> [46] 6.347853e-02 1.930749e-01 3.261327e-03 3.609634e-01 2.493204e-01 #> [51] 9.197584e-02 7.516344e-02 4.301833e-01 1.267355e-01 9.633124e-01 #> [56] 2.268141e-01 1.106198e-01 4.953339e-01 7.704678e-02 1.396545e-01 #> [61] 7.084900e-02 1.447595e-03 2.514511e-03 6.483280e-01 1.140138e-01 #> [66] 2.319460e-01 5.871091e-01 7.746839e-01 5.606838e-05 2.261879e-02 #> [71] 1.212727e-01 3.169262e-01 1.804906e-02 7.340162e-01 8.364861e-02 #> [76] 1.824235e-01 2.896260e-01 2.843832e-01 9.617033e-01 2.148061e-01 #> [81] 2.257218e-01 1.804776e-02 5.436467e-02 7.133096e-03