This function computes the partial R-squared of all selected eigenvectors in a spatially filtered linear regression model.

partialR2(y, x = NULL, evecs)

Arguments

y

response variable

x

vector/ matrix of regressors

evecs

(selected) eigenvectors

Value

Vector of partial R-squared values of the eigenvectors.

Note

The function assumes a linear regression model. Since the eigenvectors are mutually uncorrelated, partialR2 evaluates them sequentially. In generalized linear models, the presence of a link function can corrupt the uncorrelatedness of the eigenvectors.

See also

Author

Sebastian Juhl

Examples

data(fakedata)
y <- fakedataset$x1
x <- fakedataset$x2

# get eigenvectors
E <-getEVs(W = W, covars = NULL)$vectors

(out <- partialR2(y = y, x = x, evecs = E[, 1:5]))
#> [1] 0.0007329944 0.0602190741 0.0010038680 0.0287335991 0.0205537163