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
)
#> [1] "/private/var/folders/y6/nj790rtn62lfktb1sh__79hc0000gn/T/Rtmp2lbF6M/temp_libpath1e0a2a79ba80/lifelihood/bin/lifelihood/Users/runner/work/Lifelihood/Lifelihood/lifelihood_1_2_3_4/temp_file_data_lifelihood.txt /Users/runner/work/Lifelihood/Lifelihood/lifelihood_1_2_3_4/temp_param_range_path.txt FALSE 0 25 FALSE 0 0 0 1 2 3 4 10 20 1000 0.3 NULL 2 2 50 1 1 0.001"
#> lifelihood Pascal program status code 0
coef(results)
#>                          int_expt_death                   eff_expt_death_geno_1 
#>                            -17.78869453                             -2.89709225 
#>                   eff_expt_death_type_1                   eff_expt_death_type_2 
#>                             -4.48279290                             -0.30099192 
#>                      int_survival_shape               eff_survival_shape_geno_1 
#>                              6.14904518                              2.96787660 
#>               eff_survival_shape_type_1               eff_survival_shape_type_2 
#>                              3.56630436                              3.43958754 
#>        eff_survival_shape_type_1:geno_1        eff_survival_shape_type_2:geno_1 
#>                             -9.78904370                              5.39234946 
#>                    int_ratio_expt_death             eff_ratio_expt_death_geno_1 
#>                              7.51220924                              4.47236458 
#>                          int_prob_death                   eff_prob_death_geno_1 
#>                            -19.85150681                             -4.66755544 
#>                       int_expt_maturity                eff_expt_maturity_geno_1 
#>                             -2.03877432                              1.55444499 
#>                eff_expt_maturity_type_1                eff_expt_maturity_type_2 
#>                              0.66072953                             -0.65520063 
#>                      int_maturity_shape               eff_maturity_shape_geno_1 
#>                             -6.13510368                            -12.66969959 
#>                 int_ratio_expt_maturity          eff_ratio_expt_maturity_geno_1 
#>                              9.21718291                              6.29157951 
#>          eff_ratio_expt_maturity_type_1          eff_ratio_expt_maturity_type_2 
#>                              4.82061920                             10.81747842 
#>                   int_expt_reproduction            eff_expt_reproduction_geno_1 
#>                             -4.45837175                             -5.55089666 
#>                               int_pontn                        eff_pontn_geno_1 
#>                             -7.93134379                            -16.20606070 
#>               int_increase_death_hazard        eff_increase_death_hazard_geno_1 
#>                              7.14071218                              2.06010130 
#>        eff_increase_death_hazard_type_1        eff_increase_death_hazard_type_2 
#>                              2.45327099                             -3.24686063 
#> eff_increase_death_hazard_type_1:geno_1 eff_increase_death_hazard_type_2:geno_1 
#>                              0.05537952                              0.48247027 
#>                  int_tof_reduction_date           eff_tof_reduction_date_geno_1 
#>                             -5.98084468                              4.27436871 
#>            int_increase_tof_n_offspring     eff_increase_tof_n_offspring_geno_1 
#>                              0.70052182                              7.73467571 
#>                 int_lin_decrease_hazard          eff_lin_decrease_hazard_geno_1 
#>                              2.66887494                             -2.84465302 
#>          eff_lin_decrease_hazard_type_1          eff_lin_decrease_hazard_type_2 
#>                             -2.97177934                              3.88660973 
#>   eff_lin_decrease_hazard_type_1:geno_1   eff_lin_decrease_hazard_type_2:geno_1 
#>                             -4.75747643                             -0.28970093 
#>                     int_quad_senescence              eff_quad_senescence_geno_1 
#>                              2.49832143                             -2.71133455 
#>                int_quad_decrease_hazard         eff_quad_decrease_hazard_geno_1 
#>                             -0.06403036                              0.09121032 
#>             int_quad_change_n_offspring      eff_quad_change_n_offspring_geno_1 
#>                              1.60524468                             -0.07882676 
#>                     int_tof_n_offspring 
#>                             -0.26241118 
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
)
#> [1] "/private/var/folders/y6/nj790rtn62lfktb1sh__79hc0000gn/T/Rtmp2lbF6M/temp_libpath1e0a2a79ba80/lifelihood/bin/lifelihood/Users/runner/work/Lifelihood/Lifelihood/lifelihood_1_2_3_4/temp_file_data_lifelihood.txt /Users/runner/work/Lifelihood/Lifelihood/lifelihood_1_2_3_4/temp_param_range_path.txt FALSE 0 25 FALSE 0 0 0 1 2 3 4 10 20 1000 0.3 NULL 2 2 50 1 1 0.001"
#> lifelihood Pascal program status code 0

coeff(results, "expt_death")
#>        int_expt_death eff_expt_death_geno_1 eff_expt_death_type_1 
#>           -17.7886945            -2.8970923            -4.4827929 
#> eff_expt_death_type_2 
#>            -0.3009919