predPref: parameter estimation

Description Usage Arguments Value See Also Examples

Description

Estimates parameters of predator preferences model and calculates LRT. Eaten and caught dataframes are indexed with rows across time points and columns of prey species.

Usage

1
2
predPref(eaten, caught, hypotheses = c("c", "Ct"), alpha = 0.05,
  em_maxiter = 1000)

Arguments

eaten

a dataframes of eatings preferences; TxS

caught

a dataframes of caught prey species; TxS

hypotheses

a 2-tuple specifying the null and alternative hypotheses, respectively

alpha

LRT level of significance

em_maxiter

maximum number of iterations allowed for EM algorithm

Value

A list of class 'predPref' with the following elements:

null: parameters as estimated under the specified null hypothesis.

alt: parameters as estimated under the specified alternative hypothesis.

loglikH0: the null hypothesis log-likelihood, with constants not accounted for.

loglikH1: the alternative hypothesis log-likelihood, with constants not accounted for.

J: a column vector of dimension T containing the number of predators in each time period.

I: a column vector of dimension T containing the number of traps in each time period.

LRT: the likelihood ratio test statistics.

hypotheses: a 2-tuple of the user specified hypotheses.

data.name: a character string giving the names of the data.

See Also

simPref summary.predPref

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# set parameters
Predators <- Traps <- 100
PreySpecies <- 2
Times <- 5
g <- matrix(sqrt(2), nrow=Times, ncol=PreySpecies)     # gamma
l <- matrix(seq(0.4,1.8,length.out=5)*sqrt(2), nrow=Times, ncol=PreySpecies) # ct

# fit model
## Not run: 
fdata <- simPref(PreySpecies, Times, Predators, Traps, l, g, EM=FALSE)
predPref(fdata$eaten, fdata$caught, hypotheses=c('ct', 'cst'))

## End(Not run)

spiders documentation built on May 2, 2019, 12:30 p.m.