smoothRegression.Rd
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
)
input matrix on which prediction is based
target vector
number of gradient descent iterations
quantile to control sparseness - higher is sparser.
restrict to positive or negative solution (beta) weights. choices are positive, negative or either as expressed as a string.
allows parameter smoothing, should be square and same size as input matrix
number of predictor spatial vectors
additional column predictors
boolean option
vector of size p is output
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)))
} # }