The asymptotic variance of trimmed mean of a normal(0,1) distribution:

pi=22/7
f1=function(y){(1/sqrt(2*pi))*exp((-y^2)/2)}

We will calculate trimmed mean for different values of \(\alpha\) and check how the asymptotic variance is changing wrt \(\alpha\).

alpha=seq(0.01,0.9,0.001)

Now we will calculate \[F^{-1}(1-\alpha)\]

uplim1=array(dim=1)
for(i in 1:length(alpha)) {
  
uplim1[i]=qnorm(1-alpha[i])
}

we have to calculate G(\(\alpha\))=\[\int_{0}^{F^{-1}(1-\alpha)} t^2f(t)\,dt\]

h1=function(y){y^2*exp((-y^2)/2)*(1/sqrt(2*pi))}
G1=array(dim=1)
for(i in 1:length(alpha)) {
  G1[i]=integrate(h1,lower=0,upper=uplim1[i])
}

Now we have to calculate the Asymptotic variance of trimmed mean \(\sigma^{2}(\alpha)\) =\[2[G(\alpha)+\alpha{(F^{-1}(1-\alpha)})^{2}]/(1-2\alpha)^{2}\]

Sigma1=array(dim=1)
for(i in 1:length(alpha)) {
  Sigma1[i]=2*as.numeric(G1[i])+as.numeric(alpha[i])*as.numeric((uplim1[i]*uplim1[i]))/(1-2*as.numeric(alpha[i])^2)
  
  
}

now we will plot the \(\sigma^{2}(\alpha)\) vs \(\alpha\)

plot(alpha[1:70],Sigma1[1:70],main=" Av of Normal Trimmed mean vs alpha plot",  col='blue',xlab="Alpha",ylab="A.V")

Comment: The normal TM Asymptotic variance decreases as \(\alpha\) increases from 0 to 1.

Double exponential distribution The pdf of double exponential distribution is

\(f_1(y)\) = \[\frac{1} 2e^{-|y|}\] we find the asymptotic variance of double exponential distribution. The procedure will be same as before.

f2=function(y){
  z=exp(-abs(y))/2
  return(z)
}

the quantile function of double exponential will be found in nimble package

uplim2=array(dim=1)
library(nimble)
for(i in 1:length(alpha)) {
  
  uplim2[i]=qdexp(1-alpha[i])
}
h2=function(y){y^2*(exp(-abs(y))/2)}
G2=array(dim=1)
for(i in 1:length(alpha)) {
  G2[i]=integrate(h2,lower=0,upper=uplim2[i])
}

Asymptotic variance of Double exponential distribution

Sigma2=array(dim=1)
for(i in 1:length(alpha)) {
  Sigma2[i]=2*as.numeric(G2[i])+as.numeric(alpha[i])*as.numeric((uplim2[i]*uplim2[i]))/(1-2*as.numeric(alpha[i])^2)
  
  
}

Plotting of asymptotic variance

plot(alpha[1:70],Sigma2[1:70],main=" AV of Double Exponential trimmed mean vs alpha plot",col='blue',xlab="Alpha",ylab="A.V")

Comment: The asymptotic variance decreases when \(\alpha\) increases.For double exponential(0,1) distribution AV decreases faster than N(0,1) Distribution.

Cauchy distribution:

The pdf of cauchy distribution is \(f_3(y)\)=\[\frac{1}{\pi(1+y^{2})}\]

f3=function(y){
  z=1/(pi*(1+y^2))
  return(z)
}
uplim3=array(dim=1)

for(i in 1:length(alpha)) {
  
  uplim3[i]=qcauchy(1-alpha[i])
}
h3=function(y){y^2*(1/(pi*(1+y^2)))}
G3=array(dim=1)
for(i in 1:length(alpha)) {
  G3[i]=integrate(h3,lower=0,upper=uplim3[i])
}
Sigma3=array(dim=1)
for(i in 1:length(alpha)) {
  Sigma3[i]=2*as.numeric(G3[i])+as.numeric(alpha[i])*as.numeric((uplim3[i]*uplim3[i]))/(1-2*as.numeric(alpha[i])^2)
  
  
}

Plotting

plot(alpha[1:70],Sigma3[1:70],main=" AV of Cauchy Trimmed mean  vs alpha plot",col='blue',xlab="Alpha",ylab="A.V")

Comment: when \(\alpha\) increases The asymptotic variance decreases faster than Normal or Double exponential distribution