pwr_cv: pwr_cv

Description Usage Arguments Value Examples

View source: R/pwr_cv.R

Description

pwr_cv performs leave-one-out cross-validation to select the optimal bandwidth to the decay function used in the PWR estimation.

Usage

1
pwr_cv(net, y, X, bandwidth=exp(seq(from=-1, to=3, by=.05)), n=lenght(V(net)))

Arguments

net:

an igraph network object.

y:

the dependent variable of the PWR model

X:

a matrix of covariates for the model.

bandwidht:

the values for the bandwidth search. Default searchs over the following values exp(seq(from=-1, to=3, by=.05))

n:

sample size for the CV search. We suggest the user to reduce the sample to 500 observations for computational reasons. Default is the entire network.

Value

it returns a list with two objects: the optimal bandwidth and a graph showing the selection

Examples

1
2
l <- cwr.cv_leaveoneout(net=net,y=log(V(net)$in_degree+1),
 X=as.matrix(log(V(net)$out_degree+1)), n=500)

TiagoVentura/pwr documentation built on Oct. 26, 2021, 2:13 p.m.