[1] 3
Instructor: Brian Gerber
Classroom: NR 243
When: Tu 11am - 12:15pm and Fr 10am - 1pm
My Office: 202A Wagar, Colorado Cooperative Research Unit
Office hours: TU 1:30pm - 2:30pm and by appointment
brian.gerber@colostate.edu
Computers: Bring laptop to class
Registration:
A mix of…
Assessment Components | Percentage of Grade |
---|---|
Course Engagement | 10% |
Lab Assignments | 40% |
Discussions | 10% |
Quizzes | 10% |
Project | 30% |
independent or group research project - highlighting a modeling application, data/code transparency, and communication of results
group development of a lecture and lab case-study that showcases a statistical application relevant to wildlife ecology and conservation
Upon successful completion of this course students will be able to:
think ‘statistically’
read quantitative ecology literature
write code to fit and interpret complex statistical models relevant to wildlife ecology and conservation
communicate statistical approaches and results
Able to read modern ecological literature
Understand what you are doing when using data and models; coding/statistics/modeling are related but not the same
Statistical modeling and coding skills are highly marketable
Taking control of your analyses
Collaborate with colleagues/statisticians
parametric
probabilistic
generative
inferential and/or predictive
Software changes all the time
Code will become obsolete
Base R functions change slower than packages
Document/Annotate code and publish it online
File management is important; use sub-folders
You need to know….
I do not know where you are starting
your objective in fitting a model
the model and its properties (not just the name)
how to interpret ALL the parameters
how the parameters are being optimized
and have justification for modeling decisions
I am a pragmatist
There are many ways to do great science
There are more ways to do meh science
Disciplines have conventions
There are foundations of scientific and statistical learning
Know the why of your decisions
Ask lots of questions to everybody all the time
Learning is a choice (in every movement)
An inclusive environment is paramount for learning
Communication is key
Everyone has something to teach and something to learn
Struggle is good. Solving problems leads to learning
BUT….
What does each panel do?
A storage place for information; stored in the “Environment”
‘Attributes’ describes the structure or information of the object
‘does stuff’; creates or manipulates objects
‘Arguments’ are the types of things a function is asking for; the inputs
object = function(argument1 = input1, argument1 = input2)
object = function(input1, input2)
for loops
Create your own function
apply/sapply/lapply/vapply
[1] -0.22895129 -0.23543173 0.25250440 -0.05512031 -0.19921642 -0.06873026
[7] -0.15605470 0.57359061 0.32028873 0.22507929
Hierarchical code organization
Help! My code doesn’t work…
cor.sp.route.cor=vector("list",n.species)
cor.sp=rep(NA,n.species)
for(s in 1:n.species){
route=new.cov.species.long.scaled[[s]]$routeID
cor.sp[s]=cor(patch.size20.species.scaled.mat.center.route[s,],patch.count20.species.scaled.mat.center.route[s,])
for(i in 1:nroutes){
temp1=patch.size20.species.scaled.mat.center.route[s,which(route==route.id[i])]
temp2=patch.count20.species.scaled.mat.center.route[,][s,which(route==route.id[i])]
if(length(temp1)>5){
cor.sp.route.cor[[s]]=abs(c(cor.sp.route.cor[[s]],cor(temp1,temp2)))
}}}
# Create Storage objects
cor.sp.route.cor=vector("list",n.species)
cor.sp=rep(NA,n.species)
#loop over species
for(s in 1:n.species)
{
route=new.cov.species.long.scaled[[s]]$routeID
cor.sp[s] = cor(patch.size20.species.scaled.mat.center.route[s,],
patch.count20.species.scaled.mat.center.route[s,]
)
# loop over species and routes
for(i in 1:nroutes)
{
temp1 = patch.size20.species.scaled.mat.center.route[s,which(route==route.id[i])]
temp2 = patch.count20.species.scaled.mat.center.route[,][s,which(route==route.id[i])]
if(length(temp1)>5){
cor.sp.route.cor[[s]]=abs(c(cor.sp.route.cor[[s]],cor(temp1,temp2)))
} #End if statement
} #End routes loop
} #End species loop