0.00135
mean<-120
sd<-10
z<-(150-mean)/sd
1-pnorm(z)
## [1] 0.001349898
0.20366
N_sqrt<-16**0.5
z1<-(126-120)*N_sqrt/sd
z2<-(122-120)*N_sqrt/sd
pnorm(z1)-pnorm(z2)
## [1] 0.2036579
0.061662
n_k<-choose(7,3)
n_k
## [1] 35
n_k*0.15**3*0.85**4
## [1] 0.06166199
0.7581
n<-100
p<-0.15
std<-(n*p*(1-p))**0.5
mean<-p*n
z<-(17.5-mean)/std
pnorm(z)
## [1] 0.7580801
{4.55325,5.04675}
mean<-4.8
std<-1.5
n<-100
sample_std<-1.5/(n**0.5)
ci_l<-mean-sample_std*1.645
ci_u<-mean+sample_std*1.645
ci_l
## [1] 4.55325
ci_u
## [1] 5.04675
{0.46202,0.51798}
mean<-0.49
n<-1226
std<-(mean*(1-mean))**0.5
sample_std<-std/(n**0.5)
ci_l<-mean-sample_std*1.96
ci_u<-mean+sample_std*1.96
ci_l
## [1] 0.462017
ci_u
## [1] 0.517983
30|0 20|0 10|00 5|00 4|00 3|00 2|0 -5|0 -6|0 -7|0 -9|9 -12|0
Mean is 35.06. The range is 420.
Minimum is -120. Maximum is 300. Median is 35. 1st Q is -52.5. 3rd Q is 62.5.
vec<-c(-120,-99,-70,-60,-50,20,30,30,40,40,50,50,100,100,200,300)
quantile(vec)
## 0% 25% 50% 75% 100%
## -120.0 -52.5 35.0 62.5 300.0
Distribution is right skewed.
boxplot(vec)
300 is a suspected outlier.
IQR<-62.5+52.5
35+1.5*IQR
## [1] 207.5
35-1.5*IQR
## [1] -137.5
The number of observations is less than 30, so we have to use t distribution with 15 DF. Data is skewed and we have a potential outlier, so we might have a problem with accuracy.
H0: mean is 0 H1: mean is >0
Z score of -1.295 is more than t value at 0.05 at -1.753, so we cannot reject H0 at 0.05 significance level. We do mot have enough evidence to accept the hypothesis that mean is more than 0 at 0.05 significance level.
std<-sd(vec)
hist(vec)
n<-16
sample_std<-std/(n**0.5)
sample_std
## [1] 27.07481
mean<-mean(vec)
z<-(-1)*mean/sample_std
z
## [1] -1.295023
qt(0.05, df=15)
## [1] -1.75305
Degrees of freedom is 4 (the lowest number of observations minus one)
H0: The right and left lane cars have the same speed
H1: The left lane cars are faster
At 0.01, we cannot reject H0. So, we do not have enough evidence to claim that the right lane is slower than the left.
mean1<-65
mean2<-69
meand<-mean2-mean1
std1<-4.12
std2<-3.22
stdd<-(std1**2/5+std2**2/6)**0.5
stdd
## [1] 2.263393
z<-(0-meand)/stdd
z
## [1] -1.767258
qt(0.01, df=4)
## [1] -3.746947
H0: The proportion of adults who has heart attack is the same for active and inactive population
H1: The proportion is not the same
We got p value of 0.26, so we do not have enough evidence to reject H0, which means that we do not have enough evidence to claim that proportion is not the same
{-0.07644,0.12644}
HAA<-10
HAIA<-25
AA<-100
IAA<-200
Pooled<-(HAA+HAIA)/(AA+IAA)
Pooled
## [1] 0.1166667
std<-(Pooled*(1-Pooled)/IAA+Pooled*(1-Pooled)/AA)**0.5
std
## [1] 0.03931709
meand<-HAIA/IAA-HAA/AA
meand
## [1] 0.025
z<-(0-meand)/std
z
## [1] -0.6358559
pnorm(z)
## [1] 0.2624352
ci_l<-meand-std*2.58
ci_u<-meand+std*2.58
ci_l
## [1] -0.07643808
ci_u
## [1] 0.1264381
Degree of freedom is 2.
H0: There is no association
H1: There is an association
We reject H0 for 0.05 confidence and 2 DF (chi squire for 0.05 and 2 DF is 5.991). So we have enough evidence to say there is an association.
chi_sqr<-(11-(19*60/111))**2/(19*60/111)+(28-(60*52)/111)**2/(60*52)/111+(21-60*40/111)**2/(60*40)/111+(8-19*51/111)**2/(19*51)/111+(24-52*51)**2/(51*52)/111+(19-51*40/111)**2/(51*40)/111
chi_sqr
## [1] 23.51327