Infants birthweight and gestational age for smoker and nonsmoker mothers

Research Questions

Here we ask,is there a relationship between gestational age and birthweight? and do smokers have lighter babies?

Data Origins

This dataset consists of details of 42 babies and their parents at birth.You can find this dataset in Stastutor. These data were collected by the employer’s liability insurances in Germany. As reported in its resear artical by Karmaus and Wolf ,1995.

Variables meaning: Birthweight= Weight of baby by pound (lbs), Gestation= Gestation age of baby by (weeks), smoker= Mother smokes setuation : 1 = smoker , 0 = non-smoker

Data Preparation

# load data
read.csv ("C:\\Users\\ekhojah\\OneDrive\\Desktop\\Birthweight_reduced_R.csv")
# rename data file
df <- read.csv("C:\\Users\\ekhojah\\OneDrive\\Desktop\\Birthweight_reduced_R.csv")

To answer the research questions, only the information about birthweight , gestation age of the newborn babies and their mothers who smoked and didn’t will be adress.

#exclude all except variables we need
df1 <-df %>% select(-c(id,headcirumference,length,motherage,mnocig,mheight,mppwt,fage,fedyrs,fnocig,fheight,lowbwt,mage35,LowBirthWeight))
#showe first few rews
head(df1)
##   Birthweight Gestation smoker
## 1         5.8        33      0
## 2         4.2        33      1
## 3         6.4        34      0
## 4         4.5        35      1
## 5         5.8        35      1
## 6         6.8        37      0

Visulisation 1:

Here I adress the first question:is there a relationship between gestational age and birthweight?

plot(Gestation,Birthweight,main="Scatterplot of gestational age and birthweight",xlab="Gestation(weeks)",ylab="Birthweight(lbs)")

#Add a regression line to the plot
abline(lm(Birthweight~Gestation),col='red',lwd=2)

#save output
png(filename= "birthwight.png")

There is a positive relationship, as the gestational age increases, so does birthweight. The closer the scatter is to the line, the stronger the relationship is.

Visulisation 2:

Here I adress the second question:do smokers have lighter babies?

#attach labels to the categories 
smoker<-factor(smoker,c(0,1),labels=c('Non-smoker','Smoker'))

plot(Gestation,Birthweight,col=c('red','blue')[smoker],main='Scatterplot by smoker', pch=c(1,4)[smoker],xlab='Gestation (weeks)',ylab='Birthweight(lbs)')
legend(x="topleft", legend = levels(smoker), col=c('red','blue'), pch=c(1,4))
pairs(~Birthweight+Gestation,main='Birth weight scatterplot matrix',col=c('red','blue')[smoker],pch=c(1,4)[smoker])

#save output
png(filename= "birthwight2.png")

smokers tend to have lighter babies at each gestational age.

Summary

This data visualisation showes information of birthwight and gastation age for 42 babies and the effects of thier mothers smoking siuation.

From visulisation 1, we can see there are no large outliers wich could have large impact on the strength of a relationship.

From visualisation 2, we can see a baby increases in weight for each extra week of gestation.

Other varibals of baby birth and mother situation can be visualied in future, like Is there a relationship between over 35’s and low baby weight?