R/get.obs.type.R

Defines functions get.obs.type

Documented in get.obs.type

##' Tries to guess the observation types (SIC, DIC, or exact).
##'
##' @param dat a matrix of data, similar to what needs to be passed to \code{dic.fit()}.
##' @return vector of guessed types
##' @export
get.obs.type <- function(dat) {
        type <- rep(0, nrow(dat))
        ## get the single interval censored
        type[dat[,"EL"]==dat[,"ER"]]<-1
        type[dat[,"SL"]==dat[,"SR"]]<-1
        type[dat[,"ER"]>=dat[,"SL"]]<-1

        ## some of those are actually exact!
        type[(dat[,"EL"]==dat[,"ER"]) & (dat[,"SL"]==dat[,"SR"])]<- 2
        return(type)
}

Try the coarseDataTools package in your browser

Any scripts or data that you put into this service are public.

coarseDataTools documentation built on May 29, 2017, 8:38 p.m.