Check Convergence of Fitted Model

Share:

Description

This function checks the convergence information contained in models of various classes.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
checkConv(mod, ...)

## S3 method for class 'betareg'
checkConv(mod, ...)

## S3 method for class 'clm'
checkConv(mod, ...)

## S3 method for class 'clmm'
checkConv(mod, ...)

## S3 method for class 'glm'
checkConv(mod, ...)

## S3 method for class 'hurdle'
checkConv(mod, ...)

## S3 method for class 'lavaan'
checkConv(mod, ...)

## S3 method for class 'maxlikeFit'
checkConv(mod, ...)

## S3 method for class 'merMod'
checkConv(mod, ...)

## S3 method for class 'multinom'
checkConv(mod, ...)

## S3 method for class 'nls'
checkConv(mod, ...)

## S3 method for class 'polr'
checkConv(mod, ...)

## S3 method for class 'unmarkedFit'
checkConv(mod, ...)

## S3 method for class 'zeroinfl'
checkConv(mod, ...)

Arguments

mod

an object containing the output of a model of the classes mentioned above.

...

additional arguments passed to the function.

Details

This function checks the element of a model object that contains the convergence information from the optimization function. The function is currently implemented for models of classes betareg, clm, clmm, glm, hurdle, lavaan, maxlikeFit, merMod, multinom, nls, polr, unmarkedFit, and zeroinfl. The function is particularly useful for functions with several groups of parameters, such as those of the unmarked package (Fiske and Chandler, 2011).

Value

checkConv returns a list with the following components:

converged

a logical value indicating whether the algorithm converged or not.

message

a string containing the message from the optimization function.

Author(s)

Marc J. Mazerolle

References

Fiske, I., Chandler, R. (2011) unmarked: An R Package for fitting hierarchical models of wildlife occurrence and abundance. Journal of Statistical Software 43, 1–23.

See Also

checkParms, covDiag, mb.gof.test, Nmix.gof.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
##example modified from ?pcount
## Not run: 
if(require(unmarked)){
##Simulate data
set.seed(3)
nSites <- 100
nVisits <- 3
##covariate
x <- rnorm(nSites)               
beta0 <- 0
beta1 <- 1
##expected counts
lambda <- exp(beta0 + beta1*x)   
N <- rpois(nSites, lambda)      
y <- matrix(NA, nSites, nVisits)
p <- c(0.3, 0.6, 0.8)           
for(j in 1:nVisits) {
  y[,j] <- rbinom(nSites, N, p[j])
}
## Organize data
visitMat <- matrix(as.character(1:nVisits),
                   nSites, nVisits, byrow=TRUE)
     
umf <- unmarkedFramePCount(y=y, siteCovs=data.frame(x=x),
                           obsCovs=list(visit=visitMat))
## Fit model
fm1 <- pcount(~ visit ~ 1, umf, K=50)
checkConv(fm1)
}

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.