doubletaper: Estimator for the spatial double block matrices - double...

Description Usage Arguments Value Examples

Description

This is the function that used to implement the double tapering estimator for the block bandable matrices S with p1 by p2 dimensions.

Usage

1
2
doubletaper(S, p1, p2, k, l, ck = 1, cl = 1, a = 1.3, b = 1.3,
  n = 1000, method = "tapering", Axis = 0)

Arguments

S

The block bandable matrices

p1

The number of x axis (latitude)

p2

The number of y axis (longitude)

k

bandwidth for the x axis

l

bandwidth for the y axis

ck

constant in the bandwidth for the x axis

cl

constant in the bandwidth for the y axis

a

decay rate for the x axis

b

decay rate for the y axis

n

sample size

method

tapering method, "tapering" for linear tapering, "banding" for banding estimator

Axis

tapering direction, 0 for tapering for both direction, 1 for x direction only, 2 for y direction only

Value

The regularized block bandable covariance matrix with double tapering estimator

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(MASS)
 p1=25; p2=25; p=p1*p2; M=1; ck=cl=10; n=500;
 nalpha=1:5
 err_hat=err_band=err_taper=rep(0,length(nalpha))
 for(i in nalpha){
   a=1+i/10
   cat("Decay Rate = ",a,"...\n")
   S=doubleblock(p1,p2,M,a,a)
   data = mvrnorm(n, mu = rep(0,p), Sigma = S)
   S_hat=cov(data)
   S_band=doubletaper(S_hat,p1,p2,ck,cl,a,a,n,method="banding",Axis=0)
   S_taper=doubletaper(S_hat,p1,p2,ck,cl,a,a,n,method="tapering",Axis=0)

   err_hat[i]=sqrt(sum((S_hat-S)^2))
   err_band[i]=sqrt(sum((S_band-S)^2))
   err_taper[i]=sqrt(sum((S_taper-S)^2))
 }
 plot(1+nalpha/10,err_hat/err_hat,col="black",type="o",ylim=c(0,1.5),
      xlab="decay rate",ylab="Relative Error",main="Relative Error for Different Estimators")
 lines(1+nalpha/10,err_band/err_hat,col="blue",type="o")
 lines(1+nalpha/10,err_taper/err_hat,col="red",type="o")
 legend("topright",c("Sample Covariance","Banding","Tapering"),col=c("black","blue","red"),
        lty=rep(1,3),pch=rep(1,3),cex=0.5)

liyi-1989/spatialcov documentation built on May 21, 2019, 7:32 a.m.