##### Code for Multivariable Modeling and swamping ### Import the data datum=read.csv(file.choose()) head(datum) ### Plot the data plot(Size~Sex,data=datum) # plot relationship between size and sex plot(Size~Age,data=datum) # plot relationship between size and age ### single variate analyses between size and age results=lm(Size~Age,data=datum) ### single variable analysis of age summary(results) #note that estimated effect of age is pretty good estimate #Residual standard is a little large, however. ### single variable analysis between size and sex results2=lm(Size~Sex,data=datum) ### single variable analysis of sex summary(results2) #note that estimated effect of sex is o.k. (large SE), but not significant #too much noise #residual standard error is very large ### multi-variable analysis results3=lm(Size~Age+Sex,data=datum) ### Note that plus doesn't actually mean 'add' - it means include both in model summary(results3) # Note that estimated effect of age and sex are right on