QPmat: Build a projection matrix from a time series of individuals...

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/QPmat.R

Description

Builds one projection matrix from a time series of number (or densities) of individuals per stage (size classes or life stages) using Wood's quadratic programming method. The matrix model also requires a constraint matrix C, vector b, and vector listing nonzero elements of desired projection matrix.

Usage

1
QPmat(nout, C, b, nonzero)

Arguments

nout

A time series of population vectors

C

constraint matrix

b

b vector

nonzero

indices of the non-zero elements of the transition matrix (counting by column)

Details

converted Matlab code from Example 6.3 in Caswell (2001)

Value

A projection matrix.

Note

This function requires solve.QP in the quadprog package.

Author(s)

Adapted to R by Patrick Nantel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
## list nonzero elements
nonzero <- c( 1, 2, 5, 6, 7, 9)
## create C matrix
C <- rbind(diag(-1,6), c(1,1,0,0,0,0), c(0,0,1,1,0,0), c(0,0,0,0,0,1))
## calculate b (transpose is not necessary - either way works)
b <- apply(C, 1, max)
QPmat(nematode, C,b,nonzero)

## End(Not run)

popbio documentation built on March 26, 2020, 8:44 p.m.