Professional Documents
Culture Documents
Exercise
Exercise
R
asus
2021-09-22
# Question 1
getwd()
setwd("D:/R/RStudio/R-files/")
lbwi <- read.table ("lbwi.txt", header = TRUE)
toxemia = subset(lbwi, toxemia == 1)
toxemia0 = subset(lbwi, toxemia == 0)
infantlength = mean(toxemia$length)
infantlength0 = mean(toxemia0$length)
infantlength
## [1] 37.57143
infantlength0
## [1] 36.62025
# infants from group of moms having toxemia have greater average than infants
from the other group
#Question 2
data <- subset(lbwi, headcirc < 28 & momage <30)
meanheight = mean(data$length)
medianheight = median(data$length)
meanheight
## [1] 35
medianheight
## [1] 36
# Question 3
quantile(lbwi$height, c(.9))
## 90%
## NA
quantile(lbwi$length, c(.9))
## 90%
## 41
## [1] 1443.167
lower
## [1] 1421
# the 95% confident interval for the mean weight of infants in the group of
top 10% height is from 1421 to 1443.167
#Question 4
# 5 number summary
mean(lbwi$length)
## [1] 36.82
median(lbwi$length)
## [1] 38
max(lbwi$length)
## [1] 43
min(lbwi$length)
## [1] 20
## 25% 75%
## 35 39
## [1] 37.57143
## [1] 1105
## [1] 27