NMST 434, Exercise session 1: Asymptotics 
February 21, 2020

Example 5: Asymptotic distribution of Pearson’s correlation coefficient

Derivation directly using a single function g: (R^5)-> R in the Δ-method.
a = (1/n)Σ (Subscript[X, i]); b = (1/n)Σ (Subscript[Y, i]); c = (1/n)Σ ((Subscript[X, i])^2); d = (1/n)Σ ((Subscript[Y, i])^2) ; e = (1/n)Σ (Subscript[X, i])(Subscript[Y, i]).
Assumption: WLOG E (Subscript[X, 1])= E (Subscript[Y, 1])=0 and Var (Subscript[X, 1])=Var (Subscript[Y, 1])=1.

Clear[μ];
g[a_,b_,c_,d_,e_]=(((e-a b))/((((c-(a^2))(d-(b^2))))^(1/2)));
Dg = D[g[a,b,c,d,e],{{a,b,c,d,e}}]/.{a->0,b->0,c->1,d->1,e->ρ}//Simplify;
MatrixForm[Dg](* gradient of g at E(a,b,c,d,e) *)
Σ={{1,ρ,μ[3,0],μ[1,2],μ[2,1]},{ρ,1,μ[2,1],μ[0,3],μ[1,2]},{μ[3,0],μ[2,1],μ[4,0]-1,μ[2,2]-1,μ[3,1]-μ[1,1]},{μ[1,2],μ[0,3],μ[2,2]-1,μ[0,4]-1,μ[1,3]-μ[1,1]},{μ[2,1],μ[1,2],μ[3,1]-μ[1,1],μ[1,3]-μ[1,1],μ[2,2]-((μ[1,1])^2)}}; (* original variance matrix, μ[i,j] is a way of writing the expectation E ((X^i)(Y^j)) *)
MatrixForm[Σ]
Dg . Σ . Dg//Simplify(* asymptotic variance of (OverHat[ρ]) *)
Dg . Σ . Dg/.ρ->0 (* asymptotic variance under independence *)

Under normality

μ[i_,j_]=Moment[MultinormalDistribution[{0,0},{{1,ρ },{ρ , 1}}],{i,j}];
Dg . Σ . Dg/.{a->0,b->0,c->1,d->1,e->ρ}//Simplify (* asymptotic variance of (OverHat[ρ]) *)

Example 7:Asymptotic distribution of (OverHat[θ]) in MA(1) process

The direct approach.
* not done at the exercise session - run the script yourself.

$Assumptions=-1<θ <1;
Solve[(θ/(1+(θ^2)))==t,θ]//Simplify
g[t_]=((1-√(1-4 (t^2)))/(2 t));
D[g[t],t]//Simplify
Plot[%,{t,-1,1},PlotRange->{0,5},PlotLabel->"Derivative of g(t)",AxesLabel->{"t"}]
Bartlett = 1-3(ρ^2)+4(ρ^4)/.ρ-> θ/(1+(θ^2)); (* The variance from the Bartlett formula - which version is correct? *)
(((D[g[t],t]))^2)*Bartlett/.t->(θ/(1+(θ^2)))//Simplify
Plot[%//Evaluate,{θ,-1,1},PlotRange->{0,15},PlotLabel->"Asymptotic variance of hat(θ)",AxesLabel->{"θ","n avar((OverHat[θ]))"}]

The approach using the inverse function.

m[θ_]=(θ/(1+(θ^2)));
D[m[θ],θ]
Bartlett/(((%))^2)//Simplify
$Assumptions=True;

Example 9:MoM in multinomial distribution

The “direct” approach.

$Assumptions=0<p<1/2;
τ[p_]=1-(p^2)+√p; (* E X *)
Plot[τ[p],{p,0,1/2},PlotLabel->"Function τ(p) = (Subscript[E, p]) X",AxesLabel->{"p"},GridLines->{{{(4^(-2/3)),{Orange,Thick}}},{}}]
Solve[τ[p]==m,p] (* hat(p) *)
VarX = 1-(p^2)-√p+4√p-((τ[p])^2)//Simplify (* variance of X *)
VarX (((D[τ[p],p]))^(-2))//Simplify (* asymptotic variance of (OverHat[p]) *)
Plot[%,{p,0,1/2},PlotLabel->"Asymptotic variance of (OverHat[p])",AxesLabel->{"p","n avar((OverHat[p]))"}]
Solve[D[τ[p],p]==0,p](* avar((OverHat[p])) explodes at this point *)

A correct approach.

Clear[k];
μ[p_,k_]= (0^k)(p^2)+(1^k)(1-(p^2)-√p)+(2^k)√p;
Plot[Table[μ[p,k],{k,1,3}]//Evaluate,{p,0,1/2},PlotLabel->"Functions (Subscript[E, p]) (X^k)",AxesLabel->{"p"},PlotLegends->{"k=1","k=2","k=3"}]
Plot[Table[D[μ[p,k],p],{k,1,3}]//Evaluate,{p,0,1/2},PlotLabel->"Derivatives of (Subscript[E, p]) (X^k) in p",AxesLabel->{"p"},PlotLegends->{"k=1","k=2","k=3"}]

k=2;
Solve[μ[p,k]==m,p]
VarX = μ[p,2*k]-((μ[p,k])^2)//Simplify
VarX / (((D[μ[p,k],p]))^2)//Simplify
Plot[%,{p,0,1/2},PlotLabel->"Asymptotic variance of (OverHat[p])",AxesLabel->{"p","n avar((OverHat[p]))"},PlotRange->{0,2}]
$Assumptions=True;