覆盖另一个函数调用的函数中的默认参数

时间:2016-07-19 02:16:03

标签: r function

我运行mirt模型,结果summary说:

In GPFoblq(L, Tmat = Tmat, normalize = normalize, eps = eps, maxit = maxit,  :
  convergence not obtained in GPFoblq. 1000 iterations used.

我想将maxit设置为2000.我想尝试在Function generation; change defaults of other functions (partial)中提出建议。但是,我找不到GPFoblq函数。

> GPFoblq()
Error: could not find function "GPFoblq"

我很困惑 - mirt如何致电GPFoblq?我如何覆盖maxit值?

1 个答案:

答案 0 :(得分:1)

要更改maxit,您需要使用mirt中的控制参数:

require(mirt)
data <- expand.table(LSAT7)

(mod1 <- mirt(data, 1,control=list(maxit=10000)))
Iteration: 28, Log-Lik: -2658.805, Max-Change: 0.00010
Call:
mirt(data = data, model = 1, control = list(maxit = 10000))

Full-information item factor analysis with 1 factor(s).
Converged within 1e-04 tolerance after 28 EM iterations.
mirt version: 1.18 
M-step optimizer: BFGS 
EM acceleration: Ramsay
Number of rectangular quadrature: 61

Log-likelihood = -2658.805
AIC = 5337.61; AICc = 5337.833
BIC = 5386.688; SABIC = 5354.927
G2 (21) = 31.7, p = 0.0628
RMSEA = 0.023, CFI = 0.939, TLI = 0.924

关于GPFoblq的第二个问题 - 它不在mirt.R中,但显然在其他一个源文件或使用函数的依赖项中。您可以浏览该软件包或它的Wiki来查找。

https://github.com/philchalmers/mirt/blob/master/R

https://github.com/philchalmers/mirt/wiki

或者,如@ 42所述,您可以在DESCRIPTION文件中找到。