predict.ldblm {dbstats} | R Documentation |
Predicted values for a ldblm object
Description
predict.ldblm
returns the predicted values, obtained by evaluating
the local distance-based linear model in the new data
(newdata2
), using newdata1
to estimate the "kernel weights".
Usage
## S3 method for class 'ldblm'
predict(object,newdata1,newdata2=newdata1,
new.k.knn=3,type.var="Z",...)
Arguments
object |
an object of class |
newdata1 |
data.frame or matrix which contains the values of Z (if |
newdata2 |
the same logic as |
new.k.knn |
setting a minimum bandwidth in order to check that a candidate bandwidth h
doesn't contains DB linear models with only one observation.
If |
type.var |
set de type of the newdata paramater. Can be |
... |
arguments passed to or from other methods to the low level. |
Value
A list of class predict.ldblm
containing the following components:
fit |
predicted values for the k new individuals. |
newS |
matrix (with dimension (k,n)) of weights used to compute the predictions. |
Note
Look at which way (or type.var
) was made the ldblm
call.
The parameter type.var
must be consistent with the data type that
is introduced to ldblm
.
Author(s)
Boj, Eva <evaboj@ub.edu>, Caballe, Adria <adria.caballe@upc.edu>, Delicado, Pedro <pedro.delicado@upc.edu> and Fortiana, Josep <fortiana@ub.edu>
References
Boj E, Delicado P, Fortiana J (2010). Distance-based local linear regression for functional predictors. Computational Statistics and Data Analysis 54, 429-437.
Boj E, Grane A, Fortiana J, Claramunt MM (2007). Selection of predictors in distance-based regression. Communications in Statistics B - Simulation and Computation 36, 87-98.
Cuadras CM, Arenas C, Fortiana J (1996). Some computational aspects of a distance-based model for prediction. Communications in Statistics B - Simulation and Computation 25, 593-609.
Cuadras C, Arenas C (1990). A distance-based regression model for prediction with mixed data. Communications in Statistics A - Theory and Methods 19, 2261-2279.
Cuadras CM (1989). Distance analysis in discrimination and classification using both continuous and categorical variables. In: Y. Dodge (ed.), Statistical Data Analysis and Inference. Amsterdam, The Netherlands: North-Holland Publishing Co., pp. 459-473.
See Also
ldblm
for local distance-based linear models.
Examples
# example to use of the predict.ldblm function
n <- 100
p <- 1
k <- 5
Z <- matrix(rnorm(n*p),nrow=n)
b1 <- matrix(runif(p)*k,nrow=p)
b2 <- matrix(runif(p)*k,nrow=p)
b3 <- matrix(runif(p)*k,nrow=p)
s <- 1
e <- rnorm(n)*s
y <- Z%*%b1 + Z^2%*%b2 +Z^3%*%b3 + e
D <- as.matrix(dist(Z))
D2 <- D^2
newdata1 <- 0
ldblm1 <- ldblm(y~Z,kind.of.kernel=1,method="GCV",noh=3,k.knn=3)
pr1 <- predict(ldblm1,newdata1)
print(pr1)
plot(Z,y)
points(0,pr1$fit,col=2)
abline(v=0,col=2)
abline(h=pr1$fit,col=2)