I unfortunately don't think I have a super great solution for you. You might be able to change some default printing behavior in R in order to prevent losing the upper part of the summary by changing some printing option or something like that, but I've never tried that and it may not be super easy to navigate with that many species/covariates. You could also modify your the summary.msPGOcc function to actually save the output instead of just printing it to the console. I pasted the code for the summary function below (if using one of the spatial models, you can find that code in the "R/generics.R" script in the spOccupancy github.
summary.msPGOcc <- function(object,
level = 'both',
quantiles = c(0.025, 0.5, 0.975),
digits = max(3L, getOption("digits") - 3L), ...) {
print(object)
n.post <- object$
n.post n.samples <- object$n.samples
n.burn <- object$n.burn
n.thin <- object$n.thin
n.chains <- object$n.chains
run.time <- object$run.time[3] / 60 # minutes
cat(paste("Samples per Chain: ", n.samples,"\n", sep=""))
cat(paste("Burn-in: ", n.burn,"\n", sep=""))
cat(paste("Thinning Rate: ",n.thin,"\n", sep=""))
cat(paste("Number of Chains: ", n.chains, "\n", sep = ""))
cat(paste("Total Posterior Samples: ",
n.post * n.chains,"\n", sep=""))
cat(paste("Run Time (min): ", round(run.time, digits), "\n\n", sep = ""))
if (tolower(level) %in% c('community', 'both')) {
cat("----------------------------------------\n");
cat("\tCommunity Level\n");
cat("----------------------------------------\n");
# Occurrence
cat("Occurrence Means (logit scale): \n")
tmp.1 <- t(apply(object$beta.comm.samples, 2,
function(x) c(mean(x), sd(x))))
colnames(tmp.1) <- c("Mean", "SD")
tmp <- t(apply(object$beta.comm.samples, 2,
function(x) quantile(x, prob = quantiles)))
diags <- matrix(c(object$rhat$beta.comm, round(object$ESS$beta.comm, 0)), ncol = 2)
colnames(diags) <- c('Rhat', 'ESS')
print(noquote(round(cbind(tmp.1, tmp, diags), digits)))
cat("\nOccurrence Variances (logit scale): \n")
tmp.1 <- t(apply(object$tau.sq.beta.samples, 2,
function(x) c(mean(x), sd(x))))
colnames(tmp.1) <- c("Mean", "SD")
tmp <- t(apply(object$tau.sq.beta.samples, 2,
function(x) quantile(x, prob = quantiles)))
diags <- matrix(c(object$rhat$tau.sq.beta, round(object$ESS$tau.sq.beta, 0)), ncol = 2)
colnames(diags) <- c('Rhat', 'ESS')
print(noquote(round(cbind(tmp.1, tmp, diags), digits)))
if (object$psiRE) {
cat("\n")
cat("Occurrence Random Effect Variances (logit scale): \n")
tmp.1 <- t(apply(object$sigma.sq.psi.samples, 2,
function(x) c(mean(x), sd(x))))
colnames(tmp.1) <- c("Mean", "SD")
tmp <- t(apply(object$sigma.sq.psi.samples, 2,
function(x) quantile(x, prob = quantiles)))
diags <- matrix(c(object$rhat$sigma.sq.psi, round(object$ESS$sigma.sq.psi, 0)), ncol = 2)
colnames(diags) <- c('Rhat', 'ESS')
print(noquote(round(cbind(tmp.1, tmp, diags), digits)))
}
cat("\n")
# Detection
cat("Detection Means (logit scale): \n")
tmp.1 <- t(apply(object$alpha.comm.samples, 2,
function(x) c(mean(x), sd(x))))
colnames(tmp.1) <- c("Mean", "SD")
tmp <- t(apply(object$alpha.comm.samples, 2,
function(x) quantile(x, prob = quantiles)))
diags <- matrix(c(object$rhat$alpha.comm, round(object$ESS$alpha.comm, 0)), ncol = 2)
colnames(diags) <- c('Rhat', 'ESS')
print(noquote(round(cbind(tmp.1, tmp, diags), digits)))
cat("\nDetection Variances (logit scale): \n")
tmp.1 <- t(apply(object$tau.sq.alpha.samples, 2,
function(x) c(mean(x), sd(x))))
colnames(tmp.1) <- c("Mean", "SD")
tmp <- t(apply(object$tau.sq.alpha.samples, 2,
function(x) quantile(x, prob = quantiles)))
diags <- matrix(c(object$rhat$tau.sq.alpha, round(object$ESS$tau.sq.alpha, 0)), ncol = 2)
colnames(diags) <- c('Rhat', 'ESS')
print(noquote(round(cbind(tmp.1, tmp, diags), digits)))
if (object$pRE) {
cat("\n")
cat("Detection Random Effect Variances (logit scale): \n")
tmp.1 <- t(apply(object$sigma.sq.p.samples, 2,
function(x) c(mean(x), sd(x))))
colnames(tmp.1) <- c("Mean", "SD")
tmp <- t(apply(object$sigma.sq.p.samples, 2,
function(x) quantile(x, prob = quantiles)))
diags <- matrix(c(object$rhat$sigma.sq.p, round(object$ESS$sigma.sq.p, 0)), ncol = 2)
colnames(diags) <- c('Rhat', 'ESS')
print(noquote(round(cbind(tmp.1, tmp, diags), digits)))
}
}
if (tolower(level) %in% c('species', 'both')) {
if (tolower(level) == 'both') cat("\n")
cat("----------------------------------------\n");
cat("\tSpecies Level\n");
cat("----------------------------------------\n");
cat("Occurrence (logit scale): \n")
tmp.1 <- t(apply(object$beta.samples, 2,
function(x) c(mean(x), sd(x))))
colnames(tmp.1) <- c("Mean", "SD")
tmp <- t(apply(object$beta.samples, 2,
function(x) quantile(x, prob = quantiles)))
diags <- matrix(c(object$rhat$beta, round(object$ESS$beta, 0)), ncol = 2)
colnames(diags) <- c('Rhat', 'ESS')
print(noquote(round(cbind(tmp.1, tmp, diags), digits)))
cat("\n")
# Detection
cat("Detection (logit scale): \n")
tmp.1 <- t(apply(object$alpha.samples, 2,
function(x) c(mean(x), sd(x))))
colnames(tmp.1) <- c("Mean", "SD")
tmp <- t(apply(object$alpha.samples, 2,
function(x) quantile(x, prob = quantiles)))
diags <- matrix(c(object$rhat$alpha, round(object$ESS$alpha, 0)), ncol = 2)
colnames(diags) <- c('Rhat', 'ESS')
print(noquote(round(cbind(tmp.1, tmp, diags), digits)))
}
if (is(object, 'tMsPGOcc')) {
if (object$ar1) {
cat("\n")
cat("Occurrence AR(1) Temporal Covariance: \n")
tmp.1 <- t(apply(object$theta.samples, 2,
function(x) c(mean(x), sd(x))))
colnames(tmp.1) <- c("Mean", "SD")
tmp <- t(apply(object$theta.samples, 2,
function(x) quantile(x, prob = quantiles)))
diags <- matrix(c(object$rhat$theta, round(object$ESS$theta, 0)), ncol = 2)
colnames(diags) <- c('Rhat', 'ESS')
print(noquote(round(cbind(tmp.1, tmp, diags), digits)))
}
}
}