Hi Community,
I'm running into some weird results and a warning: "In sqrt(diag(vcov(obj))) : NaNs produced" when I try running code for occupancy analysis in unmarked. I'm just starting to learn to use R & unmarked.
My supervisor thought it could be a 'convergence issue' to try providing 'starting values', what does this mean & how do I do it? She advised looking online for help.
Here is the code I was trying to run (none of the errors shown in the reprex come up when I run the code only the warning message what does this mean?:
#Make this a new object
dets_cats_aw <- dat_cats_aw[,-1]
#> Error in eval(expr, envir, enclos): object 'dat_cats_aw' not found
#Check it
dets_cats_aw
#> Error in eval(expr, envir, enclos): object 'dets_cats_aw' not found
#Put data into 'unmarkedframe object' form UFO
UFO_cats_aw <- unmarkedFrameOccu(y = dets_cats_aw)
#> Error in unmarkedFrameOccu(y = dets_cats_aw): could not find function "unmarkedFrameOccu"
#Print summary
summary(UFO_cats_aw)
#> Error in summary(UFO_cats_aw): object 'UFO_cats_aw' not found
#Build Occupancy Frame with Covariates
CTTable <- read.csv("CTTable_test1.csv")
#> Warning in file(file, "rt"): cannot open file 'CTTable_test1.csv': No such file
#> or directory
#> Error in file(file, "rt"): cannot open the connection
View("CTTable_test.csv")
str(CTTable)
#> Error in str(CTTable): object 'CTTable' not found
head(CTTable)
#> Error in head(CTTable): object 'CTTable' not found
cov_test <- as.data.frame(CTTable$veg_group2)
#> Error in as.data.frame(CTTable$veg_group2): object 'CTTable' not found
names(cov_test) <- "veg_group2"
#> Error in names(cov_test) <- "veg_group2": object 'cov_test' not found
cov_test
#> Error in eval(expr, envir, enclos): object 'cov_test' not found
UFO1 <- unmarkedFrameOccu(y = dets_cats_aw, siteCovs = cov_test)
#> Error in unmarkedFrameOccu(y = dets_cats_aw, siteCovs = cov_test): could not find function "unmarkedFrameOccu"
summary(UFO1)
#> Error in summary(UFO1): object 'UFO1' not found
UFO1
#> Error in eval(expr, envir, enclos): object 'UFO1' not found
#Run models
#Model 1 simplest model constant det & occ
#doesn't vary with any covariate
m1 <- occu(~1~1, data = UFO1)
#> Error in occu(~1 ~ 1, data = UFO1): could not find function "occu"
m1
#> Error in eval(expr, envir, enclos): object 'm1' not found
Created on 2020-01-29 by the reprex package (v0.3.0)
Apologies for the ugly code I'm having trouble making a reprex as well, everything in R is just so complicated & not user-friendly!
Thankyou
Mary