Here's some code to illustrate. Start with the example found in ?occuMulti and run the code until you get to the first model fit, then use the following code instead:
# Change formulas so one has a covariate on interaction between bear and tiger
occFormulas <- c('~1','~occ_cov2','~occ_cov3','~1','~1','~occ_cov1','~0')
detFormulas <- c('~1','~1','~1')
# Fit model
fit <- occuMulti(detFormulas,occFormulas,data)
# Build newdata
# Get sequence of possible values for occ_cov1
rng <- range(siteCovs(data)$occ_cov1)
cov1_seq <- seq(rng[1], rng[2], length.out=100)
# Construct newdata; occ_cov1 varies but the other two are
# held constant at their means (since we're only interested in how
# changes in cov1 affect things)
nd <- data.frame(occ_cov1=cov1_seq,
occ_cov2=mean(siteCovs(data)$occ_cov2),
occ_cov3=mean(siteCovs(data)$occ_cov3))
head(nd)
# Calculate tiger occupancy when bear is present for the range of values
# in the newdata
tiger_bear <- predict(fit, "state", species="tiger", cond="bear", newdata=nd)
# Add bear status and our corresponding range of cov1 values
tiger_bear$bear_status <- "Bear present"
tiger_bear$cov_value <- cov1_seq
# Note we have predicted plus 95% CIs
head(tiger_bear)
# Same thing but with bear absent
tiger_nobear <- predict(fit, "state", species="tiger", cond="-bear", newdata=nd)
tiger_nobear$bear_status <- "Bear absent"
tiger_nobear$cov_value <- cov1_seq
# Construct a data frame for use when plotting by combining
plot_data <- rbind(tiger_bear, tiger_nobear)
# Plot
library(ggplot2)
ggplot(data=plot_data, aes(x=cov_value, y=Predicted)) +
geom_ribbon(aes(ymin=lower, ymax=upper, fill=bear_status), alpha=0.3) + # confidence intervals
geom_line(aes(col=bear_status)) +
labs(x="Covariate 1 value", y="Tiger occupancy", fill=element_blank(),
col=element_blank()) +
theme_bw(base_size=14) +
theme(panel.grid=element_blank())