This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.3 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggthemes)
library(ggrepel)
library(broom)
library(lindia)
datas <- read.csv("C:\\Users\\karth\\Downloads\\Child Growth and Malnutrition.csv")
view(datas)
Response Variable - JME..Y.N. Explanatory Variables - Wasting, Overweight, Stunting, Underweight
datas$Wasting = as.numeric(datas$Wasting)
## Warning: NAs introduced by coercion
datas$Overweight = as.numeric(datas$Overweight)
## Warning: NAs introduced by coercion
datas1 <- datas
datas1$JME..Y.N. <- ifelse(datas1$JME..Y.N. == "Selected for JME",1,0)
view(datas1)
model <- glm(JME..Y.N. ~ Wasting + Overweight + Stunting + Underweight, data = datas1,
family = binomial(link = 'logit'))
model$coefficients
## (Intercept) Wasting Overweight Stunting Underweight
## -3.451969858 -0.017774437 -0.003021626 -0.003190176 0.002083612
This means that for every unit change in each of the variables, the odds of being selected for JME goes up in different amounts:
Wasting - \(e^{-0.017774437} = 0.9824\)
Overweight - \(e^{-0.0030321626} = 0.997\)
Stunting - \(e^{-0.003190176} = 0.997\)
Underweight - \(e^{0.002083612} = 1.0021\)
plot(model)
Logistic Regression makes no assumptions about the distribution of the explanatory variables. In such a case, we do not need to transform any of the explanatory variables for the regression model purposes.