EXERCICE 8.57

The final marks in a statistics course are normally distributed with a mean of 70 and a standard deviation of 10. The professor must convert all marks to letter grades. She decides that she wants 10% A’s, 30% B’s, 40% C’s, 15% D’s, and 5% F’s. Determine the cutoffs for each letter grade.

A grade 10% des etudiants B grades 30% des etudiants => 40% (A+B) C grades 40% => 80% (A+B+C) D gardes 15% => 95% (A+B+C+D) F gardes 5% => 100% (A+B+C+D+F)

repartition = c(0.10,0.40,0.80,0.95)
round(qnorm(repartition,lower.tail = FALSE)*10+70,0)
## [1] 83 73 62 54
pnorm(54)*10+70
## [1] 80
pnorm(83,70,10,lower.tail = FALSE)
## [1] 0.09680048
pnorm(83,70,10)-pnorm(72,70,10)
## [1] 0.3239398
pnorm(72,70,10)-pnorm(62,70,10)
## [1] 0.3674043
pnorm(62,70,10)-pnorm(53,70,10)
## [1] 0.1672899
pnorm(53,70,10)
## [1] 0.04456546

Ceux qui ont entre 81 et 100 represent 10% des etudiants et auront la note A. Ceux qui ont entre 73 et 81 represent 10% des etudiants et auront la note B. Ceux qui ont entre 62 et 72 represent 10% des etudiants et auront la note C. Ceux qui ont entre 54 et 61 represent 10% des etudiants et auront la note D. Ceux qui ont entre 73 et 81 represent 10% des etudiants et auront la note F.

round(qnorm(0.10,70,10, lower.tail = FALSE))
## [1] 83
round(qnorm(0.40,70,10, lower.tail = FALSE))
## [1] 73
round(qnorm(0.80,70,10, lower.tail = FALSE))
## [1] 62
round(qnorm(0.95,70,10, lower.tail = FALSE))
## [1] 54
round(qnorm(0.05,70,10, lower.tail = TRUE))
## [1] 54
library(ggplot2)

p1 <- ggplot(data = data.frame(x = c(30, 100)), aes(x)) +
  stat_function(fun = dnorm, n = 101, args = list(mean = 70, sd = 10),color="red")+  xlab("Marks")+ ylab("Density") 
p1

Presenter une Data Frame _ presenter les resultats dans une Table

library(kableExtra)
Grade=c(LETTERS[c(1:4,6)])
From=c(82,72,61,53,0)
To=c(100,82,72,61,53)
Perc=c(0.1,0.3,0.4,0.15,0.05)

data.frame(cbind(Grade,From,To,Perc))
##   Grade From  To Perc
## 1     A   82 100  0.1
## 2     B   72  82  0.3
## 3     C   61  72  0.4
## 4     D   53  61 0.15
## 5     F    0  53 0.05
fdata = data.frame(cbind(Grade,From,To,Perc))

tab = knitr::kable(fdata, caption = "Ex 8.57", digits = 4, col.names = c("Grade","Lower","Higher","percents"),
                   row.names = 1:5,
                   align = c("c","c","c","c"), booktabs=TRUE)
## Warning in if (is.na(row.names)) row.names = has_rownames(x): the condition has
## length > 1 and only the first element will be used
## Warning in if (row.names) {: the condition has length > 1 and only the first
## element will be used
tab3=kable_classic (tab, latex_options="hold_position")
tab1 = row_spec(tab, 1:2, bold = TRUE, italic = TRUE,background = "#2EFEF7")
tab2 = row_spec(tab1, 3:4, bold = TRUE, italic = TRUE, background = "#DAFF33")

row_spec(tab2, 5, bold = TRUE, italic = TRUE, background = "#FF5533")
Ex 8.57
Grade Lower Higher percents
1 A 82 100 0.1
2 B 72 82 0.3
3 C 61 72 0.4
4 D 53 61 0.15
5 F 0 53 0.05
res = kbl(fdata) 
kable_material_dark(res)
Grade From To Perc
A 82 100 0.1
B 72 82 0.3
C 61 72 0.4
D 53 61 0.15
F 0 53 0.05

EXERCICE 8.58

Mensa is an organization whose members possess IQs that are in the top 2% of the population. It is known that IQs are normally distributed with a mean of 100 and a standard deviation of 16. Find the minimum IQ needed to be a Mensa member.

pnorm(.02,100,16, lower.tail = FALSE)
## [1] 1

EXERCICE din scan

q=50
pnorm(q,30,10)*0.5 + pnorm(q,40,10)*0.5
## [1] 0.9092973
prop=function(q){pnorm(q,30,10)*0.5 + pnorm(q,40,10)*0.5-0.9}

prop(49.5)
## [1] 0.001677907
uniroot(prop,c(49,50),maxiter = 1000)
## $root
## [1] 49.39365
## 
## $f.root
## [1] -1.408408e-10
## 
## $iter
## [1] 4
## 
## $init.it
## [1] NA
## 
## $estim.prec
## [1] 6.103516e-05