inst/doc/colext_occuHMM.R

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  install.packages("devtools")
#  library("devtools")
#  install_github('oliviergimenez/occuHMM')

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  library(occuHMM)

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  yy = sim_colext()

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  J = 3 # nb_surveys
#  K = 10 # nb_seasons

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  binit = runif(4) # random initial values
#  res = fit_colext(data=yy,init=binit,nb_surveys=J,nb_seasons=K)

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  xx = res$par

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  psi = exp(xx[1])/(1+exp(xx[1]))
#  gamma = exp(xx[2])/(1+exp(xx[2]))
#  epsilon = exp(xx[3])/(1+exp(xx[3]))
#  p = exp(xx[4])/(1+exp(xx[4]))

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  library(unmarked)
#  simUMF <- unmarkedMultFrame(y = yy,numPrimary=K)
#  m0 <- colext(psiformula= ~1, gammaformula = ~ 1, epsilonformula = ~ 1,
#  pformula = ~ 1, data = simUMF, method="BFGS")
#  psi_unmarked <- backTransform(m0, type="psi")
#  col_unmarked <- backTransform(m0, type="col")
#  ext_unmarked <- backTransform(m0, type="ext")
#  p_unmarked <- backTransform(m0, type="det")

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  res_unmarked <-round(c(coef(psi_unmarked),coef(col_unmarked),coef(ext_unmarked),coef(p_unmarked)),2)
#  ourres <- round(c(psi,gamma,epsilon,p),2)
#  cat('our estimates:',ourres)
#  cat('unmarked:', res_unmarked)

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  yy = sim_colextfp()

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  J = 3 # nb_surveys
#  K = 10 # nb_seasons

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  binit = runif(6) # random initial values
#  res = fit_colextfp(data=yy,init=binit,nb_surveys=J,nb_seasons=K)

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  xx = res$par

## ---- message=FALSE, warning=FALSE, eval=FALSE---------------------------
#  psi = 1/(1+exp(-xx[1]))
#  colonization = 1/(1+exp(-xx[2]))
#  extinction = 1/(1+exp(-xx[3]))
#  p10 = 1/(1+exp(-xx[4]))
#  p11 = 1/(1+exp(-xx[5]))
#  delta = 1/(1+exp(-xx[6]))
oliviergimenez/occuHMM documentation built on May 24, 2019, 12:52 p.m.