使用完整的二阶多项式 (2D) 运行 DiceKriging(在 R 中)时出现以下消息:
model.frame.default(object, data, xlev = xlev) 中的错误:
Variablenlängen sind unterschiedlich (gefunden für 'I(inputs[, 1]^2)')
用英语讲:
可变长度不同(为 'I (inputs [1] ^ 2)' 找到)
脚本:
#Modeling
xa<-c(1,2,3,4,5,6)
xb<-c(1,2,3,4,5,6)
inputs<-expand.grid(xa,xb)
output<-c(1,4,7,18,23,35,1,4,9,18,23,35,1,4,7,18,1,35,1,4,7,18,35,35,1,4,7,18,23,35,1,4,7,18,23,35)
m2 <- km(formula = ~.^2 + I(inputs[,1]^2) + I(inputs[,2]^2), design = data.frame(x = inputs), response = output)
#prediction
x11 <- seq(1,6, by = 0.1)
x22 <- seq(1,6, by = 0.1)
DESIGNX <- expand.grid(x11, x22)
newdata <- data.frame(x = DESIGNX)
DESIGNY <- predict(m2, newdata, "UK")$mean
#Error in model.frame.default(object, data, xlev = xlev) :
# variable lengths differ (found for 'I(inputs[, 1]^2)')