Learn R Programming

randnet (version 0.4)

ECV.nSmooth.lowrank: selecting tuning parameter for neighborhood smoothing estimation of graphon model

Description

selecting tuning parameter for neighborhood smoothing estimation of graphon model where the tuning parameter is to control estimation smoothness.

Usage

ECV.nSmooth.lowrank(A, h.seq, K, cv = NULL, B = 3, holdout.p = 0.1)

Arguments

A

adjacency matrix

h.seq

a sequence of h values to tune. It is suggested h should be in the order of sqrt(log(n)/n).

K

the optimal rank for approximation. Can be obtained by rank selection of ECV.

cv

cross-validation fold. Recomend to use replication number B instead.

B

independent replication number of random splitting

holdout.p

proportion of test sample

Value

a list object with

err

average validation error for h.seq

min.index

index of the minimum error

%% ...

Details

The neighborhood smoothing estimation can be slow, so the ECV may take long even for moderately large networks.

References

T. Li, E. Levina, and J. Zhu. Network cross-validation by edge sampling. Biometrika, 107(2), pp.257-276, 2020.

Examples

Run this code
# NOT RUN {
set.seed(500)
N <- 300

U = matrix(1:N,nrow=1) / (N+1)
V = matrix(1:N,nrow=1) / (N+1)

W = (t(U))^2
# }
# NOT RUN {
<!-- %*%matrix(1,nrow=1,ncol=N)+matrix(1,nrow=N,ncol=1)%*%(V^2) -->
# }
# NOT RUN {
W = W/3*cos(1/(W + 1e-7)) + 0.15



upper.index <- which(upper.tri(W))

A <- matrix(0,N,N)


rand.ind <- runif(length(upper.index))

edge.index <- upper.index[rand.ind < W[upper.index]]

A[edge.index] <- 1

A <- A + t(A)
diag(A) <- 0



#ecv.rank <- ECV.Rank(A,10,B=3,weighted=FALSE,mode="undirected")

#K.hat <- ecv.rank$auc.rank ## first estimate a good rank


#h.seq <- sqrt(log(N)/N)*seq(0.5,5,by=0.5)


#ecv.nsmooth <- ECV.nSmooth.lowrank(A,h.seq,K=2,B=3) ## nSmooth can be slow

#h <- h.seq[ecv.nsmooth$min.index]

#What <- nSmooth(A,h=h)

#par(mfrow=c(1,2))
#image(t(W[N:1,]))
#image(t(What[N:1,]))


# }

Run the code above in your browser using DataLab