View source: R/multiscaleSVDxpts.R
smoothMultiRegression | R Documentation |
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
)
x |
input matrix on which prediction is based |
y |
target matrix |
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. |
smoothingMatrixX |
allows parameter smoothing, should be square and same size as input matrix |
smoothingMatrixY |
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 |
vector of size p is output
Avants BB
## Not run:
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)))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.