On page 134 of Roff (2010) you are instructed to re-use a previous function from 2.15.3, swapping out "G" and "Alpha" for "X". This is fairly straight forward, but I messed it up my first try.
The original code is (2.15.3, page 132) is
FITNESS <- function(x)
{
G <- x[1]
Alpha<- x[2]
...
}
For section 2.15.5.1, this needs to be changes to
FITNESS <- function(G, Alpha) #
{
G <- G #
Alpha<- Alpha)
...
}
The upshot:
1)change it so that G and Alpha get called instead of x
2)AND be sure to assign G and Alpha to, well, G and alpha (which get defined lower in the code in Program" section of 2.15.5.1
Showing posts with label Roff (2010). Show all posts
Showing posts with label Roff (2010). Show all posts
Wednesday, October 26, 2011
von Bertalanffy growth function
The von Bertalanffy growth function can be used in evolutionary models (Roff 2010, page 132). It is also apparently a standard growth function used in modeling fish growth.
It can be expressed as a differential equation as
L'(t) = r(B)*(L(inf) - L(t))
where r(B) is the growth rate
L is length
and L(inf) is the ultimate size of the organism.
It can be expressed as a differential equation as
L'(t) = r(B)*(L(inf) - L(t))
where r(B) is the growth rate
L is length
and L(inf) is the ultimate size of the organism.
Tuesday, October 25, 2011
Multidimensional integration with adapt()
Multidimensional integration can be done in R using the adapt() function in the adapt package. This package, however, is no longer on CRAN, though it is available from the CRAN archives.
See Roff (2010), Modeling Evolution, page 97 for details
See Roff (2010), Modeling Evolution, page 97 for details
Sunday, October 23, 2011
Corrections in Roff (2010) Modeling Evolution: An Introduction to Numerical Methods

I just started working through Dr. Derek Roff's newest book, Modeling Evolution. Overall the book is great, but my printing has a lot of typos and (as of page 49) some missing lines of code.
There is updated code on his webpage on the bottom in a Word file. Everything I've cross-checked appears to be good in the version posted on the site.
Tonight I was working on plotting a 3D surface with code from page 49 of chapter 1. The plot, shown above, is cool, but I could not figure out what was missing from the code in the book. I eventually was able to reproduce the graph in the book (Figure 1.9, page 50) using code that is similar to that posted on his website.
The correction occurs on page 49. In the middle of the page the text should read:
"Same lines as previously except for deletion of plotting codes
mean(Npop.Sizes[900:1000])
} # End of function MAIN.PROG"
The "mean(Npop.Sizes[900:1000])" Is missing from the book.
Subscribe to:
Posts (Atom)