slope_change: This function fits to a numerical vector sorted in the non...

Description Usage Arguments Value Examples

Description

This function fits to a numerical vector sorted in the non decreasing order two simple linear regressions and returns the index corresponding to the estimated change between the two regression models.

Usage

1

Arguments

Y

numerical vector sorted in the non decreasing order.

Value

K the index corresponding to the estimated change between the two linear regression models.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
n <- 30
q <- 100
Sigma <- Simu_Sigma(q = q, diag = FALSE, equal = TRUE)
Matrix::image(Sigma)
E <- matrix(rnorm(n * q), ncol = q) %*% chol(as.matrix(Sigma))
corE <- cor(as.matrix(E))
vec_up_emp <- corE[upper.tri(corE)]
G <- matrix(0, ncol = (q - 1), nrow = (q - 1))
G[upper.tri(G, diag = TRUE)] <- vec_up_emp
G[lower.tri(G)] <- t(as.matrix(G))[lower.tri(t(as.matrix(G)))]
res_svd <- svd(G)
vp <- res_svd$d
slope_change(vp)

BlockCov documentation built on May 2, 2019, 9:20 a.m.