Assignment 1

About Me

My name is Syd Del Colombo, I am a second year student doing a major in mathematics. In my spare time when I am not at school I enjoy doing art and hanging out with my friends. I love to going out, explore and party all around the world

.Me (on the right) enjoying a drink on a rooftop bar in Madrid.

Me (on the right) enjoying a drink on a rooftop bar in Madrid.

anorexia<-na.omit(read.csv("anorexia.csv"))
str(anorexia)
'data.frame':   72 obs. of  4 variables:
 $ subj   : int  1 2 3 4 5 6 7 8 9 10 ...
 $ therapy: chr  "b" "b" "b" "b" ...
 $ before : num  80.5 84.9 81.5 82.6 79.9 88.7 94.9 76.3 81 80.5 ...
 $ after  : num  82.2 85.6 81.4 81.9 76.4 ...
anorexia$therapy<-factor(anorexia$therapy)
str(anorexia)
'data.frame':   72 obs. of  4 variables:
 $ subj   : int  1 2 3 4 5 6 7 8 9 10 ...
 $ therapy: Factor w/ 3 levels "b","c","f": 1 1 1 1 1 1 1 1 1 1 ...
 $ before : num  80.5 84.9 81.5 82.6 79.9 88.7 94.9 76.3 81 80.5 ...
 $ after  : num  82.2 85.6 81.4 81.9 76.4 ...

Data Description

https://users.stat.ufl.edu/~aa/social/csv_files/anorexia.csv 

  • Subject contains the number of subjects in the data set

  • Therapy contains the type of therapy each participant received

    • b = cognitive behavioral

    • c = control

    • f = family treatment

  • Before is the weight (lbs) of participants before treatment

  • After is the weight (lbs) of participants after treatment

\[ P(E)={n\choose k}p^k(2-p)^{n-k} \]

beforemean<-mean(anorexia$before)
aftermean<-mean(anorexia$after)
beforemean
[1] 82.40833
aftermean
[1] 85.17222
freq_table<-table(anorexia$therapy)
print(freq_table)

 b  c  f 
29 26 17 


barplot(freq_table, col="lightblue",
                  main="Girls in Therapy")

before<-anorexia$before
hist(before, main="Anorexia")

before<-anorexia$before
after<-anorexia$after
plot(x=before, y=after,main="Anorexia", col=anorexia$therapy,
     xlab="Before(lbs)",ylab="After(lbs)"
     )
legend("topright",legend = c("cognitive behavioural","family therapy","control"),fill=1:10,border="black") 

boxplot(anorexia$before, anorexia$after,names=c("before","after"))

median(anorexia$before)
[1] 82.3
median(anorexia$after)
[1] 84.05
IQR(anorexia$before)
[1] 6.4
IQR(anorexia$after)
[1] 12.225
sd(anorexia$before)
[1] 5.182466
sd(anorexia$after)
[1] 8.035173
  • median: for before seems to be about 82 and for after it seems to be 85\

    • actual: median before = 82.3, median after = 84.05
  • IQR: for before is about 5 and for after would be 12

    • actual: before=6.4, after=12.2

Standard deviation: I think “after” will have a higher standard deviation

Before=5.18, After= 8.04

There could be an outliar in the “after” portion of the max whisker is a lot higher than the “before” whisker.