[R] An error using frbs package

Baki UNAL
Fri, 27 Nov 2015 19:30:25 -0000

Hello
I'm trying to run code below with frbs package. But I get an error saying:

"Error in MF[k, temp[j + 2]] : subscript out of bounds"
I couldn't spot the source of the error. What may be the problem?



##-----------------------------------------
varinp.mf <- matrix(c(4, 0, 0, 10, 50, 4, 10, 50, 70, 110, 4, 70, 110, 200,
200),
??????????????????? nrow = 5, byrow = FALSE)

rule <- matrix(c("d1","->","e1",
???????????????? "d2","->","e2",
???????????????? "d3","->","e3"),
?????????????? nrow=3, byrow=TRUE)

num.fvalinput <- matrix(c(3), nrow=1)

varinput.1 <- c("d1", "d2", "d3")

names.varinput <- c(varinput.1)

range.data <- matrix(c(0, 200, 0, 1), nrow=2)

type.defuz <- "COG"

type.tnorm <- "MIN"
type.snorm <- "MAX"
type.implication.func <- "ZADEH"

name <- "Sim-1"

newdata<- matrix(c(150), nrow= 1, byrow = TRUE)

colnames.var <- c("AralikD","Cikti")

num.fvaloutput <- matrix(c(3), nrow=1)

varoutput.1 <- c("e1", "e2", "e3")

names.varoutput <- c(varoutput.1)

varout.mf <- matrix(c(4, 0, 0, 0.1, 0.4, 4, 0.1, 0.4, 0.6, 0.9, 4, 0.6, 0.9,
1.0, 1.0),
??????????????????? nrow = 5, byrow = FALSE)

type.model <- "MAMDANI"

object <- frbs.gen(range.data, num.fvalinput, names.varinput, num.fvaloutput,
varout.mf,
?????????????????? names.varoutput, rule, varinp.mf, type.model, type.defuz,
type.tnorm,
?????????????????? type.snorm, func.tsk = NULL, colnames.var,
type.implication.func, name)

plotMF(object)

res <- predict(object, newdata)$predicted.val
##-----------------------------------------

	[[alternative HTML version deleted]]