Skip to main content
deleted 54 characters in body
Source Link
Jarle Tufto
  • 13.2k
  • 2
  • 40
  • 60

This is just a comment to the other excellent answer by Damian Pavlyshyn noting that when $|\bar x|$ is too small, the confidence set defined by $\{|\mu|:P_{|\mu|}(|\bar X|\le |\bar x|)\le 1-\alpha\}$ will include 0 since the left hand side of $$ \Phi\left(\frac{\bar x-|\mu|}{\sigma/\sqrt{n}}\right)-\Phi\left(\frac{-\bar x-|\mu|}{\sigma/\sqrt{n}}\right)=1-\alpha, $$$$ \Phi\left(\frac{|\bar x|-|\mu|}{\sigma/\sqrt{n}}\right)-\Phi\left(\frac{-|\bar x|-|\mu|}{\sigma/\sqrt{n}}\right), $$ being the probability that $\bar X$ falls between $-\bar x$ and $\bar x$, will then always be smaller than $1-\alpha$. The result of this is that Still, the real coverage will be somewhat greater thanappears to match the nominal level whenof $|\mu|$ is small$1-\alpha$ as shown inindicated by the following simulation:.

pfoldnorm <- function(x, mu, sigma) {
  pnorm((x-mu)/sigma) - pnorm((-x-mu)/sigma)
}
lowerbound <- function(x, alpha=0.05) {
  n <- length(x)
  xbarabsxbar <- abs(mean(x))
  f <- function(mu) {
    pfoldnorm(xbarabsxbar, mu, 1/sqrt(n)) - 1 + alpha
  }
  if (f(0)<=0) 
    return(0)
  else
    uniroot(f, c(0, 100))$root
}
coverage <- NULL
mu <- seq(0, 2, by=.1)
for (i in seq_along(mu)) {
  hits <- replicate(1e+5,{
    x <- rnorm(1, mu[i])
    l <- lowerbound(x, .05)
    l <= abs(mu[i])
  })
  coverage[i] <- mean(hits)
}
plot(mu, coverage)
abline(h=.95, col="green")

Created on 2025-11-01 with reprex v2.1.1

This is just a comment to the other excellent answer by Damian Pavlyshyn noting that when $|\bar x|$ is too small, the confidence set defined by $\{|\mu|:P_{|\mu|}(|\bar X|\le |\bar x|)\le 1-\alpha\}$ will include 0 since the left hand side of $$ \Phi\left(\frac{\bar x-|\mu|}{\sigma/\sqrt{n}}\right)-\Phi\left(\frac{-\bar x-|\mu|}{\sigma/\sqrt{n}}\right)=1-\alpha, $$ being the probability that $\bar X$ falls between $-\bar x$ and $\bar x$, will then always be smaller than $1-\alpha$. The result of this is that the real coverage will be somewhat greater than the nominal level when $|\mu|$ is small as shown in the following simulation:

pfoldnorm <- function(x, mu, sigma) {
  pnorm((x-mu)/sigma) - pnorm((-x-mu)/sigma)
}
lowerbound <- function(x, alpha=0.05) {
  n <- length(x)
  xbar <- mean(x)
  f <- function(mu) {
    pfoldnorm(xbar, mu, 1/sqrt(n)) - 1 + alpha
  }
  if (f(0)<=0) 
    return(0)
  else
    uniroot(f, c(0, 100))$root
}
coverage <- NULL
mu <- seq(0, 2, by=.1)
for (i in seq_along(mu)) {
  hits <- replicate(1e+5,{
    x <- rnorm(1, mu[i])
    l <- lowerbound(x, .05)
    l <= abs(mu[i])
  })
  coverage[i] <- mean(hits)
}
plot(mu, coverage)
abline(h=.95, col="green")

Created on 2025-11-01 with reprex v2.1.1

This is just a comment to the other excellent answer by Damian Pavlyshyn noting that when $|\bar x|$ is too small, the confidence set defined by $\{|\mu|:P_{|\mu|}(|\bar X|\le |\bar x|)\le 1-\alpha\}$ will include 0 since $$ \Phi\left(\frac{|\bar x|-|\mu|}{\sigma/\sqrt{n}}\right)-\Phi\left(\frac{-|\bar x|-|\mu|}{\sigma/\sqrt{n}}\right), $$ being the probability that $\bar X$ falls between $-\bar x$ and $\bar x$, will then always be smaller than $1-\alpha$. Still, the coverage appears to match the nominal level of $1-\alpha$ as indicated by the following simulation.

pfoldnorm <- function(x, mu, sigma) {
  pnorm((x-mu)/sigma) - pnorm((-x-mu)/sigma)
}
lowerbound <- function(x, alpha=0.05) {
  n <- length(x)
  absxbar <- abs(mean(x))
  f <- function(mu) {
    pfoldnorm(absxbar, mu, 1/sqrt(n)) - 1 + alpha
  }
  if (f(0)<=0) 
    return(0)
  else
    uniroot(f, c(0, 100))$root
}
coverage <- NULL
mu <- seq(0, 2, by=.1)
for (i in seq_along(mu)) {
  hits <- replicate(1e+5,{
    x <- rnorm(1, mu[i])
    l <- lowerbound(x, .05)
    l <= abs(mu[i])
  })
  coverage[i] <- mean(hits)
}
plot(mu, coverage)
abline(h=.95, col="green")

Created on 2025-11-01 with reprex v2.1.1

added 22 characters in body
Source Link
User1865345
  • 12k
  • 13
  • 27
  • 42

This is just a comment to the other excellent answer by Damian Pavlyshyn noting that when $|\bar x|$ is too small, the confidence set defined by $\{|\mu|:P_{|\mu|}(|\bar X|\le |\bar x|)\le 1-\alpha\}$ will include 0 since the left hand side of $$ \Phi(\frac{\bar x-|\mu|}{\sigma/\sqrt{n}})-\Phi(\frac{-\bar x-|\mu|}{\sigma/\sqrt{n}})=1-\alpha, $$$$ \Phi\left(\frac{\bar x-|\mu|}{\sigma/\sqrt{n}}\right)-\Phi\left(\frac{-\bar x-|\mu|}{\sigma/\sqrt{n}}\right)=1-\alpha, $$ being the probability that $\bar X$ falls between $-\bar x$ and $\bar x$, will then always be smaller than $1-\alpha$. The result of this is that the real coverage will be somewhat greater than the nominal level when $|\mu|$ is small as shown in the following simulation:

pfoldnorm <- function(x, mu, sigma) {
  pnorm((x-mu)/sigma) - pnorm((-x-mu)/sigma)
}
lowerbound <- function(x, alpha=0.05) {
  n <- length(x)
  xbar <- mean(x)
  f <- function(mu) {
    pfoldnorm(xbar, mu, 1/sqrt(n)) - 1 + alpha
  }
  if (f(0)<=0) 
    return(0)
  else
    uniroot(f, c(0, 100))$root
}
coverage <- NULL
mu <- seq(0, 2, by=.1)
for (i in seq_along(mu)) {
  hits <- replicate(1e+5,{
    x <- rnorm(1, mu[i])
    l <- lowerbound(x, .05)
    l <= abs(mu[i])
  })
  coverage[i] <- mean(hits)
}
plot(mu, coverage)
abline(h=.95, col="green")

Created on 2025-11-01 with reprex v2.1.1

This is just a comment to the other excellent answer by Damian Pavlyshyn noting that when $|\bar x|$ is too small, the confidence set defined by $\{|\mu|:P_{|\mu|}(|\bar X|\le |\bar x|)\le 1-\alpha\}$ will include 0 since the left hand side of $$ \Phi(\frac{\bar x-|\mu|}{\sigma/\sqrt{n}})-\Phi(\frac{-\bar x-|\mu|}{\sigma/\sqrt{n}})=1-\alpha, $$ being the probability that $\bar X$ falls between $-\bar x$ and $\bar x$, will then always be smaller than $1-\alpha$. The result of this is that the real coverage will be somewhat greater than the nominal level when $|\mu|$ is small as shown in the following simulation:

pfoldnorm <- function(x, mu, sigma) {
  pnorm((x-mu)/sigma) - pnorm((-x-mu)/sigma)
}
lowerbound <- function(x, alpha=0.05) {
  n <- length(x)
  xbar <- mean(x)
  f <- function(mu) {
    pfoldnorm(xbar, mu, 1/sqrt(n)) - 1 + alpha
  }
  if (f(0)<=0) 
    return(0)
  else
    uniroot(f, c(0, 100))$root
}
coverage <- NULL
mu <- seq(0, 2, by=.1)
for (i in seq_along(mu)) {
  hits <- replicate(1e+5,{
    x <- rnorm(1, mu[i])
    l <- lowerbound(x, .05)
    l <= abs(mu[i])
  })
  coverage[i] <- mean(hits)
}
plot(mu, coverage)
abline(h=.95, col="green")

Created on 2025-11-01 with reprex v2.1.1

This is just a comment to the other excellent answer by Damian Pavlyshyn noting that when $|\bar x|$ is too small, the confidence set defined by $\{|\mu|:P_{|\mu|}(|\bar X|\le |\bar x|)\le 1-\alpha\}$ will include 0 since the left hand side of $$ \Phi\left(\frac{\bar x-|\mu|}{\sigma/\sqrt{n}}\right)-\Phi\left(\frac{-\bar x-|\mu|}{\sigma/\sqrt{n}}\right)=1-\alpha, $$ being the probability that $\bar X$ falls between $-\bar x$ and $\bar x$, will then always be smaller than $1-\alpha$. The result of this is that the real coverage will be somewhat greater than the nominal level when $|\mu|$ is small as shown in the following simulation:

pfoldnorm <- function(x, mu, sigma) {
  pnorm((x-mu)/sigma) - pnorm((-x-mu)/sigma)
}
lowerbound <- function(x, alpha=0.05) {
  n <- length(x)
  xbar <- mean(x)
  f <- function(mu) {
    pfoldnorm(xbar, mu, 1/sqrt(n)) - 1 + alpha
  }
  if (f(0)<=0) 
    return(0)
  else
    uniroot(f, c(0, 100))$root
}
coverage <- NULL
mu <- seq(0, 2, by=.1)
for (i in seq_along(mu)) {
  hits <- replicate(1e+5,{
    x <- rnorm(1, mu[i])
    l <- lowerbound(x, .05)
    l <= abs(mu[i])
  })
  coverage[i] <- mean(hits)
}
plot(mu, coverage)
abline(h=.95, col="green")

Created on 2025-11-01 with reprex v2.1.1

Source Link
Jarle Tufto
  • 13.2k
  • 2
  • 40
  • 60

This is just a comment to the other excellent answer by Damian Pavlyshyn noting that when $|\bar x|$ is too small, the confidence set defined by $\{|\mu|:P_{|\mu|}(|\bar X|\le |\bar x|)\le 1-\alpha\}$ will include 0 since the left hand side of $$ \Phi(\frac{\bar x-|\mu|}{\sigma/\sqrt{n}})-\Phi(\frac{-\bar x-|\mu|}{\sigma/\sqrt{n}})=1-\alpha, $$ being the probability that $\bar X$ falls between $-\bar x$ and $\bar x$, will then always be smaller than $1-\alpha$. The result of this is that the real coverage will be somewhat greater than the nominal level when $|\mu|$ is small as shown in the following simulation:

pfoldnorm <- function(x, mu, sigma) {
  pnorm((x-mu)/sigma) - pnorm((-x-mu)/sigma)
}
lowerbound <- function(x, alpha=0.05) {
  n <- length(x)
  xbar <- mean(x)
  f <- function(mu) {
    pfoldnorm(xbar, mu, 1/sqrt(n)) - 1 + alpha
  }
  if (f(0)<=0) 
    return(0)
  else
    uniroot(f, c(0, 100))$root
}
coverage <- NULL
mu <- seq(0, 2, by=.1)
for (i in seq_along(mu)) {
  hits <- replicate(1e+5,{
    x <- rnorm(1, mu[i])
    l <- lowerbound(x, .05)
    l <= abs(mu[i])
  })
  coverage[i] <- mean(hits)
}
plot(mu, coverage)
abline(h=.95, col="green")

Created on 2025-11-01 with reprex v2.1.1