Skip to contents

coef() retrieve all coefficients from the output of lifelihood()

coeff() retrieve coefficients of one parameter from the output of lifelihood()

Usage

# S3 method for class 'lifelihoodResults'
coef(object, ...)

coeff(object, parameter_name)

Arguments

object

output of lifelihood()

...

Ignored

parameter_name

Name of the parameters to extract the estimate from to extract all parameter estimates). All parameters#' can be found here.

Value

A nested list of coefficient estimates

A list of coefficient estimates

Examples

library(lifelihood)
library(tidyverse)

df <- lifelihood::fakesample |>
  mutate(
    type = as.factor(type),
    geno = as.factor(geno)
  )

clutchs <- c(
  "clutch_start1", "clutch_end1", "clutch_size1",
  "clutch_start2", "clutch_end2", "clutch_size2"
)

dataLFH <- lifelihoodData(
  df = df,
  sex = "sex",
  sex_start = "sex_start",
  sex_end = "sex_end",
  maturity_start = "mat_start",
  maturity_end = "mat_end",
  clutchs = clutchs,
  death_start = "death_start",
  death_end = "death_end",
  covariates = c("geno", "type"),
  model_specs = c("gam", "lgn", "wei")
)

results <- lifelihood(
  lifelihoodData = dataLFH,
  path_config = get_config_path("config"),
  seeds = c(1, 2, 3, 4),
  raise_estimation_warning = FALSE
)
coef(results)
#>                          int_expt_death                   eff_expt_death_geno_1 
#>                            -14.95337701                              2.27064527 
#>                   eff_expt_death_type_1                   eff_expt_death_type_2 
#>                             -9.55371757                              0.53315647 
#>                      int_survival_shape               eff_survival_shape_geno_1 
#>                             10.28792377                             -1.93963186 
#>               eff_survival_shape_type_1               eff_survival_shape_type_2 
#>                              7.57026237                              4.74998927 
#>        eff_survival_shape_type_1:geno_1        eff_survival_shape_type_2:geno_1 
#>                             -0.24718760                              3.52427897 
#>                    int_ratio_expt_death             eff_ratio_expt_death_geno_1 
#>                             -1.45299283                              3.02680049 
#>                          int_prob_death                   eff_prob_death_geno_1 
#>                            -17.15815657                              0.02066385 
#>                       int_expt_maturity                eff_expt_maturity_geno_1 
#>                             -0.07781130                             -0.34729932 
#>                eff_expt_maturity_type_1                eff_expt_maturity_type_2 
#>                             -0.76380036                             -0.75476253 
#>                      int_maturity_shape               eff_maturity_shape_geno_1 
#>                            -10.02261060                             -3.30865726 
#>                 int_ratio_expt_maturity          eff_ratio_expt_maturity_geno_1 
#>                              1.74264178                              3.36233997 
#>          eff_ratio_expt_maturity_type_1          eff_ratio_expt_maturity_type_2 
#>                             -2.79189482                             -4.87384990 
#>                   int_expt_reproduction            eff_expt_reproduction_geno_1 
#>                             -1.79104715                             -0.89759305 
#>                               int_pontn                        eff_pontn_geno_1 
#>                             -2.96400432                             -1.03064224 
#>               int_increase_death_hazard        eff_increase_death_hazard_geno_1 
#>                              3.32326622                              2.18470307 
#>        eff_increase_death_hazard_type_1        eff_increase_death_hazard_type_2 
#>                             -0.38970742                             -3.84713473 
#> eff_increase_death_hazard_type_1:geno_1 eff_increase_death_hazard_type_2:geno_1 
#>                             -1.13985166                             -3.69784224 
#>                  int_tof_reduction_date           eff_tof_reduction_date_geno_1 
#>                             -1.27913674                             -3.51198283 
#>            int_increase_tof_n_offspring     eff_increase_tof_n_offspring_geno_1 
#>                              0.24026695                             -0.32428130 
#>                 int_lin_decrease_hazard          eff_lin_decrease_hazard_geno_1 
#>                              0.81074061                              0.19505972 
#>          eff_lin_decrease_hazard_type_1          eff_lin_decrease_hazard_type_2 
#>                              5.50927699                             -0.85842716 
#>   eff_lin_decrease_hazard_type_1:geno_1   eff_lin_decrease_hazard_type_2:geno_1 
#>                              3.98397092                              0.69812447 
#>                     int_quad_senescence              eff_quad_senescence_geno_1 
#>                             -0.49711337                              0.47173154 
#>                int_quad_decrease_hazard         eff_quad_decrease_hazard_geno_1 
#>                             -0.07370047                             -0.14027753 
#>             int_quad_change_n_offspring      eff_quad_change_n_offspring_geno_1 
#>                              0.07862816                              0.00640363 
#>                     int_tof_n_offspring 
#>                             -0.21320110 
library(lifelihood)
library(tidyverse)

df <- lifelihood::fakesample |>
  mutate(
    type = as.factor(type),
    geno = as.factor(geno)
  )

clutchs <- c(
  "clutch_start1", "clutch_end1", "clutch_size1",
  "clutch_start2", "clutch_end2", "clutch_size2"
)

dataLFH <- lifelihoodData(
  df = df,
  sex = "sex",
  sex_start = "sex_start",
  sex_end = "sex_end",
  maturity_start = "mat_start",
  maturity_end = "mat_end",
  clutchs = clutchs,
  death_start = "death_start",
  death_end = "death_end",
  covariates = c("geno", "type"),
  model_specs = c("gam", "lgn", "wei")
)

results <- lifelihood(
  lifelihoodData = dataLFH,
  path_config = get_config_path("config"),
  seeds = c(1, 2, 3, 4),
  raise_estimation_warning = FALSE
)

coeff(results, "expt_death")
#>        int_expt_death eff_expt_death_geno_1 eff_expt_death_type_1 
#>           -14.9533770             2.2706453            -9.5537176 
#> eff_expt_death_type_2 
#>             0.5331565