Reconstruct a n by 1 vector given n by p matrix of predictors.

smoothRegression(
  x,
  y,
  iterations = 10,
  sparsenessQuantile = 0.5,
  positivity = FALSE,
  smoothingMatrix = NA,
  nv = 2,
  extraPredictors,
  verbose = FALSE
)

Arguments

x

input matrix on which prediction is based

y

target vector

iterations

number of gradient descent iterations

sparsenessQuantile

quantile to control sparseness - higher is sparser.

positivity

restrict to positive or negative solution (beta) weights. choices are positive, negative or either as expressed as a string.

smoothingMatrix

allows parameter smoothing, should be square and same size as input matrix

nv

number of predictor spatial vectors

extraPredictors

additional column predictors

verbose

boolean option

Value

vector of size p is output

Author

Avants BB

Examples

if (FALSE) { # \dontrun{
mask <- getMask(antsImageRead(getANTsRData("r16")))
spatmat <- t(imageDomainToSpatialMatrix(mask, mask))
smoomat <- knnSmoothingMatrix(spatmat, k = 200, sigma = 1.0)
mat <- matrix(rnorm(sum(mask) * 50), ncol = sum(mask), nrow = 50)
mat[1:25, 100:10000] <- mat[1:25, 100:10000] + 1
age <- rnorm(1:nrow(mat))
for (i in c(5000:6000, 10000:11000, 16000:17000)) {
  mat[, i] <- age * 0.1 + mat[, i]
}
sel <- 1:25
fit <- smoothRegression(
  x = mat[sel, ], y = age[sel], iterations = 10,
  sparsenessQuantile = 0.5,
  smoothingMatrix = smoomat, verbose = T
)
tt <- mat %*% fit$v
print(cor.test(age[-sel], tt[-sel, 1]))
vimg <- makeImage(mask, (fit$v[, 1]))
print(range(vimg) * 10)
plot(mask, vimg, window.overlay = range(abs(vimg)))
} # }