Skip to contents

Used to specify marginal distributions for covariates when adding integration points. Similar to multinma's distr() function.

Usage

distr(qfun, ...)

Arguments

qfun

Inverse CDF function (e.g., qnorm, qgamma)

...

Parameters of the distribution

Value

A list with class "distr" containing the distribution specification

Examples

# Normal distribution with mean 0 and sd 1
distr(qnorm, mean = 0, sd = 1)
#> $qfun
#> function (p, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE) 
#> .Call(C_qnorm, p, mean, sd, lower.tail, log.p)
#> <bytecode: 0x557bf504df60>
#> <environment: namespace:stats>
#> 
#> $args
#> <list_of<quosure>>
#> 
#> $mean
#> <quosure>
#> expr: ^0
#> env:  empty
#> 
#> $sd
#> <quosure>
#> expr: ^1
#> env:  empty
#> 
#> 
#> $qfun_name
#> [1] "qnorm"
#> 
#> attr(,"class")
#> [1] "distr"

# Bernoulli distribution with probability 0.3
distr(qbern, prob = 0.3)
#> $qfun
#> function (p, prob, lower.tail = TRUE, log.p = FALSE) 
#> {
#>     qbinom(p, size = 1, prob = prob, lower.tail = lower.tail, 
#>         log.p = log.p)
#> }
#> <bytecode: 0x557bf5a32c68>
#> <environment: namespace:mlumr>
#> 
#> $args
#> <list_of<quosure>>
#> 
#> $prob
#> <quosure>
#> expr: ^0.3
#> env:  empty
#> 
#> 
#> $qfun_name
#> [1] "qbern"
#> 
#> attr(,"class")
#> [1] "distr"