2024-12-01

Background

Data

Swiss Fertility data with standardized fertility measure and socioeconomic indicators for each of 47 French-speaking provinces of Switzerland at 1888. The data frame has 47 observations with 6 variables, the variables considered are

  • Fertility (Ig) - common standardized fertility measure
  • Agriculture - % of males involved in agriculture as occupation
  • Education - % education beyond primary school for draftees
##              Fertility Agriculture Examination Education Catholic
## Courtelary        80.2        17.0          15        12     9.96
## Delemont          83.1        45.1           6         9    84.84
## Franches-Mnt      92.5        39.7           5         5    93.40
##              Infant.Mortality
## Courtelary               22.2
## Delemont                 22.2
## Franches-Mnt             20.2

R Code for Plot

library(ggplot2)
library(plotly)
## Warning: package 'plotly' was built under R version 4.4.2
g <- ggplot(data = swiss, aes(Agriculture, Fertility), 
            xlab("Agriculture"), 
            ylab("Fertility"))
g = g + geom_point(size = 5, color = "blue", alpha = 0.2)
g = g + geom_point(size = 5, color = "red", alpha = 0.2) 
g = g + geom_smooth(method = lm, color = "grey0")
finalplot <- ggplotly(g)

Regression Model - Fertility Vs Agriculture