### import the boot package #insert code here to import boot package ### step 1 - import the data #insert code here to import data ### step 2 - analyze the data ### We'll use a new function for this that fits non-linear ### equations. It's very similar to lm, but requires a parametric structure ### and starting values, as I've specified below parInit=list(a=1,b=1) #this is a list of starting values CoyoteResults=nls(CoyoteKill~a*PreyDens/(b+PreyDens),data=datum,start=parInit) LynxResults=nls(LynxKill~a*PreyDens/(b+PreyDens),data=datum,start=parInit) ### a is the asymptotic value of the predator kill rate ### b is the prey density at which half the maximum prey kill rate is achieved ### nls is a function that fits non-linear least squares models to data summary(CoyoteResults) summary(LynxResults) ### calculate the estimated difference in the asymptotes CoyoteA=summary(CoyoteResults)$parameters[1] #extracts the value of a from the coyote regression LynxA=summary(LynxResults)$parameters[1] #extracts the value of a from the lynx regression Difference=LynxA-CoyoteA #calculates the difference in asymptotes Difference ### reports the difference in asymptotes ### step 3 and 4 - write a function to resample and reanalyze the data #insert code to complete "bootFunc" below. #Note that you can basically copy and past step 2 into bootFunc #although it will requires some modification to work correctly bootFunc=function(bootData,repeats){ } ### Step 5 - repeat function 1000 times ### create a bootstrapped object that runs the function 1000 times #insert code to run bootstrap analysis set.seed(123) #Be sure you run this code before you run the bootstrap ### Step 6 - calculate the confidence interval on the data #insert code here to calculate confidence intervals ### Step 7 - Extract sorted bootstrapped estimates of difference in asymptotes # insert code here to extract and sort bootstraped estimates of difference in asymptotes ### Step 8 - Plot the results # insert code here to plot bootstrapped estimates of the difference in asymptotes