clusterSelect: Fit SpeciesMix for a range of vaules for G

Description Usage Arguments Details Value Authors Examples

Description

clusterSelect fits models with varying values of G to determine the appropriate number of archetype species.

Usage

1
2
3
#clusterSelect(sp.form,sp.data,covar.data,G=1:10,\n
#em.prefit=TRUE, em.steps=4 ,em.refit=3,\n
#est.var=FALSE,trace=TRUE)

Arguments

sp.form

an object of class "formula" (or one that can be coerced to that class):a symbolic description of the model to be fitted

sp.data

a data frame containing the species information. The frame is arranged so that each row is a site and each column is a species. Species names should be included as column names otherwise numbers from 1:S are assigned.

covar.data

a data frame containng the covariate data for each site. Names of columns must match that given in

G

Vector containing the range of archetype species to fit.

em.prefit

obtain initial parameter estimates from EM

em.steps

number of EM steps to do if using em.prefit

em.refit

refits model so that the global maxima can be found using EM.

est.var

calculate the variance covariace matrix for each group

trace

the trace of the EM steps

Details

fits multiple fitMix models across the range of values for G. Most of the arguments are passed directly to fitMix

Value

aic

vector containing the aic value for each value of G

bic

bic

fm

a list containing all output from each vaule of G.

Authors

Piers Dunstan and Scott Foster

Examples

1
2
3
4
5
6
7
G <-4
S <- 20
theta <- matrix(c(-0.9,-0.6,0.5,1,-0.9,1,0.9,-0.9),4,2,byrow=TRUE)
dat <- data.frame(y=rep(1,100),x=runif(100,0,2.5),z=rnorm(100,10,2))
dat1 <- artificial.data(y~1+x,dat,theta,S)
dat <- dat[,2:3]
clusters <- clusterSelect(obs~1+x,dat1$pa,dat,G=2:5,em.refit=2)

Example output

Loading required package: MASS
Loading required package: numDeriv
Fitting group 2 
Fitting Group 2 
Iteration | LogL 
1      |  -1345.462 
2      |  -1160.237 
3      |  -1156.355 
4      |  -1156.354 
Fitting Group 2 
Iteration | LogL 
1      |  -1310.315 
2      |  -1167.399 
3      |  -1157.23 
4      |  -1156.354 
initial  value 1156.354488 
final  value 1156.354488 
converged
Fitting group 3 
Fitting Group 3 
Iteration | LogL 
1      |  -1338.408 
2      |  -1141.557 
3      |  -1105.117 
4      |  -1095.105 
Fitting Group 3 
Iteration | LogL 
1      |  -1372.779 
2      |  -1136.457 
3      |  -1096.645 
4      |  -1094.853 
initial  value 1094.852987 
final  value 1094.848692 
converged
Fitting group 4 
Fitting Group 4 
Iteration | LogL 
1      |  -1328.118 
2      |  -1144.365 
3      |  -1102.613 
4      |  -1092.732 
Fitting Group 4 
Iteration | LogL 
1      |  -1332.356 
2      |  -1119.488 
3      |  -1094.265 
4      |  -1092.278 
initial  value 1092.278402 
iter  10 value 1078.124241
iter  20 value 1073.214849
final  value 1073.214818 
converged
Fitting group 5 
Fitting Group 5 
Iteration | LogL 
1      |  -1331.193 
2      |  -1099.792 
3      |  -1093.348 
4      |  -1091.962 
Fitting Group 5 
Iteration | LogL 
1      |  -1344.401 
2      |  -1111.242 
3      |  -1079.035 
4      |  -1073.228 
initial  value 1073.227599 
iter  10 value 1073.201088
iter  20 value 1073.190275
iter  30 value 1073.102666
final  value 1073.099036 
converged

SpeciesMix documentation built on May 2, 2019, 4:22 a.m.