# [R-meta] Standard Error of an effect size for use in longitudinal meta-analysis

Simon Harmel @|m@h@rme| @end|ng |rom gm@||@com
Tue Aug 11 14:59:07 CEST 2020

```Dear All,

Suppose I know that the likelihood function for an estimate of effect size
(called `dppc`) measuring the change in a "*control*" group from pre-test
to post-test in R language is given by:

like1 <- function(x) dt(dppc*sqrt(nc), df = nc - 1, ncp = x*sqrt(nc))

where `dppc` is the observed estimate of effect size, and `nc` is the
"control" group's sample size.

Similarly, the likelihood function for an estimate of effect size (called `
dppt`) measuring the change in a "*treatment*" group from pre-test to
post-test in `R` language is given by:

like2 <- function(x) dt(dppt*sqrt(nt), df = nt - 1, ncp = x*sqrt(nt))

where `dppt` is the observed estimate of effect size, and `nt` is the
"treatment" group's sample size.

>>>"Question:" Is there any way to find the "Standard Error (SE)" of the
`d_dif = dppt - dppc` (in `R`)?

Below, I tried to first get the likelihood function of `d_dif` and then get
the *Standard Deviation* of that likelihood function. In a sense, I assumed
I have a Bayesian problem with a "flat prior" and thus "SE" is the standard
deviation of the likelihood of `d_dif`.

>>> But I am not sure if my work below is at least approximately correct?
-- Thank you, Simon

library(distr)

d_dif <- Vectorize(function(dppc, dppt, nc, nt){

like1 <- function(x) dt(dppc*sqrt(nc), df = nc - 1, ncp = x*sqrt(nc))
like2 <- function(x) dt(dppt*sqrt(nt), df = nt - 1, ncp = x*sqrt(nt))

d1 <- distr::AbscontDistribution(d = like1, low1 = -15, up1 = 15,
withStand = TRUE)
d2 <- distr::AbscontDistribution(d = like2, low1 = -15, up1 = 15,
withStand = TRUE)

like.dif <- function(x) distr::d(d2 - d1)(x) ## Gives likelihood of
the difference i.e., `d_dif`

Mean <- integrate(function(x) x*like.dif(x), -Inf, Inf)[[1]]
SE <- sqrt(integrate(function(x) x^2*like.dif(x), -Inf, Inf)[[1]] -
Mean^2)

return(c(SE = SE))
})

# EXAMPLE OF USE:
d_dif(dppc = .2, dppt = .4, nc = 40, nt = 40)

[[alternative HTML version deleted]]

```