Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAICc for fitspecaccum object #250
Comments
|
When I try > AICc(mods)
Error: could not find function "AICc"So it looks like R does not have function The `logLik.fitspecaccum` <-
function(object, ...)
{
sapply(object$models, logLik, ...)
}I don't know if this sufficient, and I don't know what would you do with this. |
|
Please note that |
|
Thanks a lot for your help, Indeed AICc comes from the "MuMIn' package... P.S. The assertion that AICc cannot be used for non-nested models is very controversial( but common among R users since it was proposed by Ripley). I believe that most of the experts in the field would disagree (see example below). Are you aware of any other method for comparing nonlinear models that can be used for 'fitspecaccum' (BIC also doesn't work...) |
|
I assumed that mere nobs.fitspecaccum <-
function(object, ...)
{
sapply(object$models, nobs, ...)
}Once we get a list of all needed method functions, I'll add them to vegan. |
|
Thanks again! |
|
It seems that we need the following functions: `logLik.fitspecaccum` <-
function(object, ...)
{
out <- sapply(object$models, logLik, ...)
## sapply() strips attributes: get'em back
attr(out, "df") <- 1L + length(coef(object$models[[1]]))
attr(out, "nobs") <- nobs(object$models[[1]])
class(out) <- "logLik"
out
}
`nobs.fitspecaccum` <-
function(object, ...)
{
sapply(object$models, nobs, ...)
} |
|
It works! Thanks a lot |
|
Fine! Now I can give an easier way of doing the same: ## mod is a fitspecaccum result object
sapply(mod$models, AICc)This does not need any new vegan functions. I didn't want to give that at once because I wanted someone to test that the new functions also work and are sufficient... |
These allow some external functions and packages to work with the result objects. See github issue #250
|
Closed with commit 4759e1f |
I hear both sides of this. Reading Simon Wood's new 2nd Edition of Generalized Additive Models: an Introduction with R, he claims that comparing models via AIC doesn't require the models to be nested, but if they are some terms in the approximation of the expected K-L divergence cancel. |
|
It is just the same for me how you do if you are aware of what you do. |
Hi,
I try to apply model selection approach for different models using the 'fitspecaccum' function.
When I apply AIC it works. but when I try AICc I get the following error message
Error in UseMethod("logLik") :
no applicable method for 'logLik' applied to an object of class "c('fitspecaccum', 'specaccum')"
Thanks,
Niv