Plotting estimates of Tail Dependence Coefficient in R

I want to plot the following estimate of the tail dependence coefficient:

$\hat{\lambda}_n=\frac{1}{k}\sum_{j=1}^nI_{\{X_jX_{(n-k)},Y_jX_{(n-k)}\}}$ where $I_{(.)}$ is an indicator function and $X_{(1)}...X_{(n)}$ are order statistics.
If I consider this example

n=1000;
alpha=4;
U=runif(n);     
phi=0.8;
sigma=0.1;
X=(1-U)^{(-1/alpha)} ;
Z=rnorm(n)      ;   
Y=phi*X+sigma*abs(Z) ; 

then $\lambda=(.8)^4=04.09$. When I plot $\hat{\lambda}_n$ vs $k$ then the graph seems to stabilize around $0.50$ which is not true. See below the graph.

n=length(X);
lambda_hat=c();

lambda_hat=sapply(1:(n-1), FUN = function(i,minXY=pmin(X,Y),Xsort=sort(X)) length(minXY[minXYXsort[floor(n-i)]])/i);
k=1:(n-1)

plot(k,lambda_hat,type = "l",lwd=2,col="blue",
     main="Tdc of X and Y",ylab="Estimates",xlab="Order statistics")

Topic estimators visualization r

Category Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.