我正在使用示例项目测试CircleCI平台,并试图执行UI /单元测试,但是遇到了一个问题,该问题说我需要一个配置文件。我一直以为我不需要配置文件或证书。我曾经能够在本地模拟器上运行示例项目,而无需在计算机上存储任何凭据。
我当前正在终端中使用此命令:
library(glm.predict)
library(survey)
data = MASS::survey
data$Smoke = ordered(MASS::survey$Smoke,levels=c("Never","Occas","Regul","Heavy"))
model1 = MASS::polr(Smoke ~ Sex + Height, data=data)
summary(model1)
# comparing a man to a woman
polr.predict(model1, c(1,170),sim.count=10000)
this_design <- svydesign( ~ 1 , data = data , weights = ~ Age )
model2 = svyolr(Smoke ~ Sex + Height, this_design)
class(model2) <- 'polr'
# prediction for male with height 170
( this_prediction <- polr.predict(model2, c(1,170),sim.count=10000) )
fake_data <- data[ c( 'Sex' , 'Height' ) ]
fake_data <- fake_data[ complete.cases( fake_data ) , ]
fake_data[ , ] <- sapply( fake_data[ , ] , as.numeric )
# lowering sim.count just so it runs faster
res <- apply( fake_data , 1 , function( w ) polr.predict(model2, w ,sim.count=100) )
# prediction for the first record
res[1:4,1]
# lower CI for the first record
res[5:8,1]
# upper CI for the first record
res[9:12,1]
# prediction of heavy smoking for every record
fake_data[ , 'predicted_heavy_smoking' ] <- res[ 4 , ]