First, to your main question, I agree that in most cases you would want to plot the covariate on its original scale.
Lain, I share Marc's concern about your approach here. I think it *could* be correct, it's hard to tell just from the code you provided. The key point is: do the min and max of the scaled sequence (in your newdata) correspond to transformed versions of the min and max of the unscaled data, and are the two sequences the same length and evenly spaced? If so you are probably OK, but it's not clear from your code. For example, is length(newdata$Tree.Cover.Cam) 54 to match the length of tree.raw? This is kind of hard to sort out in words so I wrote up an example of possible ways to do it, and end with an example of the way I think you should do it.
library(unmarked)
# Simulate data
set.seed(123)
x <- runif(100,0,10)
psi <- plogis(-0.5 + 0.2 * x)
z <- rbinom(100, 1, psi)
y <- matrix(NA, nrow=100, ncol=5)
for (i in 1:100){
y[i,] <- rbinom(5, 1, 0.5*z[i])
}
# normalize x first
mn_x <- mean(x); sd_x <- sd(x)
x_scale <- (x - mn_x)/sd_x
# Fit model
umf1 <- unmarkedFrameOccu(y=y, siteCovs=data.frame(x=x_scale))
fm1 <- occu(~1~x, umf1)
Now to predict. I'll show two correct approaches and one incorrect approach to predicting with a scaled covariate.
# create x sequence on original scale for plot
x_seq <- seq(min(x), max(x), length.out=100)
# Approach 1:
# normalize the x sequence by scaling by original mean/sd
# this is what Marc suggested
x_scale_seq1 <- (x_seq - mn_x)/sd_x
pr1 <- predict(fm1, "state", newdata=data.frame(x=x_scale_seq1))
# Approach 2:
# get a sequence between min and max of *scaled* values
# remember we generated x_scale above when making the umf
# this is what Lain did I think
x_scale_seq2 <- seq(min(x_scale), max(x_scale), length.out=100)
pr2 <- predict(fm1, "state", newdata=data.frame(x=x_scale_seq2))
# Approach 3 (INCORRECT):
# Predict directly with original, untransformed x sequence
pr_bad <- predict(fm1, "state", newdata=data.frame(x=x_seq))
Finally, I'll generate plots for each of the 3 approaches, plus a plot where we put the original X on the x-axis.
# Make plot
png("fig1.png")
par(mfrow=c(2,2))
# Plot with x sequence 1
plot(x_scale_seq1, pr1$Predicted, type="line", main="predict with\nx_scale_seq1", ylab="psi")
# Plot with x sequence 2
plot(x_scale_seq2, pr2$Predicted, type="line", main="predict with\nx_scale_seq2", ylab="psi")
# Incorrect plot
plot(x_seq, pr_bad$Predicted, type="line", ylab="psi", main="incorrect: predict\nusing original x")
# Plot with x sequence 1 but put real x on x axis
plot(x_seq, pr1$Predicted, type='line', main="predict with\nx_scale_seq1\noriginal on x-axis", ylab="psi")
dev.off()
As you can see as long as you do it correctly the two approaches are equivalent (and the incorrect approach gives a different plot).
However, there is (I think) and easier way to do this: don't scale x yourself, tell unmarked to do it by putting a call to scale() in your formula.
# Put original x in unmarked frame
umf2 <- unmarkedFrameOccu(y=y, siteCovs=data.frame(x=x))
# Scale x in the formula and fit model again
fm2 <- occu(~1~scale(x), umf2)
The estimates from fm1 and fm2 will be identical. Now you can just use the original x sequence directly to predict, unmarked scales x automatically based on original mean and sd.
# Use original x_seq
pr3 <- predict(fm2, "state", newdata=data.frame(x=x_seq))
# Plot and compare with previous approach to show they are the same
png("fig2.png", width=600, height=480)
par(mfrow=c(1,2))
# our new plot
plot(x_seq, pr3$Predicted, type='line', main="using scale() in formula", ylab="psi")
# our original plot
plot(x_seq, pr2$Predicted, type="line", main="predict with\nx_scale_seq1\noriginal on x-axis",
ylab="psi")
dev.off()