Skip to content

Commit

Permalink
lots of monotonous edits to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
doserjef committed Oct 14, 2023
1 parent 246e117 commit c873061
Show file tree
Hide file tree
Showing 63 changed files with 1,852 additions and 1,875 deletions.
18 changes: 9 additions & 9 deletions man/DS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

\usage{
DS(abund.formula, det.formula, data, inits, priors, tuning,
n.batch, batch.length, accept.rate = 0.43, family = 'Poisson',
transect = 'line', det.func = 'halfnormal',
n.omp.threads = 1, verbose = TRUE,
n.report = 100, n.burn = round(.10 * n.batch * batch.length), n.thin = 1,
n.chains = 1, ...)
n.batch, batch.length, accept.rate = 0.43, family = 'Poisson',
transect = 'line', det.func = 'halfnormal',
n.omp.threads = 1, verbose = TRUE,
n.report = 100, n.burn = round(.10 * n.batch * batch.length), n.thin = 1,
n.chains = 1, ...)
}

\description{
Expand Down Expand Up @@ -73,18 +73,18 @@ DS(abund.formula, det.formula, data, inits, priors, tuning,
Gamma distribution. The hyperparameters of the inverse-Gamma distribution
are passed as a list of length two with first and second elements corresponding
to the shape and scale parameters, respectively, which are each specified as
vectors of length equal to the number of random intercepts or of length one
vectors of length equal to the number of random intercepts/slopes or of length one
if priors are the same for all random effect variances.}
\item{tuning}{a single numeric value representing the initial variance of the
adaptive sampler for \code{beta}, \code{alpha}, \code{beta.star} (the abundance
random effect values), \code{alpha.star} (the detection random effect values), and
\code{kappa}. See Roberts and Rosenthal (2009) for details.}
\item{n.batch}{the number of MCMC batches in each chain to run for the Adaptive MCMC
\item{n.batch}{the number of MCMC batches in each chain to run for the adaptive MCMC
sampler. See Roberts and Rosenthal (2009) for details.}
\item{batch.length}{the length of each MCMC batch in each chain to run for the Adaptive
\item{batch.length}{the number of MCMC samples in each batch in each chain to run for the Adaptive
MCMC sampler. See Roberts and Rosenthal (2009) for details.}
\item{accept.rate}{target acceptance rate for Adaptive MCMC. Default is
Expand Down Expand Up @@ -238,7 +238,7 @@ dist.breaks <- dat$dist.breaks
covs <- cbind(X, X.p)
colnames(covs) <- c('int.abund', 'abund.cov.1', 'abund.cov.2', 'abund.cov.3',
'int.det', 'det.cov.1')
'int.det', 'det.cov.1')
data.list <- list(y = y,
covs = covs,
Expand Down
67 changes: 33 additions & 34 deletions man/abund.Rd
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
\name{abund}
\alias{abund}
\title{Function for Fitting Single-Species Abundance GLMs}
\title{Function for Fitting Univariate Abundance GLMMs}

\usage{
abund(formula, data, inits, priors, tuning,
n.batch, batch.length, accept.rate = 0.43, family = 'Poisson',
n.omp.threads = 1, verbose = TRUE,
n.report = 100, n.burn = round(.10 * n.batch * batch.length), n.thin = 1,
n.chains = 1, save.fitted = TRUE, ...)
n.batch, batch.length, accept.rate = 0.43, family = 'Poisson',
n.omp.threads = 1, verbose = TRUE,
n.report = 100, n.burn = round(.10 * n.batch * batch.length), n.thin = 1,
n.chains = 1, save.fitted = TRUE, ...)
}

\description{
Function for fitting single-species abundance generalized linear models
Function for fitting univariate abundance generalized linear (mixed) models
}

\arguments{
Expand All @@ -21,7 +21,7 @@ abund(formula, data, inits, priors, tuning,
and slopes are allowed using lme4 syntax (Bates et al. 2015).}
\item{data}{a list containing data necessary for model fitting.
Valid tags are \code{y}, \code{covs}, and \code{offset}. \code{y}
Valid tags are \code{y}, \code{covs}, \code{z}, and \code{offset}. \code{y}
is a vector, matrix, or data frame of the observed count values. If a vector,
the values represent the observed counts at each site. If multiple replicate
observations are obtained at the sites (e.g., sub-samples, repeated sampling over
Expand All @@ -38,7 +38,7 @@ abund(formula, data, inits, priors, tuning,
given site. For zero-inflated Gaussian models, the tag \code{z} is used to specify the
binary component of the zero-inflated model and should have the same length as \code{y}.
\code{offset} is an offset to use in the abundance model (e.g., an area offset).
This can be either a single value, a vector with an offset for each site (e.g., if survey area differed in size), or a six x replicate matrix if more than one counts are available at a given site.}
This can be either a single value, a vector with an offset for each site (e.g., if survey area differed in size), or a site x replicate matrix if more than one count is available at a given site.}
\item{inits}{a list with each tag corresponding to a parameter name.
Valid tags are \code{beta}, \code{kappa}, \code{sigma.sq.mu}, and \code{tau.sq}.
Expand Down Expand Up @@ -71,20 +71,20 @@ abund(formula, data, inits, priors, tuning,
Gamma distribution. The hyperparameters of the inverse-Gamma distribution
are passed as a list of length two with first and second elements corresponding
to the shape and scale parameters, respectively, which are each specified as
vectors of length equal to the number of random intercepts or of length one
vectors of length equal to the number of random effects or of length one
if priors are the same for all random effect variances. \code{tau.sq} is the
residual variance for Gaussian (or zero-inflated Gaussian) models, and it is assigned
an inverse-Gamma prior. The hyperparameters of the inverse-Gamma are passed as a vector
of length two, with the first and second element corresponding to the shape and
scale parameters, respectively.}

\item{tuning}{a list with each tag corresponding to a parameter name, whose
\item{tuning}{a list with each tag corresponding to a parameter name,
whose value defines the initial variance of the adaptive sampler.
Valid tags are \code{beta}, \code{beta.star} (the abundance
random effect values), and \code{kappa}. See Roberts and Rosenthal (2009) for details.
Note that no tuning is necessary for Gaussian or zero-inflated Gaussian models.}

\item{n.batch}{the number of MCMC batches in each chain to run for the Adaptive MCMC
\item{n.batch}{the number of MCMC batches in each chain to run for the adaptive MCMC
sampler. See Roberts and Rosenthal (2009) for details.}

\item{batch.length}{the length of each MCMC batch in each chain to run for the Adaptive
Expand Down Expand Up @@ -204,27 +204,25 @@ kappa <- 0.5
sp <- FALSE
family <- 'NB'
dat <- simAbund(J.x = J.x, J.y = J.y, n.rep = n.rep, beta = beta,
kappa = kappa, mu.RE = mu.RE, sp = sp, family = 'NB')
kappa = kappa, mu.RE = mu.RE, sp = sp, family = 'NB')

y <- dat$y
X <- dat$X
X.re <- dat$X.re

covs <- list(int = X[, , 1],
abund.cov.1 = X[, , 2],
abund.cov.2 = X[, , 3],
abund.cov.3 = X[, , 4],
abund.factor.1 = X.re[, , 1])
abund.cov.1 = X[, , 2],
abund.cov.2 = X[, , 3],
abund.cov.3 = X[, , 4],
abund.factor.1 = X.re[, , 1])

data.list <- list(y = y,
covs = covs)
data.list <- list(y = y, covs = covs)

# Priors
prior.list <- list(beta.normal = list(mean = 0, var = 100),
kappa.unif = c(0.001, 10))
# Starting values
inits.list <- list(beta = 0,
kappa = kappa)
inits.list <- list(beta = 0, kappa = kappa)

tuning <- list(kappa = 0.2, beta = 0.1, beta.star = 0.2)
n.batch <- 5
Expand All @@ -233,19 +231,20 @@ n.burn <- 0
n.thin <- 1
n.chains <- 1

out <- abund(formula = ~ abund.cov.1 + abund.cov.2 + abund.cov.3 + (1 | abund.factor.1),
data = data.list,
n.batch = n.batch,
batch.length = batch.length,
inits = inits.list,
tuning = tuning,
priors = prior.list,
accept.rate = 0.43,
n.omp.threads = 1,
verbose = TRUE,
n.report = 1,
n.burn = n.burn,
n.thin = n.thin,
n.chains = n.chains)
out <- abund(formula = ~ abund.cov.1 + abund.cov.2 + abund.cov.3 +
(1 | abund.factor.1),
data = data.list,
n.batch = n.batch,
batch.length = batch.length,
inits = inits.list,
tuning = tuning,
priors = prior.list,
accept.rate = 0.43,
n.omp.threads = 1,
verbose = TRUE,
n.report = 1,
n.burn = n.burn,
n.thin = n.thin,
n.chains = n.chains)
summary(out)
}
30 changes: 14 additions & 16 deletions man/dataNMixSim.rda.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

\description{
A simulated data set of repeated count data for 6 species across 225 sites with a maximum
of 5 replicate surveys performed at a given site.
of 3 replicate surveys performed at a given site.
}

\usage{
Expand All @@ -20,19 +20,19 @@ data(dataNMixSim)
\code{dataNMixSim} is a list with four elements:

\code{y}: a three-dimensional array of count data with
dimensions of species (6), sites (225) and replicates (5).
dimensions of species (6), sites (225) and replicates (3).

\code{abund.covs}: a numeric matrix with 373 rows and two columns consisting
\code{abund.covs}: a numeric matrix with 225 rows and two columns consisting
of a continuous covariate and a categorical variable which may both influence
abundance of the different species.

\code{det.covs}: a list of two numeric matrices with 225 rows and 5 columns.
\code{det.covs}: a list of two numeric matrices with 225 rows and 3 columns.
Both matrices contain a continuous covariate that may affect detection probability
of the species

\code{coords}: a numeric matrix with 225 rows and two columns containing the
site coordinates (Easting and Northing). Note the data are generated across
a a unit square (i.e., the x and y coordinates are both between 0 and 1).
site coordinates (X and Y). Note the data are generated across
a unit square (i.e., the x and y coordinates are both between 0 and 1).
}

\keyword{datasets}
Expand Down Expand Up @@ -62,8 +62,8 @@ data(dataNMixSim)
# Random effects
mu.RE <- list()
mu.RE <- list(levels = c(10),
sigma.sq.mu = c(0.5),
beta.indx = list(1))
sigma.sq.mu = c(0.5),
beta.indx = list(1))
p.RE <- list()
# Draw species-level effects from community means.
beta <- matrix(NA, nrow = n.sp, ncol = p.abund)
Expand All @@ -83,11 +83,9 @@ data(dataNMixSim)
family <- 'Poisson'

dat <- simMsNMix(J.x = J.x, J.y = J.y, n.rep = n.rep, n.sp = n.sp, beta = beta, alpha = alpha,
mu.RE = mu.RE, p.RE = p.RE, sp = sp, kappa = kappa, family = family,
factor.model = factor.model, phi = phi,
cov.model = 'exponential', n.factors = n.factors)
table(dat$N)
apply(dat$N, 1, sum)
mu.RE = mu.RE, p.RE = p.RE, sp = sp, kappa = kappa, family = family,
factor.model = factor.model, phi = phi,
cov.model = 'exponential', n.factors = n.factors)

y <- dat$y
X <- dat$X
Expand All @@ -102,10 +100,10 @@ data(dataNMixSim)
colnames(abund.covs) <- c('int', 'abund.cov.1', 'abund.factor.1')
abund.covs <- abund.covs[, -1]
det.covs <- list(det.cov.1 = X.p[, , 2],
det.cov.2 = X.p[, , 3])
det.cov.2 = X.p[, , 3])
dataNMixSim <- list(y = y,
abund.covs = abund.covs,
det.covs = det.covs,
abund.covs = abund.covs,
det.covs = det.covs,
coords = coords)
}
}
2 changes: 1 addition & 1 deletion man/fitted.DS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\title{Extract Model Fitted Values for DS Object}

\description{
Method for extracting model fitted values and cell-specific detection probabilities from a distance sampling (\code{DS}) model.
Method for extracting model fitted values and cell-specific detection probabilities from a hierarchical distance sampling (\code{DS}) model.
}

\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/fitted.abund.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\title{Extract Model Fitted Values for abund Object}

\description{
Method for extracting model fitted values from a fitted generalized linear abundance (\code{abund}) model.
Method for extracting model fitted values from a fitted GLMM (\code{abund}).
}

\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/fitted.lfMsAbund.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\title{Extract Model Fitted Values for lfMsAbund Object}

\description{
Method for extracting model fitted values from a fitted latent factor multi-species abundance GLM (\code{lfMsAbund}).
Method for extracting model fitted values from a fitted latent factor multivariate GLMM (\code{lfMsAbund}).
}

\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/fitted.lfMsDS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\title{Extract Model Fitted Values for lfMsDS Object}

\description{
Method for extracting model fitted values and cell-specific detection probabilities from a latent factor multi-species distance sampling (\code{lfMsDS}) model.
Method for extracting model fitted values and cell-specific detection probabilities from a latent factor multi-species hierarchical distance sampling (\code{lfMsDS}) model.
}

\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/fitted.msAbund.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\title{Extract Model Fitted Values for msAbund Object}

\description{
Method for extracting model fitted values from a fitted multi-species abundance GLM (\code{msAbund}).
Method for extracting model fitted values from a fitted multivariate GLMM (\code{msAbund}).
}

\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/fitted.msDS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\title{Extract Model Fitted Values for msDS Object}

\description{
Method for extracting model fitted values and cell-specific detection probabilities from a multi-species distance sampling (\code{msDS}) model.
Method for extracting model fitted values and cell-specific detection probabilities from a multi-species hierarchical distance sampling (\code{msDS}) model.
}

\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/fitted.sfMsAbund.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\title{Extract Model Fitted Values for sfMsAbund Object}

\description{
Method for extracting model fitted values from a fitted spatial factor multi-species abundance GLM (\code{sfMsAbund}).
Method for extracting model fitted values from a fitted spatial factor multivariate GLMM (\code{sfMsAbund}).
}

\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/fitted.sfMsDS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\title{Extract Model Fitted Values for sfMsDS Object}

\description{
Method for extracting model fitted values and cell-specific detection probabilities from a spatial factor multi-species distance sampling (\code{sfMsDS}) model.
Method for extracting model fitted values and cell-specific detection probabilities from a spatial factor multi-species hierarchical distance sampling (\code{sfMsDS}) model.
}

\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/fitted.spAbund.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\title{Extract Model Fitted Values for spAbund Object}

\description{
Method for extracting model fitted values from a fitted spatial generalized linear abundance (\code{spAbund}) model.
Method for extracting model fitted values from a fitted spatial GLMM (\code{spAbund}).
}

\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/fitted.spDS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\title{Extract Model Fitted Values for spDS Object}

\description{
Method for extracting model fitted values and cell-specific detection probabilities from a spatial distance sampling (\code{spDS}) model.
Method for extracting model fitted values and cell-specific detection probabilities from a spatial hierarchical distance sampling (\code{spDS}) model.
}

\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/fitted.svcAbund.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\title{Extract Model Fitted Values for svcAbund Object}

\description{
Method for extracting model fitted values from a fitted spatially-varying coefficient generalized linear abundance (\code{svcAbund}) model.
Method for extracting model fitted values from a fitted spatially-varying coefficient GLMM (\code{svcAbund}).
}

\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/fitted.svcMsAbund.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
\title{Extract Model Fitted Values for svcMsAbund Object}

\description{
Method for extracting model fitted values from a fitted spatial factor multi-species abundance GLM (\code{svcMsAbund}).
Method for extracting model fitted values from a fitted multivatiate spatially-varying coefficient GLMM (\code{svcMsAbund}).
}

\usage{
Expand Down
2 changes: 1 addition & 1 deletion man/hbefCount2015.rda.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ data(hbefCount2015)
\code{y}: a three-dimensional array of count data with
dimensions of species (12), sites (373) and replicates (3).

\code{abund.covs}: a numeric matrix with 373 rows and one column consisting of the
\code{abund.covs}: a data frame with 373 rows and one column consisting of the
elevation at each site.

\code{det.covs}: a list of two numeric matrices with 373 rows and 3 columns.
Expand Down
Loading

0 comments on commit c873061

Please sign in to comment.