new function

This commit is contained in:
agdamsbo 2018-10-04 16:52:09 +02:00
parent 6ff5011fd3
commit 8be45013f1
4 changed files with 54 additions and 1 deletions

View File

@ -7,7 +7,9 @@ Description: Tools for Danish health research. A collection of
functions to ease my work. I'll try to keep it updated for functions to ease my work. I'll try to keep it updated for
others to use as well. others to use as well.
Depends: R (>= 3.4.4) Depends: R (>= 3.4.4)
Imports: broom Imports: broom,
dplyr,
epiR
License: GPL (>= 2) License: GPL (>= 2)
Encoding: UTF-8 Encoding: UTF-8
LazyData: true LazyData: true

View File

@ -12,5 +12,6 @@ export(hwe_allele)
export(hwe_geno) export(hwe_geno)
export(hwe_sum) export(hwe_sum)
export(rep_biv) export(rep_biv)
export(rep_epi_tests)
export(rep_glm) export(rep_glm)
export(rep_lm) export(rep_lm)

24
R/rep_epi_tests.R Normal file
View File

@ -0,0 +1,24 @@
#' A repeated epi.tests function
#'
#' Repeats the epi.tests from the epiR package.
#' @description For bivariate analyses. The confint() function is rather slow, causing the whole function to hang when including many predictors and calculating the ORs with CI.
#' @param gs the test or meassure used as "golden standard". Format as dichotomised factor.
#' @param test possible predictive tests to evaluate. Format as dichotomised factor.
#' @keywords ppv npv sensitivity specificity
#' @export
#' @examples
#' rep_epi_tests()
rep_epi_tests<-function(gs,test){
require(epiR)
ls<-list()
for (i in 1:ncol(test)){
t<-table(test[,i],gs)
rval <- epi.tests(t, conf.level = 0.95)
n<-names(test)[i]
ls[[i]]<-list(n,rval)
}
return(ls)
}

26
man/rep_epi_tests.Rd Normal file
View File

@ -0,0 +1,26 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rep_epi_tests.R
\name{rep_epi_tests}
\alias{rep_epi_tests}
\title{A repeated epi.tests function}
\usage{
rep_epi_tests(gs, test)
}
\arguments{
\item{gs}{the test or meassure used as "golden standard". Format as dichotomised factor.}
\item{test}{possible predictive tests to evaluate. Format as dichotomised factor.}
}
\description{
For bivariate analyses. The confint() function is rather slow, causing the whole function to hang when including many predictors and calculating the ORs with CI.
}
\details{
Repeats the epi.tests from the epiR package.
}
\examples{
rep_epi_tests()
}
\keyword{npv}
\keyword{ppv}
\keyword{sensitivity}
\keyword{specificity}