Running examples in ‘maxlike-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: maxlike
> ### Title: Model occurrence probability using presence-only data
> ### Aliases: maxlike
> 
> ### ** Examples
> 
> 
> # Carolina Wren data used in Royle et. al (2012)
> data(carw)
> 
> # Covert data.frame to a list of rasters
> rl <- lapply(carw.data$raster.data, function(x) {
+    m <- matrix(x, nrow=carw.data$dim[1], ncol=carw.data$dim[2], byrow=TRUE)
+    r <- raster(m)
+    extent(r) <- carw.data$ext
+    r
+ })
> 
> # Create a raster stack and add layer names
> rs <- stack(rl[[1]], rl[[2]], rl[[3]], rl[[4]], rl[[5]], rl[[6]])
> names(rs) <- names(carw.data$raster.data)
> 
> plot(rs)
> 
> 
> # Fit a model
> fm <- maxlike(~pcMix + I(pcMix^2) + pcDec + I(pcDec^2)+ pcCon +
+     I(pcCon^2) + pcGr + I(pcGr^2) +
+     Lat + I(Lat^2) + Lon + I(Lon^2), rs, carw.data$xy1,
+     method="BFGS", removeDuplicates=TRUE, savedata=TRUE)
Warning in maxlike(~pcMix + I(pcMix^2) + pcDec + I(pcDec^2) + pcCon + I(pcCon^2) +  :
  4 points removed due to missing values
> 
> summary(fm)

Call: maxlike(formula = ~pcMix + I(pcMix^2) + pcDec + I(pcDec^2) +  
    pcCon + I(pcCon^2) + pcGr + I(pcGr^2) + Lat + I(Lat^2) +  
    Lon + I(Lon^2), rasters = rs, points = carw.data$xy1, removeDuplicates = TRUE,  
    savedata = TRUE, method = "BFGS") 

Coefficients:
                Est SE  z P(>|z|)
(Intercept) -1.3846 NA NA      NA
pcMix       -0.4787 NA NA      NA
I(pcMix^2)   0.0439 NA NA      NA
pcDec        1.3761 NA NA      NA
I(pcDec^2)  -0.2466 NA NA      NA
pcCon        1.0546 NA NA      NA
I(pcCon^2)  -0.2089 NA NA      NA
pcGr         0.2410 NA NA      NA
I(pcGr^2)   -0.0430 NA NA      NA
Lat         -6.5047 NA NA      NA
I(Lat^2)    -5.2485 NA NA      NA
Lon          8.6389 NA NA      NA
I(Lon^2)    -1.7543 NA NA      NA

optim convergence code: 0 

AIC: 25402.87 

> confint(fm)
            2.5 % 97.5 %
(Intercept)    NA     NA
pcMix          NA     NA
I(pcMix^2)     NA     NA
pcDec          NA     NA
I(pcDec^2)     NA     NA
pcCon          NA     NA
I(pcCon^2)     NA     NA
pcGr           NA     NA
I(pcGr^2)      NA     NA
Lat            NA     NA
I(Lat^2)       NA     NA
Lon            NA     NA
I(Lon^2)       NA     NA
> AIC(fm)
[1] 25402.87
> logLik(fm)
[1] -12688.43
> 
> 
> # Produce species distribution map (ie, expected probability of occurrence)
> psi.hat <- predict(fm) # Will warn if savedata=FALSE
> plot(psi.hat)
> points(carw.data$xy1, pch=16, cex=0.1)
> 
> 
> 
> # MAXENT sets "default prevalence" to an arbitrary value, 0.5.
> # We could do something similar by fixing the intercept at logit(0.5)=0.
> # However, it seems more appropriate to estimate this parameter.
> 
> fm.fix <- update(fm, fixed=c(0, rep(NA,length(coef(fm))-1)))
Warning in maxlike(formula = ~pcMix + I(pcMix^2) + pcDec + I(pcDec^2) +  :
  4 points removed due to missing values
Error in dimnames(vc) <- list(parnames, parnames) : 
  length of 'dimnames' [1] not equal to array extent
Calls: update ... update -> update.default -> eval -> eval -> maxlike
Execution halted