The purpose of the following code is to calculate the Mean and Standard Deviation of the data set of human body temperatures.
data=read.delim("exer6_34.dat",header=TRUE)
class(data)
## [1] "data.frame"
"data.frame"
## [1] "data.frame"
head(data)
## TEMP
## 1 98.0
## 2 98.8
## 3 98.2
## 4 97.8
## 5 98.4
## 6 99.0
data$TEMP
## [1] 98.0 98.8 98.2 97.8 98.4 99.0 99.2 97.9 98.4 96.9 98.2 97.6 98.0 98.5
## [15] 99.0 97.0 97.7 98.3 98.8 97.7 98.4 97.4 98.8 98.2 98.5 97.6 98.4 98.2
## [29] 98.7 98.6 98.3 98.2 98.0 98.0 98.0 99.0 97.4 99.0 98.2 98.8 98.6 97.7
## [43] 98.6 98.8 98.0 98.0 98.0 98.0 98.8 98.6 99.3 97.1 97.0 98.8 97.0 97.0
## [57] 97.4 99.4 98.1 98.0 97.8 98.4 97.4 97.6 97.2 97.3 98.0 97.8 98.5 99.1
## [71] 98.7 98.6 98.4 98.6 98.2 97.3 98.6 98.2 97.2 97.2 99.3 97.4 97.4 98.6
## [85] 98.1 98.1 98.6 99.2 98.5 97.6 97.8 96.7 96.8
temp=data$TEMP
temp=sort(temp)
temp
## [1] 96.7 96.8 96.9 97.0 97.0 97.0 97.0 97.1 97.2 97.2 97.2 97.3 97.3 97.4
## [15] 97.4 97.4 97.4 97.4 97.4 97.6 97.6 97.6 97.6 97.7 97.7 97.7 97.8 97.8
## [29] 97.8 97.8 97.9 98.0 98.0 98.0 98.0 98.0 98.0 98.0 98.0 98.0 98.0 98.0
## [43] 98.1 98.1 98.1 98.2 98.2 98.2 98.2 98.2 98.2 98.2 98.2 98.3 98.3 98.4
## [57] 98.4 98.4 98.4 98.4 98.4 98.5 98.5 98.5 98.5 98.6 98.6 98.6 98.6 98.6
## [71] 98.6 98.6 98.6 98.6 98.7 98.7 98.8 98.8 98.8 98.8 98.8 98.8 98.8 99.0
## [85] 99.0 99.0 99.0 99.1 99.2 99.2 99.3 99.3 99.4
xbar=mean(temp)
xbar
## [1] 98.12
sd=sd(temp)
sd
## [1] 0.6468
str(data)
## 'data.frame': 93 obs. of 1 variable:
## $ TEMP: num 98 98.8 98.2 97.8 98.4 99 99.2 97.9 98.4 96.9 ...
hist(data$TEMP,breaks=12,
col="lightblue",
border="purple",
labels=TRUE,
xlab="Temperature",
ylab="Frequency",
main="Human Body Temperature")
pnorm(98.76,98.12,.64)-pnorm(97.48,98.12,.64)
## [1] 0.6827
pnorm(99.40,98.12,.64)-pnorm(96.84,98.12,.64)
## [1] 0.9545
pnorm(100.04,98.12,.64)-pnorm(96.20,98.12,.64)
## [1] 0.9973
6.34- (a) Sample Mean=98.12366 Sample Standard Deviation=.6467978
(c) [xbar-sd,xbar+sd]= %68
[xbar-2sd,xbar+2sd]= %95
[xbar-3sd,xbar+3sd]= %99.7
(d) The distribution for this data resembles a normal distribution because the freuquency drops on both sides of the mean equally.
(e) Standard Score= (score-mean)/sd
=(98.6-98.12366)/.6467
=.73657
-The mean human body temperature is 98.12366