Skip to content

Instantly share code, notes, and snippets.

@padpadpadpad
Last active January 4, 2017 11:34
Show Gist options
  • Save padpadpadpad/2932fbb87200df99c1af0477bbb0d766 to your computer and use it in GitHub Desktop.
Save padpadpadpad/2932fbb87200df99c1af0477bbb0d766 to your computer and use it in GitHub Desktop.
Calculating bTopt
# load packages
library(nlsLoop)
library(tidyverse) # just need dplyr
# load in data
data(Chlorella_TRC)
# fit nlsLoop object
fits <- nlsLoop(ln.rate ~ schoolfield.high(ln.c, Ea, Eh, Th, temp = K, Tc = 20),
data = Chlorella_TRC,
tries = 500,
id_col = 'id2',
param_bds = c(-30, 30, 0, 10, 0, 30, 245, 385),
r2 = 'Y',
supp.errors = 'Y',
AICc = 'Y',
na.action = na.omit,
lower = c(ln.c=-10, Ea=0, Eh=0, Th=0))
# add columns
fits$params <- mutate(fits$params,
Topt = Topt(Eh, Th, Ea, K = 'N'),
bTopt = schoolfield.high(ln.c, Ea, Eh, Th, temp = Topt + 273.15, Tc = 20))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment