This commit is contained in:
agdamsbo 2018-10-22 14:05:19 +02:00
parent 9648fe69f3
commit 46328c1f13
3 changed files with 25 additions and 7 deletions

View File

@ -1,7 +1,7 @@
Package: daDoctoR
Type: Package
Title: FUNCTIONS FOR HEALTH RESEARCH
Version: 0.1.0.9011
Version: 0.1.0.9012
Author@R: c(person("Andreas", "Gammelgaard Damsbo", email = "agdamsbo@pm.me", role = c("cre", "aut")))
Maintainer: Andreas Gammelgaard Damsbo <agdamsbo@pm.me>
Description: I am a Danish medical doctor involved in neuropsychiatric research.

View File

@ -1,24 +1,40 @@
#' A repeated epi.tests function
#'
#' Repeats the epi.tests from the epiR package.
#' Repeats the epi.tests from the epiR package. Either gs or test should be of length 1.
#' @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 gold the test or meassure used as "golden standard". Format as dichotomised factor.
#' @param test possible predictive tests to evaluate. Format as dichotomised factor.
#' @param data dataframe to draw variables from.
#' @keywords ppv npv sensitivity specificity
#' @export
#' @examples
#' rep_epi_tests()
rep_epi_tests<-function(gs,test){
rep_epi_tests<-function(gold,test,data){
require(epiR)
d<-data
test<-d[,c(test)]
gs<-d[,c(gold)]
ls<-list()
if (length(gold)==1){
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)
}}
else {
for (i in 1:ncol(gs)){
t<-table(test,gs[,i])
rval <- epi.gss(t, conf.level = 0.95)
n<-names(gs)[i]
ls[[i]]<-list(n,rval)
}
}
return(ls)
}

View File

@ -4,18 +4,20 @@
\alias{rep_epi_tests}
\title{A repeated epi.tests function}
\usage{
rep_epi_tests(gs, test)
rep_epi_tests(gold, test, data)
}
\arguments{
\item{gs}{the test or meassure used as "golden standard". Format as dichotomised factor.}
\item{gold}{the test or meassure used as "golden standard". Format as dichotomised factor.}
\item{test}{possible predictive tests to evaluate. Format as dichotomised factor.}
\item{data}{dataframe to draw variables from.}
}
\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.
Repeats the epi.tests from the epiR package. Either gs or test should be of length 1.
}
\examples{
rep_epi_tests()