smoothMultiRegression.Rd
Reconstruct a n by k vector given n by p matrix of predictors.
smoothMultiRegression(
x,
y,
iterations = 10,
sparsenessQuantile = 0.5,
positivity = FALSE,
smoothingMatrixX = NA,
smoothingMatrixY = NA,
nv = 2,
extraPredictors,
verbose = FALSE
)
input matrix on which prediction is based
target matrix
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
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 <- matrix(rnorm(nrow(mat) * 2), ncol = 2)
for (i in c(5000:6000, 10000:11000, 16000:17000)) {
mat[, i] <- age[, 1] * 0.1 + mat[, i]
}
sel <- 1:25
fit <- smoothMultiRegression(
x = mat[sel, ], y = age[sel, ], iterations = 10,
sparsenessQuantile = 0.5,
smoothingMatrixX = smoomat, smoothingMatrixY = NA, verbose = T
)
tt <- mat %*% fit$v
print(cor.test(age[-sel, 1], tt[-sel, 1]))
vimg <- makeImage(mask, (fit$v[, 1]))
print(range(vimg) * 10)
plot(mask, vimg, window.overlay = range(abs(vimg)))
} # }