Fit a systematic error model

fitSystematicErrorModel(
logRr,
seLogRr,
trueLogRr,
estimateCovarianceMatrix = FALSE,
legacy = FALSE
)

## Arguments

logRr A numeric vector of effect estimates on the log scale. The standard error of the log of the effect estimates. Hint: often the standard error = (log() - log())/qnorm(0.025). A vector of the true effect sizes. Should a covariance matrix be computed? If so, confidence intervals for the model parameters will be available. If true, a legacy error model will be fitted, meaning standard deviation is linear on the log scale. If false, standard deviation is assumed to be simply linear.

## Value

An object of type systematicErrorModel.

## Details

Fit a model of the systematic error as a function of true effect size. This model is an extension of the method for fitting the null distribution. The mean and log(standard deviations) of the error distributions are assumed to be linear with respect to the true effect size, and each component is therefore represented by an intercept and a slope.

## Examples

controls <- simulateControls(n = 50 * 3, mean = 0.25, sd = 0.25, trueLogRr = log(c(1, 2, 4)))
model <- fitSystematicErrorModel(controls$logRr, controls$seLogRr, controls\$trueLogRr)
model#> meanIntercept     meanSlope   sdIntercept       sdSlope
#>   0.255355383   1.017296096   0.244055061  -0.006022851
#> attr(,"class")
#> [1] "systematicErrorModel"