Skip to content

Instantly share code, notes, and snippets.

@jwbowers
Last active December 23, 2015 22:59
Show Gist options
  • Save jwbowers/6706943 to your computer and use it in GitHub Desktop.
Save jwbowers/6706943 to your computer and use it in GitHub Desktop.
##Load a small version of Fortna's data.
load(url("http://jakebowers.org/PS230/pk2.df.rda"))
## Make a new dataframe with no missing values at all
pk.good<-na.omit(pk.df)
## Load the mosaic library for plotting etc
library(mosaic)
ssr <- function(intercept,slope,thedata=pk.good){
the.model.values <- with(thedata, intercept + (slope * wardur)) ## calc model values from model function
the.residuals <- with(thedata, dead - the.model.values) ## residuals=observed values - model values
sum(the.residuals^2) ##sum of squared residuals
}
line1<-c(450000,-500)
line2<-c(1000,50000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment