2
$\begingroup$

I'm looking to start with an assumed true parameter $\theta$, and taking the normal distribution of the estimate $\hat{\theta}$ with mean $\theta$ and a known standard deviation (suppose it's $0.10$), and compute $E ( |\hat{\theta}|$, given $|\hat{\theta}| > 0.20)$, i.e. the expected magnitude of the estimate when selected for statistical significance. The goal is, using R, to plot this $E ( |\hat{\theta}|$, given $|\hat{\theta}| > 0.20)$ as a function of the true $\theta$.

See page 3 and the top of page 4 of the following for an example: http://www.stat.columbia.edu/~gelman/research/published/incrementalism_3.pdf

$\endgroup$

closed as unclear what you're asking by Juho Kokkala, kjetil b halvorsen, Peter Flom Dec 4 '17 at 12:50

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ You don't seem to ask any questions here. What do you want to know? $\endgroup$ – Glen_b Dec 3 '17 at 21:23
1
$\begingroup$

Here is the R function that calculates the bias (adapted from here):

bias <- function(m, sem) {

  func <- function(x, ...) {x * dnorm(x, ...)}

  ((abs(integrate(func, -Inf, -2*sem, mean=m, sd = sem)$value) + integrate(func, 2*sem, Inf, mean=m, sd = sem)$value)/
      ((pnorm(-2*sem, mean=m, sd=sem) - pnorm(-Inf, mean=m, sd=sem)) + (pnorm(Inf, mean=m, sd=sem) - pnorm(2*sem, mean=m, sd=sem)))) - m

}

Let's test it with the examples from Gelman:

sapply(c(0, 0.1, 0.25), bias, sem = 0.12)
[1] 0.28478586 0.19877756 0.08946908

Seems correct. Now let's reproduce their Figure 1:

theta <- seq(0, 0.6, length.out = 100)

b <- sapply(theta, bias, sem = 0.12)

plot(b~theta, type = "l", las = 1, ylab = "Bias", lwd = 2)
abline(h = 0)

Gelman Figure 1

Now with your values:

theta <- seq(0, 0.6, length.out = 100)

b2 <- sapply(theta, bias, sem = 0.1)

plot(b2~theta, type = "l", las = 1, col = "red", ylab = "Bias", lwd = 2, ylim = c(0, 0.3))
lines(b~theta, col  = "black", lwd = 2)
legend("topright", legend = c("Gelman", "tres14"), lwd = c(2, 2), col = c("red", "black"), bty = "n")
abline(h = 0)

Bias for both values

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.