-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated pcurve function to work with data session key instead of data…
… name
- Loading branch information
Showing
1 changed file
with
37 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,37 @@ | ||
#' @title Plot pcurve | ||
#' @description | ||
#' Using the R package meta to calculate a random effects meta-analysis based on estimates (e.g. log hazard ratios) and their standard errors. Afterwards using dmetar package to create a pcurve plot. | ||
#' @param yi | ||
#' A \code{string} of the variable which holds the vector of length k with the observed effect sizes or outcomes in the selected dataset (d) | ||
#' @param vi | ||
#' A \code{string} of the variable which holds the vector of length k with the corresponding sampling variances in the selected dataset (d) | ||
#' @param d | ||
#' A \code{string} representing the dataset name that should be used for fitting. | ||
#' @param measure | ||
#' A character string indicating underlying summary measure | ||
#' @return returns a pcurve plot | ||
#' @author Robert Studtrucker | ||
#' @export | ||
pcurves<-function(yi,vi,measure,d) { | ||
|
||
requireNamespace("dmetar") | ||
requireNamespace("meta") | ||
|
||
|
||
#load the in variable d defined dataset from the package | ||
dat <- checkData(d) | ||
checkParameter(dat,c(yi,vi)) | ||
|
||
#Filtern auf nur peer reviewed arcticles | ||
dat<-dat[dat$r_peer=="yes",] | ||
|
||
# meta-Model | ||
overall.meta <- meta::metagen(TE=dat[,yi], seTE=sqrt(dat[,vi]),data = dat, studlab = paste(r_author), | ||
comb.fixed = FALSE,comb.random = TRUE,method.tau = "SJ", | ||
hakn = TRUE,prediction = TRUE,sm = measure) | ||
|
||
# p-curve | ||
dmetar::pcurve(overall.meta) | ||
|
||
} | ||
#' @title Plot pcurve | ||
#' @description | ||
#' Using the R package meta to calculate a random effects meta-analysis based on estimates (e.g. log hazard ratios) and their standard errors. Afterwards using dmetar package to create a pcurve plot. | ||
#' @param yi | ||
#' A \code{string} of the variable which holds the vector of length k with the observed effect sizes or outcomes in the selected dataset (d) | ||
#' @param vi | ||
#' A \code{string} of the variable which holds the vector of length k with the corresponding sampling variances in the selected dataset (d) | ||
#' @param d | ||
#' A \code{string} representing the dataset name that should be used for fitting. | ||
#' @param measure | ||
#' A character string indicating underlying summary measure | ||
#' @return returns a pcurve plot | ||
#' @author Robert Studtrucker | ||
#' @export | ||
pcurves<-function(yi,vi,measure,d) { | ||
|
||
requireNamespace("dmetar") | ||
requireNamespace("meta") | ||
|
||
|
||
#load the in variable d defined dataset from the package | ||
#dat <- checkData(d) | ||
dat <- d | ||
checkParameter(dat,c(yi,vi)) | ||
|
||
#Filter peer reviewed articles | ||
dat<-dat[dat$r_peer=="yes",] | ||
|
||
# meta-Model | ||
overall.meta <- meta::metagen(TE=dat[,yi], seTE=sqrt(dat[,vi]),data = dat, studlab = paste(r_author), | ||
comb.fixed = FALSE,comb.random = TRUE,method.tau = "SJ", | ||
hakn = TRUE,prediction = TRUE,sm = measure) | ||
|
||
# p-curve | ||
dmetar::pcurve(overall.meta) | ||
|
||
} |