ฉันกำลังพยายามเรียกใช้การแปลง boxcox ด้วยรหัสต่อไปนี้:
urban1 <- subset(ski,urban <= 4,na.rm=TRUE)
ski$gender <- as.numeric((as.character(ski$gender)),na.rm=TRUE)
urban1 <- as.numeric((as.character(urban1)))
x <- (ski$gender*urban1)
y <- ski$EPSI.
bc <- boxcox(y ~ x)
(trans <- bc$x[which.max(bc$y)])
model3 <- lm(y ~ x)
model3new <- lm(y^trans ~ x)
ski$EPSI. <- ski$EPSI. + 1
แต่ฉันได้รับข้อผิดพลาดนี้ต่อไป:
ข้อผิดพลาดใน lm.fit(x,y,offset = offset, singular.ok = singular.ok, ...) : 0 (ไม่ใช่ NA) กรณีการโทร: ... eval -> eval -> boxcar -> boxcar สูตร -> lm -> lm.fit การดำเนินการหยุดลง
ขอบคุณล่วงหน้า!