drawlatentOR1 {bqror} | R Documentation |
Samples latent variable z in the OR1 model
Description
This function samples the latent variable z from a univariate truncated normal distribution in the OR1 model (ordinal quantile model with 3 or more outcomes).
Usage
drawlatentOR1(y, x, beta, w, theta, tau2, delta)
Arguments
y |
observed ordinal outcomes, column vector of size |
x |
covariate matrix of size |
beta |
Gibbs draw of |
w |
latent weights, column vector of size |
theta |
(1-2p)/(p(1-p)). |
tau2 |
2/(p(1-p)). |
delta |
column vector of cutpoints including (-Inf, Inf). |
Details
This function samples the latent variable z from a univariate truncated normal distribution.
Value
latent variable z of size (n x 1)
sampled from a univariate truncated distribution.
References
Albert, J., and Chib, S. (1993). '"Bayesian Analysis of Binary and Polychotomous Response Data."' Journal of the American Statistical Association, 88(422): 669'-'679. DOI: 10.1080/01621459.1993.10476321
Robert, C. P. (1995). '"Simulation of truncated normal variables."' Statistics and Computing, 5: 121'-'125. DOI: 10.1007/BF00143942
See Also
Gibbs sampling, truncated normal distribution, rtruncnorm
Examples
set.seed(101)
data("data25j4")
y <- data25j4$y
xMat <- data25j4$x
p <- 0.25
beta <- c(0.3990094, 0.8168991, 2.8034963)
w <- 1.114347
theta <- 2.666667
tau2 <- 10.66667
delta <- c(-0.002570995, 1.044481071)
output <- drawlatentOR1(y, xMat, beta, w, theta, tau2, delta)
# output
# 0.6261896 3.129285 2.659578 8.680291
# 13.22584 2.545938 1.507739 2.167358
# 15.03059 -3.963201 9.237466 -1.813652
# 2.718623 -3.515609 8.352259 -0.3880043
# -0.8917078 12.81702 -0.2009296 1.069133 ... soon