modelFit: Fitting metamodels

Description Usage Arguments Value Author(s) See Also Examples

Description

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

Usage

1
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

See Also

modelPredict

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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)[1]),
		formula=Y~X1+X2+X1:X2+I(X1^2)+I(X2^2))
summary(modStep$model)

# construction of an additive model
library(gam)
modAm <- modelFit(X,Y,type = "Additive",formula=Y~s(X1)+s(X2))
summary(modAm$model)

# construction of a MARS model of degree 2
library(mda)
modMARS <- modelFit(X,Y,type = "MARS",degree=2)
print(modMARS$model)

# construction of a PolyMARS model with a penalty parameter equal to 1
library(polspline)
modPolyMARS <- modelFit(X,Y,type = "PolyMARS",gcv=1)
summary(modPolyMARS$model)

# construction of a Kriging model
modKm <- modelFit(X,Y,type = "Kriging")
str(modKm$model)

## End(Not run)

DiceEval documentation built on May 2, 2019, 2:09 a.m.