2018-10-02 21:19:32 +02:00
#' A repeated function for bivariate analyses
2018-10-02 21:07:43 +02:00
#'
#' For bivariate analyses, for gating by p-value or change-in-estimate.
#' @param y Effect meassure.
#' @param v1 Main variable in model
2018-10-02 21:19:32 +02:00
#' @param string String of columnnames to include. Obtained with dput(). Input as c().
#' @param data dataframe of data to analyse
2018-10-03 08:40:14 +02:00
#' @param method method of gating analysis. Can be "pval" for a simple analysis of p-values below or equal to 0.1 or "cie" for change in estimate to asses the change of the estimate when a second variable is added to the model.
2018-10-03 08:42:37 +02:00
#' @param logistic flag for logistic binomial regression or not (linear is then selected).
2018-10-02 21:07:43 +02:00
#' @keywords logistic regression
#' @export
rep_biv <- function ( y , v1 , string , data , method = " pval" , logistic = FALSE , ci = FALSE , cut = 0.1 , v2 = NULL , v3 = NULL ) {
2018-10-03 10:25:32 +02:00
require ( daDoctoR )
2018-10-03 09:53:51 +02:00
a <- y
b <- v1
s <- string
dat <- data
me <- method
log <- logistic
CI <- ci
ct <- cut
2018-10-02 21:19:32 +02:00
2018-10-03 09:53:51 +02:00
if ( me == " pval" & log == FALSE ) {
daDoctoR :: rep_lm ( y = a , v1 = b , string = s , data = dat , ci = CI )
2018-10-02 21:07:43 +02:00
}
2018-10-03 09:53:51 +02:00
if ( me == " pval" & log == TRUE ) {
daDoctoR :: rep_lm ( y = a , v1 = b , string = s , data = dat , ci = CI )
2018-10-02 21:07:43 +02:00
}
if ( method == " cie" ) {
2018-10-03 09:53:51 +02:00
daDoctoR :: cie_test ( y = a , v1 = b , string = s , data = dat , logistic = log , cut = ct )
2018-10-02 21:07:43 +02:00
}
2018-10-03 10:32:10 +02:00
return ( result )
2018-10-02 21:07:43 +02:00
}