Compute expectations of various measures of productivity and lexical richness for a LNRE population.
lnre.productivity.measures(model, N=NULL, measures, data.frame=TRUE,
bootstrap=FALSE, method="normal", conf.level=.95, sample=NULL,
replicates=1000, parallel=1L, verbose=TRUE, seed=NULL)
an object belonging to a subclass of lnre
,
representing a LNRE model
character vector naming the productivity measures to
be computed (see productivity.measures
for details).
Names may be abbreviated as long as they remain unique.
If unspecified or NULL
, all supported measures are included.
an integer vector, specifying the sample size(s) \(N\)
for which the productivity measures will be calculated. If
bootstrap=TRUE
, only a single sample size may be specified.
N
defaults to the sample size used for estimating model
if unspecified or set to NULL
.
if TRUE
, the return value is converted to a data frame
for convenience in interactive use (default).
if TRUE
, use parametric bootstrapping to estimate
expectations and confidence intervals for the productivity measures.
Otherwise, approximate expectations are obtained directly from the LNRE
model (see ‘Details’ below for the approximations and simplifications used).
type of confidence interval to be estimated by parametric
bootstrapping and the requested confidence level;
see bootstrap.confint
for details.
optional callback function to generate bootstrapping samples;
see lnre.bootstrap
for details and applications.
if bootstrap=TRUE
, these parameters
are passed on to lnre.bootstrap
to control the bootstrapping procedure;
see lnre.bootstrap
for documentation. In most cases, it is recommended
to set parallel
in order to speed up the expensive bootstrapping process.
If bootstrap=FALSE
, a numeric matrix or data frame listing approximate expectations of the selected productivity measures,
with one row for each sample size N
and one column for each measure
. Rows and columns are labelled.
If bootstrap=TRUE
, a numeric matrix or data frame with one column for each productivity measure
and four rows
giving the lower and upper bound of the confidence interval, an estimate of central tendency, and an estimate of spread.
See bootstrap.confint
for details.
See productivity.measures
for a list of supported measures with equations and references.
The measures Entropy
and eta
are only supported for bootstrap=TRUE
.
If bootstrap=FALSE
, expected values of the productivity measures are computed based on the following approximations:
V
, TTR
, R
and P
are linear transformations of \(V\) or \(V_1\), so expectations can be obtained directly from the EV
and EVm
methods.
C
, k
, U
and W
are nonlinear transformations of \(V\). In this case, the transformation function is approximated by a linear function around \(E[V]\), which is reasonable under typical circumstances.
Hapax
, S
, alpha2
and H
are based on ratios of two spectrum elements, in some cases with an additional nonlinear transformation. Expectations are based on normal approximations for \(V\) and \(V_i\) together with a generalisation of D<U+00ED>az-Franc<U+00E9>s and Rubio's (2013: 313) result on the ratio of two independent normal distributions; for a nonlinear transformation the same linear approximation is made as above.
K
and D
are (nearly) unbiased estimators of the population coefficient \(\delta = \sum_{i=1}^{\infty} \pi_i^2\) (Simpson 1949: 688).
Approximations used for expected values are explained in detail in Sec. 2.2 of the technical report Inside zipfR.
D<U+00ED>az-Franc<U+00E9>s, Elo<U+00ED>sa and Rubio, Francisco J. (2013). On the existence of a normal approximation to the distribution of the ratio of two independent normal random variables. Statistical Papers, 54(2), 309--323.
Simpson, E. H. (1949). Measurement of diversity. Nature, 163, 688.
productivity.measures
computes productivity measures from observed data sets.
See lnre
for further information on LNRE models, and
lnre.bootstrap
and bootstrap.confint
for details on the bootstrapping procedure.
# NOT RUN {
## plausible model for an author's vocabulary
model <- lnre("fzm", alpha=0.4, B=0.06, A=1e-12)
## approximate expectation for different sample sizes
lnre.productivity.measures(model, N=c(1000, 10000, 50000))
## estimate sampling distribution: 95% interval, mean, s.d.
## (using parametric bootstrapping, only one sample size at a time)
lnre.productivity.measures(model, N=1000, bootstrap=TRUE)
# }
Run the code above in your browser using DataLab