Last active
December 23, 2015 22:59
-
-
Save jwbowers/6706943 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##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