Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R cv中的成本函数。当模型的截止值不为0.5时,拟合逻辑模型的glm_R_Cross Validation_Logistic Regression - Fatal编程技术网

R cv中的成本函数。当模型的截止值不为0.5时,拟合逻辑模型的glm

R cv中的成本函数。当模型的截止值不为0.5时,拟合逻辑模型的glm,r,cross-validation,logistic-regression,R,Cross Validation,Logistic Regression,我有一个配备以下R功能的物流模型: glmfit<-glm(formula, data, family=binomial) 由于拟合模型中的响应为二元变量,因此适当的成本函数为(从?cv.glm“示例”部分获得): 成本0.5) 由于我的截止值为0.2,我可以应用这个标准成本函数吗?或者我应该定义一个不同的成本函数,以及如何定义?在stats.stackexchange.com上可能更好谢谢。我会把它贴在那里。 cv.glm(data, glmfit, cost, K) cost &

我有一个配备以下R功能的物流模型:

glmfit<-glm(formula, data, family=binomial)
由于拟合模型中的响应为二元变量,因此适当的成本函数为(从?cv.glm“示例”部分获得):

成本0.5)

由于我的截止值为0.2,我可以应用这个标准成本函数吗?或者我应该定义一个不同的成本函数,以及如何定义?

在stats.stackexchange.com上可能更好谢谢。我会把它贴在那里。
cv.glm(data, glmfit, cost, K)
cost <- function(r, pi = 0) mean(abs(r-pi) > 0.5)