**Introduction**

Built in the R library is the Births dataset with 400,000 records and 13 variables. The following is an analysis of this dataset.

**Results**

*Figure 1*. The first five data point entries in the births2006.smpl data set.

*Figure 2*. The frequency of births in 2006 per day of the week.

*Figure 3*. Histogram of 2006 births frequencies graphed by day of the week and separated by method of delivery.

*Figure 4.* A trellis histogram plot of 2006 birth weight per birth number.

*Figure 5.* A trellis histogram plot of 2006 birth weight per birth delivery method.

*Figure 6.* A boxplot of 2006 birth weight per Apgar score.

*Figure 7.* A boxplot of 2006 birth weight per day of week.

*Figure 8.* A histogram of 2006 average birth weight per multiple births separated by gender.

**Discussion **

Given the open-sourced nature of the R software, many libraries are being built and shared with the greater community, and the Comprehensive R Archive Network (CRAN), has a ton of these programs as part of R Packages (Schumacker, 2014). Thus, as part of the nutshell library, there exists a data set of 2006 births called “births2006.smpl”. To view the first few entries the head() command can be used (R, n.d.g.). The printout from the head() command (Figure 1) shows all 13 variables of the dataset along with the first five entries in the births2006.smpl dataset.

The number of birth seems to be approximately uniform (but not precisely) during the work week, assuming Sunday is 1 and Saturday is 7. However, Tuesday-Thursday has the highest births in the week with the weekends having the least amount of births in the week.

Breaking down the method of deliveries in 2006 per day of the week, it can be seen that Vaginal birth in all seven days of the week outnumbers C-section deliveries in 2006 (Figure 3). Also on Tuesday-Thursday there are more vaginal births compared to those during the weekend, and in C-section deliveries, there are most deliveries occur between Tuesday-Friday, and the least amount occurs during the weekends.

Breaking down the number of births frequencies per birth weight (Figure 4), it can be seen that the normal distribution of birth weight in grams shifts to the left as the number of multiple births increases. This seems to suggest that babies born as a set of twins, triplets, etc. have lower birth rates on average and per distribution. Birth weight is almost normally distributed for the single child birth but begins to lose normality as the number of births increases.

Further analysis of birth weights in 2006, per delivery method, shows that for whether or not the delivery method is known or not and its type of delivery method doesn’t play too much of a huge role in the determination of the child’s birth weight (Figure 5). Statistical tests and effect size analysis could be conducted to verify and enhance the discussion and this assertion that is made through the graphical representation in Figure 5.

Apgar test is tested on the child after one and five minutes of birth looking at the skin color, heart rate, reflexes, muscle tone, and respiration rate of the child, where 10 is the highest but rarely obtain score (Hirsch, 2014). Thus, observing the Apgar score variable (1-10) on birth weight in grams those with higher Apgar scores had on average higher median birth weights. Typically, as Apgar score increases the tighter the distribution becomes, and the more outliers begin to appear (disregarding the results from Apgar score of 1). These results from the boxplots tend to confirm Hirsch (2014) assertion that higher Apgar scores are harder to obtain.

Looking at the boxplot analysis of birth weight per day of the week (Figure 7) shows that the median, Q1, Q3, max, and min are normally distributed and unchanging per day of the week. Outliers, the heavier babies, tend to occur without respect of the day of the week, and also appears to have little to no effect on the distribution of birth weight per day of the week.

Finally, looking at a mean birth weight per gender and per multiple births, shows a similar distribution of males and females (Figure 8). The main noticeable difference is the male Quintuplet or higher number of births on average weigh more than the corresponding female Quintuplet or higher number of births. This chart also confirms the conclusions made (from Figure 4) where as the number of births increases the average weight of the children decrease.

In conclusion, the day of the week doesn’t predict birth weights, but probably birth frequency. In general, babies are heavier if they are single births and if they achieve Apgar score of 10. Birth weights are not predictable through delivery method. All of these conclusions are made on the visual representation of the dataset births2006.smpl. What would increase the validity of these statements would be to conduct statistical significance tests and the effect size, to add further weight to what could be derived from through these images.

**Code**

#

## Use R to analyze the Birth dataset.

## The Birth dataset is in the Nutshell library.

## • SEX and APGAR5 (SEX and Apgar score)

## • DPLURAL (single or multiple birth)

## • WTGAIN (weight gain of mother)

## • ESTGEST (estimated gestation in weeks)

## • DOB_MM, DOB_WK (month and day of week of birth)

## • BWT (birth weight)

## • DMETH_REC (method of delivery)

#

install.packages(“nutshell”)

library(nutshell)

data(births2006.smpl)

# First, list the data for the first 5 births.

head(births2006.smpl)

# Next, show a bar chart of the frequencies of births according to the day of the week of the birth.

births.dayofweek = table(births2006.smpl$DOB_WK) #Goal of this variable is to speed up the calculations

barplot(births.dayofweek, ylab=”frequency”, xlab=”Day of week”, col = “darkred”, main= “Number of births in 2006 per day of the week”)

# Obtain frequencies for two-way classifications of birth according to the day of the week and the method of delivery.

births.methodsVdaysofweek = table(births2006.smpl$DOB_WK,births2006.smpl$DMETH_REC)

head(births.methodsVdaysofweek,7)

barplot(births.methodsVdaysofweek[,-2], col=heat.colors(length(rownames(births.methodsVdaysofweek))), width=2, beside=TRUE, main = “bar plot of births per method per day of the week”)

legend (“topleft”, fill=heat.colors(length(rownames(births.methodsVdaysofweek))),legend=rownames(births.methodsVdaysofweek))

# Use lattice (trellis) graphs (R package lattice) to condition density histograms on the values of a third variable.

library(lattice)

# The variable for multiple births and the method of delivery are conditioning variables.

# Separate the histogram of birth weight according to these variable.

histogram(~DBWT|DPLURAL,data=births2006.smpl,layout=c(1,5),col=”black”, xlab = “birth weight”, main = “trellis plot of birth weight vs birth number”)

histogram(~DBWT|DMETH_REC,data=births2006.smpl,layout=c(1,3),col=”black”, xlab = “birth weight”, main = “trellis plot of birth weight vs birth method”)

# Do a box plot of birth weight against Apgar score and box plots of birth weight by day of week of delivery.

boxplot(DBWT~APGAR5,data=births2006.smpl,ylab=”birth weight”,xlab=”AGPAR5″, main=”Boxplot of birthweight per Apgar score”)

boxplot(DBWT~DOB_WK,data=births2006.smpl,ylab=”birth weight”,xlab=”Day of Week”, main=”Boxplot of birthweight per day of week”)

# Calculate the average birth weight as a function of multiple births for males and females separately.

# Use the “tapply” function, and for missing values use the “option nz.rm=TRUE.”

listed = list(births2006.smpl$DPLURAL,births2006.smpl$SEX)

tapplication=tapply(births2006.smpl$DBWT,listed,mean,na.rm=TRUE)

barplot(tapplication,ylab=”birth weight”, beside=TRUE, legend=TRUE,xlab=”gender”, main = “bar plot of average birthweight per multiple births by gender”)

**References**

- CRAN (n.d.). Using lattice’s historgram (). Retrieved from https://cran.r-project.org/web/packages/tigerstats/vignettes/histogram.html
- Hirsch, L. (2014). About the Apgar score. Retrieved from http://kidshealth.org/en/parents/apgar.html#
- R (n.d.a.). Add legends to plots. Retrieved from https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/legend.html
- R (n.d.b.). Apply a function over a ragged array. Retrieved from https://stat.ethz.ch/R-manual/R-devel/library/base/html/tapply.html
- R (n.d.c.). Bar plots. Retrieved from https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/barplot.html
- R (n.d.d.). Cross tabulation and table creation. Retrieved from https://stat.ethz.ch/R-manual/R-devel/library/base/html/table.html
- R (n.d.e.). List-Generic and dotted pairs. Retrieved from https://stat.ethz.ch/R-manual/R-devel/library/base/html/list.html
- R (n.d.f.). Produce box-and-wisker plot(s) of a given (grouped) values. Retrieved from https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/boxplot.html
- R (n.d.g.). Return the first or last part of an object. Retrieved from https://stat.ethz.ch/R-manual/R-devel/library/utils/html/head.html
- Schumacker, R. E. (2014)
*Learning statistics using R*. California, SAGE Publications, Inc, VitalBook file.