From 16461232e0874ba33ff80c4033e4247d8ce4623f Mon Sep 17 00:00:00 2001 From: 433835ee939dd34ba5afd7c0a68da139 <433835ee939dd34ba5afd7c0a68da139@app-learninglab.inria.fr> Date: Thu, 4 Sep 2025 14:02:23 +0000 Subject: [PATCH] Upload exo 1 module 4 --- module4/module4_exo1.Rmd | 56 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 module4/module4_exo1.Rmd diff --git a/module4/module4_exo1.Rmd b/module4/module4_exo1.Rmd new file mode 100644 index 0000000..add221f --- /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 -- 2.18.1