当我运行以下代码时:
library(turboEM)
library(SparseM)
library(quantreg)
library(numDeriv)
library(foreach)
library(parallel)
libraary(iterators)
library(doParallel)
library(logbin)
library(glm2)
#-------------------------------------------------------------------------
data(heart)
head(heart)
start.p <- sum(data1$deaths) / sum(data1$patients)
fit.glm <- glm(cbind(deaths, patients-deaths) ~ factor(age) + factor(severity) +
factor(onset) + factor(region), family = binomial(log),
start = c(log(start.p), -rep(1e-4, 8)), data = data1,trace = TRUE, maxit = 100)
fit.logbin <- logbin(formula(fit.glm), trace = 1,data=data1)
summary(fit.logbin)
# Speed up convergence by using single EM algorithm
fit.logbin.em <- update(fit.logbin, method = "em")
summary(fit.logbin.em)
# Speed up convergence by using acceleration methods
fit.logbin.acc <- update(fit.logbin, accelerate = "squarem")
summary(fit.logbin.acc)
fit.logbin.em.acc <- update(fit.logbin.em, accelerate = "squarem")
summary(fit.logbin.em.acc)
sink("C:\\Users\\ak.biglarian\\Desktop\\MrsZooghi\\Out.logbin.txt")
summary(fit.logbin.em)
sink()
#-------------------------------------------------------------------------
logbin(formula = formula(fit.glm), data = heart, method = "em",
trace = 1)
在R-project的不同安装上,我在相同的代码上获得了不同的结果!
在一次安装中,我得到的代码运行良好,但在另一个安装中,我得到以下错误:
> fit.logbin <- logbin(formula(fit.glm), trace = 1,data=data1)
Error in logbin(formula(fit.glm), trace = 1, data = data1) :
unused argument (data = data1)
或
> logbin(formula = formula(fit.glm), data = heart, method = "em",
+ trace = 1)
Error in logbin(formula = formula(fit.glm), data = heart, method = "em", :
unused arguments (formula = formula(fit.glm), data = heart, method = "em")
是什么原因?我该如何解决这个问题?