apply inverse-link functions to parameter vector or list based on names

invlink_trans(p, unknown_link = "ignore", links = c("log", "log10", "logit"))

Arguments

p

a named vector or list of parameter values with names of the form linkfun_name

unknown_link

action to take when unknown link is specified (ignored)

links

allowed link prefixes

Examples

invlink_trans(c(log_p1=0,logit_p2=0))
#>  p1  p2 
#> 1.0 0.5 
invlink_trans(list(log_p1=c(0,0),logit_p2=c(0,0,0)))
#> $p1
#> [1] 1 1
#> 
#> $p2
#> [1] 0.5 0.5 0.5
#> 
invlink_trans(list(p1=c(log_a=0,log_b=0),p2=4))
#> $p1
#> a b 
#> 1 1 
#> 
#> $p2
#> [1] 4
#> 
tst <- list(params = c(log_beta0 = 0.693147180559945), log_nb_disp = 4.60517018598809)
invlink_trans(tst)
#> $params
#> beta0 
#>     2 
#> 
#> $nb_disp
#> [1] 100
#> 
tst2 <- list(params=c(log_E0=1,log_beta0=1),log_nb_disp=c(H=0,report=0,death=0))
invlink_trans(tst2)
#> $params
#>       E0    beta0 
#> 2.718282 2.718282 
#> 
#> $nb_disp
#>      H report  death 
#>      1      1      1 
#> 
invlink_trans(list(time_beta=1,log_time_beta=0))  ## ignore non-link prefixes
#> $time_beta
#> [1] 1
#> 
#> $time_beta
#> [1] 1
#> 
invlink_trans(list(time_beta=c(2,3),log_time_beta=c(a=0,b=0)))  ##
#> $time_beta
#> [1] 2 3
#> 
#> $time_beta
#> a b 
#> 1 1 
#>