## S3 method for class 'lazy'
predict(object, newdata=NULL,
t.out=FALSE, k.out=FALSE,
S.out=FALSE, T.out=FALSE, I.out=FALSE, ...)
Arguments
object
Object of class inheriting from lazy.
newdata
Data frame (or matrix, vector, etc...) defining of the
query points for which a prediction is to be produced.
t.out
Logical switch indicating if the function should return
the parameters of the local models used to perform each estimation.
k.out
Logical switch indicating if the function should return
the number of neighbors used to perform each estimation.
S.out
Logical switch indicating if the function should return
the estimated variance of the prediction suggested by all the
models identified for each query point.
T.out
Logical switch indicating if the function should return
the parameters of all the models identified for each query point.
I.out
Logical switch indicating if the function should return
the index i of all the samples (X[i,],Y[i]) used to
perform each estimation.
...
Arguments passed to or from other methods.
Value
The output of the method is a list containing the following
components:
h
Vector of q elements, where q is the number of
rows in newdata, i.e. the number of query points. The element
in position i is the estimate of the value of the unknown function
in the query point newdata[i,]. The component h is
always returned.
t
Matrix of z*q elements, where z=z2 i.e., number of
parameters of a quadratic model if at least one model of degree 2
was identified (see quaIdPar in lazy.control),
otherwise z=z1 i.e.,
number of parameters of a linear model if at least one model of
degree 1 was identified (see linIdPar in
lazy.control), or z=1 if only
models of degree 0 where considered. In the general case,
the elements of the vector t[,j]=c(a0, a1,..., an, a11,
a12,..., a22, a23,..., a33, a34,..., ann) are
the parameters of the local model used for estimating
the function in the jth query point: the cross-terms terms
a11,a12,...,ann wil be missing if no quadratic model is
identified and the terms a1,...,an, will be missing if
no linear model is identified. If, according to cmbPar (see
lazy.control), estimations are to be performed by a
combination of models, the elements of t[,j] are a weighted
average of the parameters
of the selected models where the weight of each model is the
inverse of the a leave-one-out estimate of the variances of the
model itself. REMARK: a translation of the axes is considered
which centers all the local models in the respective query point.
k
Vector of q elements. Selected number of neighbors
for each query point. If, according to cmbPar (see
lazy.control), a local
combination of models is considered, k[j] is the largest
value among the number of neighbors used by the selected models
for estimating the value in the jth query point.
S
List of up to 3 components: Each component is a matrix
containing an estimate, obtained through a leave-one-out
cross-valication, of the variance of local models.
con
Matrix of idM0*q elements, where
idM0 is the maximum number of neighbors used to fit local
polynomial models of degree 0 (see lazy.control):
Estimated
variance of all the constant
models identified for each query point. If no constant model
is identified (see conIdPar and cmbPar in
lazy.control) S$con is not returned.
lin
Matrix of idM1*q elements, where
idM1 is the maximum number of neighbors used to fit local
polynomial models of degree 1 (see lazy.control):
Estimated
variance of all the linear
models identified for each query point. If no linear model
is identified (see linIdPar and cmbPar in
lazy.control) S$lin is not returned.
qua
Matrix of idM2*q elements, where
idM1 is the maximum number of neighbors used to fit local
polynomial models of degree 1 (see lazy.control):
Estimated variance of all the quadratic
models identified for each query point. If no quadratic model
is identified (see quaIdPar and cmbPar in
lazy.control) S$qua is not returned.
The component S is returned only if S.out=TRUE in
the function call.
T
List of up to 3 components:
con
Array of z0*idM0*q elements, where
z0=1 is the number of parameters of a model of degree
0. The element T$con[1,i,j]=a0 is the single parameter of
the local model identified on i neighbors of the
qth query point.
lin
Array of z1*idM1*q elements where, if
n is the dimensionality of the input space,
z1=n+1 is the number of parameter of a model of degree
1. The vector T$lin[,i,j]=c(a0,a1,...,an) is the
vector of parameters of
the local model identified on i neighbors of the
qth query point. In particular, a0 is the
constant term, a1 is the parameter associated with the
first input variable and so on.
qua
Array of z2*idM2*q elements where, if
n is the dimensionality of the input space,
z2=(n+1)*(n+2)/2 is the number of parameter of a model
of degree 2. The vector
T$qua[,i,j]=c(a0, a1,..., an, a11,
a12,..., a22, a23,..., a33, a34,..., ann)
is the vector of parameters of the local quadratic model
identified on i neighbors of the qth query
point. In particular, a0,...,a1 are the constant and
liner parameters as in T$lin, while
a11,a12,...,ann are the quadratic ones: a11
is associated with the quadratic term x1^2, a12
with the cross-term x1*x2, and so on.
REMARK: a translation of the axes is considered
which centers all the local models in the respective query
point. The component T is returned only if
T.out=TRUE in the function call.
I
Matrix of idM*q elements, where idM is the
largest of idM0, idM1, and idM2. Contains the
index of the neighbors of each query point in newdata.
In particular, I[i,j] is the ith nearest neighbor of
the qth query point.