#Specifying a multivariate independent uniform prior
rmviu <- function(n,a,b){
return(mapply(FUN = function(min.vec,max.vec,pn){stats::runif(pn,a,b)},
min.vec=a,max.vec=b,MoreArgs = list(pn = n)))
}
dmviu <- function(x,a,b){
for(ii in 1:ncol(x)){
x[,ii] <- dunif(x[,ii],a[ii],b[ii])
}
return(apply(x,1,prod))
}
UNCOVER.opts(prior.override = TRUE,rprior = rmviu,
dprior = dmviu,a=rep(0,3),b=rep(1,3))
# \donttest{
# If we generate a co-variate matrix and binary response vector
CM <- matrix(rnorm(200),100,2)
rv <- sample(0:1,100,replace=TRUE)
# We can then run our algorithm with a SMC threshold of 50 and a SMC cache
# checking threshold of 25 to see if this is quicker than the standard
# version
system.time(UNCOVER(X = CM,y = rv,verbose = FALSE))
system.time(UNCOVER(X = CM,y = rv,
options = UNCOVER.opts(SMC_thres = 50),
verbose = FALSE))
system.time(UNCOVER(X = CM,y = rv,
options = UNCOVER.opts(SMC_thres = 50,
SMC_memo_thres = 25),
verbose = FALSE))
# }
Run the code above in your browser using DataLab