kernL {iprior} | R Documentation |
Load the kernel matrices for I-prior models
Description
Load the kernel matrices for I-prior models
Usage
kernL(
y,
...,
kernel = "linear",
interactions = NULL,
est.lambda = TRUE,
est.hurst = FALSE,
est.lengthscale = FALSE,
est.offset = FALSE,
est.psi = TRUE,
fixed.hyp = NULL,
lambda = 1,
psi = 1,
nystrom = FALSE,
nys.seed = NULL,
model = list(),
train.samp,
test.samp,
intercept
)
## S3 method for class 'formula'
kernL(
formula,
data,
kernel = "linear",
one.lam = FALSE,
est.lambda = TRUE,
est.hurst = FALSE,
est.lengthscale = FALSE,
est.offset = FALSE,
est.psi = TRUE,
fixed.hyp = NULL,
lambda = 1,
psi = 1,
nystrom = FALSE,
nys.seed = NULL,
model = list(),
train.samp,
test.samp,
intercept,
...
)
Arguments
y |
Vector of response variables |
... |
Only used when fitting using non-formula, enter the variables (vectors or matrices) separated by commas. |
kernel |
Character vector indicating the type of kernel for the variables. Available choices are:
The |
interactions |
Character vector to specify the interaction terms. When
using formulas, this is specified automatically, so is not required. Syntax
is |
est.lambda |
Logical. Estimate the scale parameters? Defaults to
|
est.hurst |
Logical. Estimate the Hurst coefficients for fBm kernels?
Defaults to |
est.lengthscale |
Logical. Estimate the lengthscales for SE kernels?
Defaults to |
est.offset |
Logical. Estimate the offsets for polynomial kernels?
Defaults to |
est.psi |
Logical. Estimate the error precision? Defaults to
|
fixed.hyp |
Logical. If |
lambda |
Initial/Default scale parameters. Relevant especially if
|
psi |
Initial/Default value for error precision. Relevant especially if
|
nystrom |
Either logical or an integer indicating the number of Nystrom
samples to take. Defaults to |
nys.seed |
The random seed for the Nystrom sampling. Defaults to
|
model |
DEPRECATED. |
train.samp |
(Optional) A vector indicating which of the data points should be used for training, and the remaining used for testing. |
test.samp |
(Optional) Similar to |
intercept |
(Optional) Intercept for response variables. |
formula |
The formula to fit when using formula interface. |
data |
Data frame containing variables when using formula interface. |
one.lam |
Logical. When using formula input, this is a convenient way of
letting the function know to treat all variables as a single variable (i.e.
shared scale parameter). Defaults to |
Value
An ipriorKernel
object which contains the relevant material to
be passed to the iprior
function for model fitting.
See Also
Examples
str(ToothGrowth)
(mod <- kernL(y = ToothGrowth$len,
supp = ToothGrowth$supp,
dose = ToothGrowth$dose,
interactions = "1:2"))
kernL(len ~ supp * dose, data = ToothGrowth) # equivalent formula call
# Choosing different kernels
str(stackloss)
kernL(stack.loss ~ ., stackloss, kernel = "fbm") # all fBm kernels
kernL(stack.loss ~ ., stackloss, kernel = "FBm") # cApS dOn't MatTeR
kernL(stack.loss ~ ., stackloss,
kernel = c("linear", "se", "poly3")) # different kernels
# Sometimes the print output is too long, can use str() options here
print(mod, strict.width = "cut", width = 30)