Skip to contents

Random Number Generator from Ordered Logit Distribution

Usage

rordlogit(phi, kappa)

Arguments

phi

Numeric. The linear term(s) to subtract from each ordered categories.

kappa

A vector of cut-points for delineating the ordered categories on the logit scale. For generating n categories, n-1 cut-points are needed. Do not include (negative) Inf values.

Examples

kappa = c( -1.5, 0, 1.5 )
rordlogit( phi=0, kappa=kappa )
#> [1] 4
x = replicate( 1e4, {rordlogit(0, kappa)})
table(x) / length(x)
#> x
#>      1      2      3      4 
#> 0.1805 0.3054 0.3236 0.1905 
logistic( c(kappa, Inf) ) - logistic( c(-Inf, kappa) )
#> [1] 0.1824255 0.3175745 0.3175745 0.1824255