4

I am trying to fit a generalized linear model using Julia's GLM package. The fitting algorithm is failing because the max number of iterations, set by default to 30, is being exceeded. Examination of the source reveals that this parameter is stored as a named argument (maxIter) to the fit function, which is called at the end of the glm function if the dofit named argument to glm is true (which it is by default). So I should be able to adjust the max iterations by setting dofit to false, creating my glm, then calling fit manually on it with an altered maxIter:

myGlm = glm(formula, dataframe, Poisson(), dofit=false)
fit(myGlm, maxIter=50)

But the first line of this code fails with the error message:

no method glm(Array{Any,1},Expr,DataFrame,Poisson,LogLink)

When I look at the function signatures for glm in the source (glmfit.jl) or with help(glm), it's true that this signature isn't listed. But why is this the signature for my function call? Are named arguments automatically moved as an array to the beginning of the argument list, and do they need to be supported explicitly? The source in the context of This section of the Julia manual suggests my call should work.

4

1 回答 1

1

看起来关键字参数没有在https://github.com/JuliaStats/GLM.jl/blob/master/src/glmfit.jl#L134中传递

如果是这样,您应该归档并发布,同时将链接函数传递给调用,以便调用主glm函数,而不是便捷构造函数。

于 2013-09-27T20:55:00.503 回答