diff --git a/module4/module4_exo1.Rmd b/module4/module4_exo1.Rmd new file mode 100644 index 0000000000000000000000000000000000000000..add221fc61923a0b7819f8a055d787097c7955b7 --- /dev/null +++ b/module4/module4_exo1.Rmd @@ -0,0 +1,56 @@ +--- +title: "module4_exo1" +author: "Dusfour-Castan Pauline @433835ee939dd34ba5afd7c0a68da139" +output: pdf_document +date: "2025-09-04" +--- + + +# Informations sur la version de R et les packages utlisés + + +```{r} +library(ggplot2) +library(readr) +sessionInfo() +``` + + +# Importation des données et analyses + +```{r} +data = read_csv("~/data_shuttle.csv") +data +``` + + +```{r} +plot(data=data, Malfunction/Count ~ Temperature, ylim=c(0,1)) +``` + + +## Régression Logistique + +```{r} +logistic_reg = glm(data=data, Malfunction/Count ~ Temperature, weights=Count, + family=binomial(link='logit')) +summary(logistic_reg) +``` + + +## Prédire la probabilité de défaillance + +```{r} +tempv = seq(from=30, to=90, by = .5) +rmv <- predict(logistic_reg, list(Temperature=tempv), type="response") +plot(tempv, rmv, type="l", ylim=c(0,1)) +points(data=data, Malfunction/Count ~ Temperature) +``` + + +```{r, fig.height=3.3} +ggplot(data, aes(y=Malfunction/Count, x=Temperature)) + + geom_point(alpha=.2, size = 2, color="blue") + + geom_smooth(method = "glm", method.args = list(family = "binomial"), fullrange=T) + + xlim(30,90) + ylim(0,1) + theme_bw() +``` \ No newline at end of file