| uncertainty | R Documentation |
Calculate the uncertainty (95 percent confidence interval) of risk ratio with prediction from general models based on threshold.
uncertainty(x,y,th,ref=0)
x |
A vector representing the risk factor. |
y |
A vector representing the outcome prediction probability. |
th |
Threshold for dividing the risk facot into two groups. |
ref |
Reference indicator. If 0, set the group lower than threshold as reference. Default:0 |
This is used to calculate the risk ratio, but not for odd ratio.
Uncertainty (95 percent confidence interval) of risk ratio.
Díaz-Francés, E., Rubio, F.J. On the existence of a normal approximation to the distribution of the ratio of two independent normal random variables. Stat Papers 54, 309-C323 (2013).
library(h2o)
data(iris)
attach(iris)
h2o.init()
hyper <- list(ntrees=c(2,3,5))
iris <- iris[1:100,c(5,1:4)]
idx <- sample(100,50)
traindata <- iris[idx,]
testdata <- iris[-idx,]
xcol <- names(iris)[2:5]
results <- APML(xcol=xcol,hyper=hyper,
traindata=traindata,testdata=testdata,
sort_by ='auc',distribution = 'bernoulli')
data <- as.h2o(iris)
pred<- h2o.predict(results$bestmodel,newdata=data)
data <- h2o.cbind(data,pred)
data <- as.data.frame(data)
plots <- expl_rr(data,setosa~Sepal.Length,ref = 'mean')
uncertainty(data$Sepal.Length,data$setosa,plots$threshold)
h2o.shutdown(prompt=FALSE)
Sys.sleep(2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.