Skip to content

Commit

Permalink
added module 3 examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Kia Teymourian committed Aug 10, 2018
1 parent abbb2c8 commit b16bcc7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 51 deletions.
28 changes: 28 additions & 0 deletions Module-3-Example-1.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

# Create a vector for hights
height <- c(176, 154, 138, 196, 132, 176, 181, 169, 150, 175)

# Create a vector for bodymass
bodymass <- c(82, 49, 53, 112, 47, 69, 77, 71, 62, 78)

# Create a scotterplot
plot(bodymass, height)

# A better scotterplot
plot(bodymass, height, pch = 16, cex = 1.3, col = "blue", main = "HEIGHT PLOTTED AGAINST BODY MASS", xlab = "BODY MASS (kg)", ylab = "HEIGHT (cm)")


# Correlation
cor(bodymass, height)

cor(height, bodymass,)

# A simple linear regression
m<-lm(height ~ bodymass)

# A line on the past plot
# abline(98.0054, 0.9528)

# better would be to do this.
abline(m)

10 changes: 0 additions & 10 deletions R-Example-Program-4.R → Module-3-Example-2.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,12 @@ summary(my.model)
# create Analysis of Variance Table
anova(my.model)



# fitted values of my model
fitted(my.model)

# residuals of my model
resid(my.model)










# As an extra task describe what these plots are
plot(my.model)
File renamed without changes.
20 changes: 0 additions & 20 deletions R-Example-Program-4.1.R

This file was deleted.

21 changes: 0 additions & 21 deletions R-Example-Program-4.2.R

This file was deleted.

0 comments on commit b16bcc7

Please sign in to comment.