Professional Documents
Culture Documents
21bce0427 VL2022230503921 Ast04
21bce0427 VL2022230503921 Ast04
NAME: Chethan N V
REG.NO: 21BCE0427
Slot: L5+L6
> #Question 1
> #In a city 250 men out of 750 were found to be smokers does
this information support the conclusion that the majority of
men in this city are smokers.
>
> P=1/2 #Which re presents an equal number of smokers and
nonsmokers(No majority)
> n=250
> N=750
> p=n/N
> if(p>P)
+ {
+ print("Majority of men in this city are smokers")
+ }
> if(p<P)
+ {
+ print("Majority of men in this city are not smokers")
+ }
[1] "Majority of men in this city are not smokers"
>
> #Here H0:Majority of men in this city are smokers >
#H1: Majority of men in this city are not smokers
>
> #Since p<P we accept H0.
Screenshot:
Problem 2:
A random sample of 36 values from a normal population showed a mean of 41.5
inches and the sum of the squares of deviation from mean is 13.5 inches.
(b) A sample of size 40 was taken from a population whose S.D is 2.03 and the
mean 40 is Construct 95% confidence interval for the mean.
(c) It is claimed that a random sample of 100tyres with a mean life of 15269 is
drawn from a population of tyres which has a mean life of 15200 km. and a
standard deviation of 1248 km. Test the validity of the claim.
Code:
> #Name: Chethan N V >
#Reg No: 21BCE0427
>
> #Question 2
> #A random sample of 16 values from a normal population showed
a mean of 41.5 inches and the sum of the squares of deviation
from mean is 13.5 inches.
>
> #a) Find the maximum error with 99% confidence.
>
cv=qt(0.995,35)
> sm=41.5
> sos=13.5
> sz=36
> sample_sd=sqrt(sos/(sz-1))
> maxerror=cv*(sample_sd/sqrt(sz))
> maxerror
[1] 0.2819407
>
> #b) A sample of size10was taken from a population whose S.D
is .03 and the mean is Construct 95% confidence interval for
the mean.
>
> sz=40
> sm=40
> sample_sd=2.03
> cv=qt(0.95,sz-1)
> margin_error=cv*(sample_sd/sqrt(sz))
>
> lb=sm-margin_error >
ub=sm+margin_error
>
> c(lb,ub)
Code:
> #Name: Chethan N V >
#Reg No: 21BCE0427
>
> #Question 3
> #Random samples of 600 men and 900 women in a locality were
asked whether they would like to have a bus stop near their
residence 350 men and 475 women were in favor of the proposal.
Test the significance between the difference of two proportions
at 5% level.
>
>
> n1=600
> n2=900
> N1=350
> N2=475
>
> p1=N1/n1
> p2=N2/n2
>
> p=(N1+N2)/(n1+n2) > se=sqrt(p*(1-
p)*((1/n1)+(1/n2)))
> z=(p1-p2)/se
>
> p_value=2*pnorm(-abs(z))
>
> a=0.05
>
> if(p_value<a){
+ cat("The difference in proportions is significant at the",
a*100, "% level.\n")
+ }else{
+ cat("The difference in proportions is not significant at
the", a*100, "% level.\n")
+ }
The difference in proportions is significant at the 5 % level.
>
> #Here H0: The difference in proportions is significant
> #H1: The difference in proportions is not significant
> #as pvalue<a we accept H0 se=sqrt(p*(1-p)*((1/n1)+(1/n2)))
Screenshots:
Problem 4:
lady stenographer claims that she can take dictation at the rate of 118
words per minute can we reject her claim on the basis of 100 trials in
which she demonstrates a mean of 116 words and a S.D of 15 words.
Code:
> #Name: Chethan N V >
#Reg No; 21BCE0427
>
> #Question 4
> #A lady stenographer claims that she can take dictation at
the rate of 118 words per minute can we reject her claim on the
basis of 100 trials in which she demonstrates a mean of 116
words and a S.D of 15 words.
> xbar=116
> s=15
> n=100
> mu0=118
>
> t_stat=(xbar-mu0)/(s/sqrt(n))
> p_val=2*pt(-abs(t_stat),df=n-1)
>
> cat("t-statistic =",round(t_stat,2),"\n") t-statistic
= -1.33
> cat("p-value =", p_val, "\n") p-value
= 0.1854824
>
> #Since the p-value is less than 0.05, we can reject the null
hypothesis and conclude that there is evidence to suggest that
the lady stenographer's claim of dictating at 118 words per
minute is not true, based on the 100 trials with a mean of 116
words and a standard deviation of 15 words.
>
Screenshot: