glm中的错误" eval中的错误(family $ initialize):y值必须为0< = y< = 1"

时间:2017-10-08 08:08:37

标签: r tableau glm

我正在研究画面中的流失预测模型。我编写了如下所示的脚本,但得到错误为" eval中的错误(family $ initialize):y值必须为0< = y< = 1"。 感激如果有人可以提供帮助

STR(SCRIPT_REAL('
    data_churn<-data.frame(Churn <- .arg1, Account_Length <- .arg2, VMail_Message <- .arg3, Day_Mins <- .arg4, Eve_Mins <- .arg5,
    Night_Mins <- .arg6, Intl_Mins <- .arg7, CustServ_Calls <- .arg8, Int_l_Plan <- .arg9, VMail_Plan <- .arg10, Day_Calls <- .arg11,
    Day_Charge <- .arg12, Eve_Calls <- .arg13, Eve_Charge <- .arg14, Night_Calls <- .arg15, Night_Charge <- .arg16,
    Intl_Calls <- .arg17, Intl_Charge <- .arg18);

    fit_data <- glm(Churn~., data=data_churn, family= binomial(link = "logit"));

    new_data < - data.frame(Account_Length <- .arg19, VMail_Message <- .arg20, Day_Mins <- .arg21, Eve_Mins <- .arg22,
    Night_Mins <- .arg23, Intl_Mins <- .arg24, CustServ_Calls <- .arg25, Int_l_Plan <- .arg26, VMail_Plan <- .arg27, Day_Calls <- .arg28,
    Day_Charge <- .arg29, Eve_Calls <- .arg30, Eve_Charge <- .arg31, Night_Calls <- .arg32, Night_Charge <- .arg33,
    Intl_Calls <- .arg34, Intl_Charge <- .arg35);
library(rpart)
    pred_val<- predict(fit_data)
    pred_val<-ifelse((pred_val)>.5,1,0)
    pred_val',
sum([Churn]), sum([Account Length]), sum([VMail Message]), sum([Day Mins]), sum([Eve Mins]), sum([Night Mins]), 
sum([Intl Mins]), sum([CustServ Calls]), sum([Int'l Plan]),sum([VMail Plan]), sum([Day Calls]),
sum([Day Charge]), sum([Eve Calls]), sum([Eve Charge]), sum([Night Calls]), sum([Night Charge]),
sum([Intl Calls]), sum([Intl Charge])))

0 个答案:

没有答案