Last data update: 2014.03.03

R: Maximization of the loglikelihood under the Guilds Model,...
maxLikelihood.GuildsConditionalR Documentation

Maximization of the loglikelihood under the Guilds Model, conditioned on guild size.

Description

This function computes the maximum likelihood estimates of the parameters of the guilds model, conditioned on guild size.

Usage

maxLikelihood.Guilds.Conditional(initVals, model, method, SADX, SADY, verbose = TRUE)

Arguments

initVals

initVals corresponds to a vector of parameter values in which to start the Maxmimum Likelihood algorithm, depending on the provided model:
- model: "D0" parameters = c(theta, alpha)
- model: "D1" parameters = c(theta, alpha X, alpha Y)

model

The chosen model to calculate the maximum likelihood for, please note that the vector of parameters should contain the corresponding parameters in the right order. The user can pick one of these models:
- "D0"
- "D1"

method

Optimization of the Likelihood can be done using two different methods:
- "simplex": this method makes use of the "Nelder Mead" optimization method
- "subplex": makes use of the subplex method from the package "subplex"
Please note that we have explicitly not used the "optim" method, since this method tends to provide less reliable outcomes.

SADX

The Species Abundance Distribution of guild X

SADY

The Species Abundance Distribution of guild Y

verbose

TRUE/FALSE flag, indicates whether intermediate output is shown on screen

Value

if the method used was "simplex", the output is a list containing the following:

par

a vector containing the parameter values at the maximum likelihood

fvalues

the likelihood at the corresponding parameter values

conv

gives a message on convergence of optimization; conv = 0 means convergence


if the method used was "subplex", the output is a list containing the following:

par

a vector containing the parameter values at the maximum likelihood

value

the likelihood at the corresponding parameter values

counts

Number of function evaluations required

convergence

-2: invalid input
-1: number of maximum function evaluations exceeded
0: success: convergence
1: limit of machine precision reached

message

A character string giving a diagnostic message from the optimizer,

hessian

Hessian matrix (not implemented for this package)

Author(s)

Thijs Janzen

Examples

initParams <- c(20,0.1); #Initial parameters for the D0 model, c(theta,alpha)
maxLikelihood.Guilds.Conditional(initParams,model="D0", method="simplex", 
				 SADX = 1:20, SADY = 1:20, verbose = TRUE)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(GUILDS)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GUILDS/maxLikelihood.Guilds.Conditional.Rd_%03d_medium.png", width=480, height=480)
> ### Name: maxLikelihood.GuildsConditional
> ### Title: Maximization of the loglikelihood under the Guilds Model,
> ###   conditioned on guild size.
> ### Aliases: maxLikelihood.Guilds.Conditional
> 
> ### ** Examples
> 
> initParams <- c(20,0.1); #Initial parameters for the D0 model, c(theta,alpha)
> maxLikelihood.Guilds.Conditional(initParams,model="D0", method="simplex", 
+ 				 SADX = 1:20, SADY = 1:20, verbose = TRUE)
20.000       20.0000       0.1000       0.1000        -54.478
10.500       10.5000       0.1000       0.1000        -59.713
20.000       20.0000       0.1045       0.1045        -54.414
1 20 0.1 -49.4978980012553 initial 
29.500       29.5000       0.1045       0.1045        -55.171
24.750       24.7500       0.1034       0.1034        -54.451
2 20 0.104477611940299 -49.4408280013288 contract outside 
15.250       15.2500       0.1011       0.1011        -55.739
22.375       22.3750       0.1028       0.1028        -54.331
3 22.375 0.102798507462687 -49.3939074211387 contract inside 
22.375       22.3750       0.1073       0.1073        -54.330
4 22.375 0.102798507462687 -49.3939074211387 reflect 
24.750       24.7500       0.1056       0.1056        -54.474
21.188       21.1875       0.1048       0.1048        -54.337
5 21.1875 0.104757462686567 -49.3851539656833 contract inside 
21.188       21.1875       0.1003       0.1003        -54.375
22.078       22.0781       0.1055       0.1055        -54.324
6 21.1875 0.104757462686567 -49.3851539656833 contract inside 
20.891       20.8906       0.1075       0.1075        -54.334
20.148       20.1484       0.1098       0.1098        -54.357
7 20.890625 0.107486007462687 -49.3807487194669 reflect 
20.000       20.0000       0.1067       0.1067        -54.390
21.559       21.5586       0.1058       0.1058        -54.324
8 21.55859375 0.105824393656716 -49.3798037796147 contract inside 
21.262       21.2617       0.1086       0.1086        -54.322
21.299       21.2988       0.1105       0.1105        -54.320
9 21.26171875 0.108552938432836 -49.3767324748254 reflect 
21.930       21.9297       0.1069       0.1069        -54.322
21.150       21.1504       0.1073       0.1073        -54.327
10 21.26171875 0.108552938432836 -49.3767324748254 contract inside 
20.854       20.8535       0.1101       0.1101        -54.327
11 21.26171875 0.108552938432836 -49.3767324748254 reflect 
20.965       20.9648       0.1113       0.1113        -54.323
21.011       21.0112       0.1103       0.1103        -54.323
12 21.01123046875 0.110295446595149 -49.3764868612535 contract outside 
21.419       21.4194       0.1088       0.1088        -54.320
20.995       20.9950       0.1097       0.1097        -54.324
13 20.9949951171875 0.109745037021922 -49.3764235630301 contract inside 
20.745       20.7445       0.1115       0.1115        -54.327
21.132       21.1324       0.1093       0.1093        -54.322
14 21.1324157714844 0.109286590120686 -49.3763821981449 contract inside 
21.116       21.1162       0.1087       0.1087        -54.324
21.037       21.0375       0.1099       0.1099        -54.323
15 21.037467956543 0.109905630083226 -49.3763772169278 contract inside 
21.175       21.1749       0.1094       0.1094        -54.322
21.040       21.0400       0.1097       0.1097        -54.323
16 21.0399684906006 0.109670573561939 -49.3763551788058 contract inside 
20.945       20.9450       0.1103       0.1103        -54.324
21.086       21.0856       0.1095       0.1095        -54.323
17 21.0855669975281 0.109537345971634 -49.3763468034375 contract inside 
21.088       21.0881       0.1093       0.1093        -54.323
18 21.0855669975281 0.109537345971634 -49.3763468034375 reflect 
21.134       21.1337       0.1092       0.1092        -54.323
21.063       21.0634       0.1095       0.1095        -54.323
19 21.0633928775787 0.109545195636465 -49.3763438580179 contract inside 
21.061       21.0609       0.1098       0.1098        -54.323
21.081       21.0813       0.1094       0.1094        -54.323
20 21.0633928775787 0.109545195636465 -49.3763438580179 contract inside 
21.059       21.0591       0.1094       0.1094        -54.323
21.079       21.0790       0.1095       0.1095        -54.323
21 21.0789501518011 0.109510416926733 -49.3763428988429 contract inside 
21.061       21.0611       0.1096       0.1096        -54.323
21.076       21.0762       0.1095       0.1095        -54.323
22 21.0789501518011 0.109510416926733 -49.3763428988429 contract inside 
21.092       21.0918       0.1094       0.1094        -54.323
21.070       21.0705       0.1095       0.1095        -54.323
23 21.0704896328971 0.109518900351015 -49.3763426448607 contract inside 
21.073       21.0732       0.1096       0.1096        -54.323
21.075       21.0755       0.1095       0.1095        -54.323
24 21.0754712584894 0.109494725921636 -49.3763425659297 contract inside 
21.067       21.0670       0.1095       0.1095        -54.323
21.076       21.0760       0.1095       0.1095        -54.323
25 21.0759652987472 0.109508615031529 -49.3763424931012 contract inside 
21.081       21.0809       0.1095       0.1095        -54.323
21.073       21.0731       0.1095       0.1095        -54.323
26 21.0731039557577 0.109510285413799 -49.376342487083 contract inside 
21.074       21.0736       0.1095       0.1095        -54.323
21.073       21.0727       0.1095       0.1095        -54.323
27 21.0735979960155 0.109524174523692 -49.3763424476313 reflect 
21.071       21.0707       0.1095       0.1095        -54.323
21.075       21.0747       0.1095       0.1095        -54.323
28 21.0746581373169 0.109512922500137 -49.3763424434152 contract inside 
21.075       21.0752       0.1095       0.1095        -54.323
21.074       21.0736       0.1095       0.1095        -54.323
29 21.0736160112119 0.109514416962857 -49.3763424392751 contract inside 
21.075       21.0747       0.1095       0.1095        -54.323
21.074       21.0739       0.1095       0.1095        -54.323
30 21.0738675351399 0.109518922127594 -49.3763424342705 contract inside 
21.073       21.0728       0.1095       0.1095        -54.323
21.073       21.0733       0.1095       0.1095        -54.323
31 21.0738675351399 0.109518922127594 -49.3763424342705 contract outside 
21.074       21.0735       0.1095       0.1095        -54.323
21.074       21.0736       0.1095       0.1095        -54.323
32 21.0735957871673 0.109516574780269 -49.3763424338267 contract inside 
21.074       21.0742       0.1095       0.1095        -54.323
21.074       21.0735       0.1095       0.1095        -54.323
33 21.0735076261295 0.109518145760851 -49.3763424326906 contract inside 
21.073       21.0732       0.1095       0.1095        -54.323
21.074       21.0737       0.1095       0.1095        -54.323
34 21.0737096208942 0.109518141199077 -49.3763424322804 contract inside 
21.074       21.0736       0.1095       0.1095        -54.323
21.074       21.0736       0.1095       0.1095        -54.323
35 21.0737096208942 0.109518141199077 -49.3763424322804 contract outside 
21.074       21.0738       0.1095       0.1095        -54.323
21.074       21.0736       0.1095       0.1095        -54.323
36 21.0735849787093 0.109518340137648 -49.3763424322781 contract inside 
21.074       21.0737       0.1095       0.1095        -54.323
21.074       21.0737       0.1095       0.1095        -54.323
37 21.0736634288606 0.109517897087638 -49.3763424322299 contract outside 
Optimization has terminated successfully. 
$par
[1] 21.0736634  0.1095179

$fvalues
[1] -49.37634

$conv
[1] 0

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>