DynamicModelsLabsInR

DynamicModelsLabsInR - CONTENTS 1 An introduction to R for...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CONTENTS 1 An introduction to R for dynamic models in biology Last compile: February 8, 2008 Stephen P. Ellner 1 and John Guckenheimer 2 1 Department of Ecology and Evolutionary Biology, and 2 Department of Mathematics Cornell University, Ithaca NY 14853 Contents 1 Interactive calculations 4 2 An interactive session: ftting a linear regression model 6 3 Script fles and data fles 8 4 Vectors 11 5 Matrices 14 5 .1 cb indandrb ind. ......................................... 15 5 .2 Ma t r ixadd r e s s ing . ....................................... 16 5.3 Matrix operations and matrix-vector multiplication . . . . . . . . . . . . . . . . . . . . . . 16 6 Iteration (“Looping”) 17 6 .1 F o r - loop s ............................................. 17 6 .2 Wh i l e - s............................................ 19 7 Branching 21 8 Numerical Matrix Algebra 22 8.1 Eigenvalues and eigenvectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 8.2 Eigenvalue sensitivities and elasticities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 8.3 Finding the eigenvalue with largest real part . . . . . . . . . . . . . . . . . . . . . . . . . . 25 9 Creating new Functions 26 10 A simulation project 27 11 Coin tossing and Markov Chains 28 11.1 Markov chains and residence times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CONTENTS 2 12 The Hodgkin-Huxley model 32 12 .1G e t t ings ta r t ed. ......................................... 34 13 Solving systems of differential equations 36 13 .1A lw ay su s el soda !......................................... 39 .2Th elog st r i ck. .......................................... 14 Equilibrium points and linearization 40 15 Phase-plane analysis and the Morris-Lecar model 42 16 Simulating Discrete-Event Models 45 17 Simulating dynamics in systems with spatial patterns 47 17 en e ra lm e thodo fl in e s ..................................... 49 18 References 49 Preface These notes for computer labs accompany our textbook Dynamic Models in Biology (Princeton Univer- sity Press 2006), but they can also be used as a “standalone” introduction to R as a scripting language for simulating dynamic models of biological systems. They are based in part on course materials by former TAs Colleen Webb, Jonathan Rowell and Daniel Fink at Cornell University, Lou Gross (University of Tennessee) and Paul Fackler (NC State University), and on the book Getting Started with Matlab by Rudra Pratap (Oxford University Press). We also have drawn on the documentation supplied with R (R Development Core Team 2005). The current home for these notes is www.cam.cornell.edu/ dmb/DMBsupplements.html , a web page for the textbook that we maintain ourselves. If that fails, an up-to-date link should be in the book’s listing at the publisher ( www.pupress.princeton.edu ). Parallel notes and script ±les for Matlab are also available at those sites. Sections 1-7 are a general introduction to some basics of R programming. We generally cover those in two or three 2-hour lab sessions, depending on how much previous experience students have had. Rather than lecturing, we have students work through them individually, asking for help as needed and having us or a TA check their exercise solutions. Those sections contain many sample calculations. It is important to do them yourselves – type them in at your keyboard and see what happens on your screen to get the feel of working in R . All exercises in the middle of a section should be done immediately when you get to them, and make sure that you have them right before moving on. Exercises at the ends of sections may be more appropriate as homework exercises. However the exercises are all straightforward
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/25/2008 for the course BIOEE 3620 taught by Professor Ellner/guckenheimer during the Spring '08 term at Cornell.

Page1 / 50

DynamicModelsLabsInR - CONTENTS 1 An introduction to R for...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online