Learn R Programming

DTDA (version 3.0.1)

rsim.DT: Random generation functions of doubly truncated data

Description

Random generation functions of doubly truncated data with two different patterns of observational bias.

Usage

rsim.DT(n,tau, model=NULL)

Arguments

n

number of observations to generate.

tau

length of the observational window.

model

model to be simulated. Number 1 or 2 corresponding to different patterns of observacional bias.

Value

A matrix with n unit length rows representing the generated values from a doubly truncated data with triplets \((X, U and V)\), in which \((U \leq X \leq V)\).

Details

If model=1, \(U\sim Unif(-\code{tau},1)\) and V= U+ tau. If model=2, \(U \sim Unif(0,1)^2\times (\code{tau}+1)-\code{tau}\) and V= U+ tau. In model=1 there is no observational bias due double truncation while in model=2 double truncation induces observational bias.

Examples

Run this code
# NOT RUN {
set.seed(4321)
rsim.DT(500,1/2, model=2)
# }

Run the code above in your browser using DataLab