% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/buildEnsembleStack.R
\name{buildEnsembleStack}
\alias{buildEnsembleStack}
\title{Ensemble: Stacking}
\usage{
buildEnsembleStack(x, y, control = list())
}
\arguments{
\item{x}{design matrix (sample locations), rows for each sample, columns for each variable.}

\item{y}{vector of observations at \code{x}}

\item{control}{(list), with the options for the model building procedure:\cr
\code{startTheta} optional start value for theta optimization, default is \code{NULL}\cr
\code{algTheta}  algorithm used to find theta, default is \code{optimLBFGSB}.\cr
\code{budgetAlgTheta} budget for the above mentioned algorithm, default is \code{200}. The value will be multiplied with the length of the model parameter vector to be optimized.\cr
\code{nugget} Value for nugget. Default is -1, which means the nugget will be optimized during MLE. Else it can be fixed in a range between 0 and 1.
\code{regr} Regression function to be used: \code{\link{regpoly0}} (default), \code{\link{regpoly1}}, \code{\link{regpoly2}}. Can be a custom user function.\cr
\code{corr} Correlation function to be used: \code{\link{corrnoisykriging}} (default), \code{\link{corrkriging}}, \code{\link{corrnoisygauss}}, \code{\link{corrgauss}}, \code{\link{correxp}}, \code{\link{correxpg}}, \code{\link{corrlin}}, \code{\link{corrcubic}},\code{\link{corrspherical}},\code{\link{corrspline}}. Can also be user supplied (if in the right form).
\code{target} target values of the prediction, a vector of strings. Each string specifies a value to be predicted, e.g., "y" for mean, "s" for standard deviation, "ei" for expected improvement. See also \code{\link{predict.kriging}}.
This can also be changed after the model has been build, by manipulating the respective \code{object$target} value.}
}
\value{
returns an object of class \code{ensembleStack} with the following elements:
			\item{\code{model}}{A list, containing model parameters}
			\item{\code{like}}{Estimated likelihood value}
			\item{\code{theta}}{activity parameters theta (vector)}
			\item{\code{p}}{exponents p (vector)}
			\item{\code{lambda}}{nugget value (numeric)}
			\item{\code{nevals}}{ Number of iterations during MLE}
}
\description{
Generates an ensemble of surrogate models with stacking
}
\examples{
## Create a test function: branin
braninFunction <- function (x) {	
	(x[2]  - 5.1/(4 * pi^2) * (x[1] ^2) + 5/pi * x[1]  - 6)^2 + 
10 * (1 - 1/(8 * pi)) * cos(x[1] ) + 10
}
## Create design points
x <- cbind(runif(20)*15-5,runif(20)*15)
## Compute observations at design points
y <- as.matrix(apply(x,1,braninFunction))
## Create model with default settings
fit <- buildEnsembleStack(x,y)
## Predict new point
predict(fit,cbind(1,2))
## True value at location
braninFunction(c(1,2))

}
\seealso{
\code{\link{predict.ensembleStack}}
}

