modelFit {DiceEval} R Documentation

## Fitting metamodels

### Description

modelFit is used to fit a metamodel of class lm, gam, mars, polymars or km.

### Usage

modelFit (X,Y, type, ...)


### Arguments

X

a data.frame containing the design of experiments

Y

a vector containing the response variable

type

represents the method used to fit the model:

 "Linear" linear model, "StepLinear" stepwise, "Additive" gam, "MARS" mars "PolyMARS" polymars "Kriging" kriging model.
...

corresponds to the parameter(s) of the model. The list of the needed arguments for each type of models is given below:

 "Linear" formula (see formulaLm), "StepLinear" formula penalty parameter, "Additive" formula (see formulaAm), "MARS" degree, "PolyMARS" gcv criteria. "Kriging" formula covtype

### Value

A list with the following components:

 X a data frame representing the design of experiments Y a vector representing the response type the type of metamodel model a fitted model of the specified class

and the value of the parameter(s) depending on the fitted model.

### Author(s)

D. Dupuy

modelPredict

### Examples

# A 2D example
Branin <- function(x1,x2) {
x1 <- x1*15-5
x2 <- x2*15
(x2 - 5/(4*pi^2)*(x1^2) + 5/pi*x1 - 6)^2 + 10*(1 - 1/(8*pi))*cos(x1) + 10
}
# a 2D uniform design and the value of the response at these points
X <- matrix(runif(24),ncol=2,nrow=12)
Z <- Branin(X[,1],X[,2])
Y <- (Z-mean(Z))/sd(Z)

# construction of a linear model
modLm <- modelFit(X,Y,type = "Linear",formula=Y~X1+X2+X1:X2+I(X1^2)+I(X2^2))
summary(modLm$model) ## Not run: # construction of a stepwise-selected model modStep <- modelFit(X,Y,type = "StepLinear",penalty=log(dim(X)), formula=Y~X1+X2+X1:X2+I(X1^2)+I(X2^2)) summary(modStep$model)

# construction of an additive model
library(gam)
summary(modAm$model) # construction of a MARS model of degree 2 library(mda) modMARS <- modelFit(X,Y,type = "MARS",degree=2) print(modMARS$model)
summary(modPolyMARS$model) # construction of a Kriging model modKm <- modelFit(X,Y,type = "Kriging") str(modKm$model)