Project 1 ## Part 1 (Confidence Intervals) # Given summary results are xbar = 19.7 # Mean s = 11.6 # Sample standard deviation n = 48 # Sample size # ---x---x---x--- A --- x---x---x--- # A. A point...

1 answer below »
Please review project 1. It has been done by you guys and came out with errors. The professor has given her feedback. Kindly please send me a quote for the portfolio. Please note the portfolio should be done based on the work on project 1 and 2.
Thank you.


Project 1 ## Part 1 (Confidence Intervals) # Given summary results are xbar = 19.7 # Mean s = 11.6 # Sample standard deviation n = 48 # Sample size # ---x---x---x--- A --- x---x---x--- # A. A point estimate for the average is given by the sample mean xbar. # Answer: xbar = 19.7 (point estimate) # ---x---x---x--- B --- x---x---x--- # Calculate 80, 85, 90, 95 percent confidence intervals # Calculating error se = s/ sqrt(n) # Calculating 80% confidence intervals alpha <- 0.2="" margin.error_80=""><- qnorm(1="" -="" (alpha/2))="" *="" se="" margin.error_80="" #="" lower="" ci="" lower.bound_80=""><- xbar="" -="" margin.error_80="" lower.bound_80="" #="" upper="" ci="" upper.bound_80=""><- xbar="" +="" margin.error_80="" upper.bound_80="" #="" calculating="" 85%="" confidence="" intervals="" alpha=""><- 0.15="" margin.error_85=""><- qnorm(1="" -="" (alpha/2))="" *="" se="" margin.error_85="" #="" lower="" ci="" lower.bound_85=""><- xbar="" -="" margin.error_85="" lower.bound_85="" #="" upper="" ci="" upper.bound_85=""><- xbar="" +="" margin.error_85="" upper.bound_85="" #="" calculating="" 90%="" confidence="" intervals="" alpha=""><- 0.1="" margin.error_90=""><- qnorm(1="" -="" (alpha/2))="" *="" se="" margin.error_90="" #="" lower="" ci="" lower.bound_90=""><- xbar="" -="" margin.error_90="" lower.bound_90="" #="" upper="" ci="" upper.bound_90=""><- xbar="" +="" margin.error_90="" upper.bound_90="" #="" calculating="" 95%="" confidence="" intervals="" alpha=""><- 0.05="" margin.error_95=""><- qnorm(1="" -="" (alpha/2))="" *="" se="" margin.error_95="" #="" lower="" ci="" lower.bound_95=""><- xbar="" -="" margin.error_95="" lower.bound_95="" #="" upper="" ci="" upper.bound_95=""><- xbar="" +="" margin.error_95="" upper.bound_95="" #="" taking="" together="" lower="" and="" upper="" limits="" lowerlimit=""><- c(lower.bound_80,lower.bound_85,lower.bound_90,lower.bound_95)="" upperlimt=""><- c(upper.bound_80,upper.bound_85,upper.bound_90,upper.bound_95)="" #="" creating="" a="" dataframe="" with="" 80,85,90,95%="" confidence="" intervals="" confidents=""><- data.frame(lowerlimit,upperlimt,="" mean="xbar)" confidents="" #="" ---x---x---x---="" c="" ---="" x---x---x---="" #="" making="" confidence="" intervals="" plot="" plot(y="confidents" $="" mean="" ,="" x="factor(c(80,85,90,95))," ylab="Mean" ,="" xlab="Confidence Intervals" ,="" main="Confidence Intervals Plot" )="" #="" adding="" confidence="" intervals="" plotrix::plotci(confidents$mean,="" y="NULL," uiw="confidents$upperlimt" -="" confidents$mean,="" liw="confidents$Mean" -="" confidents$lowerlimit,="" pch="5," slty="5," scol="black" ,="" col='red' ,="" err='y' ,="" add="TRUE)" #="" interpretation="" :="" by="" increasing="" the="" confidence="" the="" range="" of="" the="" interval="" is="" increasing="" #="" that="" is="" if="" we="" are="" less="" confidence="" then="" we="" will="" suggest="" high="" range="" of="" the="" statistic.="" #="" ---x---x---x---="" d="" ---="" x---x---x---="" #conditions:="" the="" conditions="" are="" random="" sampling="" and="" normal="" distribution="" #="" because="" it="" need="" to="" be="" satisfy="" the="" normal="" distribution="" bys="" using="" the="" #="" central="" limit="" theorem="" sample="" mean's="" distributions="" follows="" normal.="" ##="" part="" 2="" (test="" of="" mean)="" mu=""><- 20="" #="" ---x---x---x---="" a="" ---="" x---x---x---="" z_table=""><- round(qnorm(1-c(0.01/2)),2)="" z_table="" #="" answer:="" the="" rejection="" region="" is="" to="" test="" statistic="" is="" z="">2.58. # That is if z > 2.58, we reject Null Hypothesis # ---x---x---x--- B --- x---x---x--- # Calculating the test statistic z_cal <- ((xbar="" -="" mu)/(s/sqrt(n)))="" z_cal="" #="" ---x---x---x---="" c="" ---="" x---x---x---="" #="" conclusion="" :="" here="" z_cal="" value="" is="" less="" than="" z_table="" value="" so,="" #="" we="" accept="" the="" null="" hypothesis="" #="" ---x---x---x---="" d="" ---="" x---x---x---="" pnorm(q="-0.1791777," lower.tail="TRUE)" #="" ---x---x---x---="" ---="" x---x---x---="" #="" conclusion="" :="" here="" p-value="" is="" less="" than="" 0.05="" so,="" #="" we="" accept="" the="" null="" hypothesis="" ##="" part="" 3="" (power="" of="" a="" test="" )="" #="" given="" that="" n="48" xbar="19.7" s="11.6" #="" ---x---x---x---="" a="" ---="" x---x---x---="" true_mu="19" error=""><- qnorm(0.975)*s/sqrt(n)="" left=""><- xbar-error="" right=""><- xbar+error="" zleft=""><- (left-true_mu)/(s/sqrt(n))="" zright=""><-(right-true_mu) (s/sqrt(n))="" p=""><- pnorm(zright)-pnorm(zleft)="" p="" #="" type="" ii="" error="" 1-p="" #="" ---x---x---x---="" b="" ---="" x---x---x---="" true_mu="18" zleft=""><- (left-true_mu)/(s/sqrt(n))="" zright=""><-(right-true_mu) (s/sqrt(n))="" p=""><- pnorm(zright)-pnorm(zleft)="" p="" #="" type="" ii="" error="" 1-p="" true_mu="16" zleft=""><- (left-true_mu)/(s/sqrt(n))="" zright=""><-(right-true_mu) (s/sqrt(n))="" p=""><- pnorm(zright)-pnorm(zleft)="" p="" #="" type="" ii="" error="" 1-p="" true_mu="14" zleft=""><- (left-true_mu)/(s/sqrt(n))="" zright=""><-(right-true_mu) (s/sqrt(n))="" p=""><- pnorm(zright)-pnorm(zleft)="" p="" #="" type="" ii="" error="" 1-p="" true_mu="12" zleft=""><- (left-true_mu)/(s/sqrt(n))="" zright=""><-(right-true_mu) (s/sqrt(n))="" p=""><- pnorm(zright)-pnorm(zleft)="" p="" #="" type="" ii="" error="" 1-p="" #="" ---x---x---x---="" c="" ---="" x---x---x---="" #="" plotting="" the="" power="" test="" value="" vs="" alternative="" means="" y="c(0.07," 0.17,="" 0.598,="" 0.93,="" 0.996)="" x="c(19," 18,="" 16,="" 14,="" 12)="" plot(x,y,type="b" )="" #="" ---x---x---x---="" d="" ---="" x---x---x---="" #="" from="" the="" part="" c),="" power="" value="" is="" 0.8="" true_mu="15" zleft=""><- (left-true_mu)/(s/sqrt(n))="" zright=""><-(right-true_mu) (s/sqrt(n))="" p=""><- pnorm(zright)-pnorm(zleft)="" p="" #="" type="" ii="" error="" 1-p="" #="" ---x---x---x---="" e="" ---="" x---x---x---="" #="" answer:="" the="" probability="" that="" to="" reject="" null="" hypothesis="" is="" 0.2="" i.e="" p="0.2" ##="" part="" 4="" (test="" of="" variance)="" n="48" s="11.6" xbar="19.7" sigma2=""><- 100="" #="" ---x---x---x---="" a="" ---="" x---x---x---="" xcri=""><- qchisq(p=".01," df="48-1)" xcri="" #="" ---x---x---x---="" b="" ---="" x---x---x---="" xcal=""><- ((n-1)="" *="" (11.6="" ^="" 2))/sigma2="" xcal="" #="" ---x---x---x---="" c="" ---="" x---x---x---="" #="" conclusion="" :="" here="" xcal="" value="" is="" greater="" than="" xcri="" value="" so,="" #="" we="" reject="" the="" null="" hypothesis="" i.e="" accept="" the="" alternative="" hypothesis.="" solution-code.r="" dell="" 2021-03-10="" ##="" part="" 1="" (confidence="" intervals)="" #="" given="" summary="" results="" are="" xbar="19.7" #="" mean="" s="11.6" #="" sample="" standard="" deviation="" n="48" #="" sample="" size="" #="" ---x---x---x---="" a="" ---="" x---x---x---="" #="" a.="" a="" point="" estimate="" for="" the="" average="" is="" given="" by="" the="" sample="" mean="" xbar.="" #="" answer:="" xbar="19.7" (point="" estimate)="" #="" ---x---x---x---="" b="" ---="" x---x---x---="" #="" calculate="" 80,="" 85,="" 90,="" 95="" percent="" confidence="" intervals="" #="" calculating="" error="" se="s/" sqrt(n)="" #="" calculating="" 80%="" confidence="" intervals="" alpha=""><- 0.2="" margin.error_80=""><- qnorm(1="" -="" (alpha/2))="" *="" se="" margin.error_80="" ##="" [1]="" 2.145722="" #="" lower="" ci="" lower.bound_80=""><- xbar="" -="" margin.error_80="" lower.bound_80="" ##="" [1]="" 17.55428="" #="" upper="" ci="" upper.bound_80=""><- xbar="" +="" margin.error_80="" upper.bound_80="" ##="" [1]="" 21.84572="" #="" calculating="" 85%="" confidence="" intervals="" alpha=""><- 0.15="" margin.error_85=""><- qnorm(1="" -="" (alpha/2))="" *="" se="" margin.error_85="" ##="" [1]="" 2.41023="" #="" lower="" ci="" lower.bound_85=""><- xbar="" -="" margin.error_85="" lower.bound_85="" ##="" [1]="" 17.28977="" #="" upper="" ci="" upper.bound_85=""><- xbar="" +="" margin.error_85="" upper.bound_85="" ##="" [1]="" 22.11023="" #="" calculating="" 90%="" confidence="" intervals="" alpha=""><- 0.1="" margin.error_90=""><- qnorm(1="" -="" (alpha/2))="" *="" se="" margin.error_90="" ##="" [1]="" 2.754004="" #="" lower="" ci="" lower.bound_90=""><- xbar="" -="" margin.error_90="" lower.bound_90="" ##="" [1]="" 16.946="" #="" upper="" ci="" upper.bound_90=""><- xbar="" +="" margin.error_90="" upper.bound_90="" ##="" [1]="" 22.454="" #="" calculating="" 95%="" confidence="" intervals="" alpha=""><- 0.05="" margin.error_95=""><- qnorm(1="" -="" (alpha/2))="" *="" se="" margin.error_95="" ##="" [1]="" 3.281599="" #="" lower="" ci="" lower.bound_95=""><- xbar="" -="" margin.error_95="" lower.bound_95="" ##="" [1]="" 16.4184="" #="" upper="" ci="" upper.bound_95=""><- xbar="" +="" margin.error_95="" upper.bound_95="" ##="" [1]="" 22.9816="" #="" taking="" together="" lower="" and="" upper="" limits="" lowerlimit=""><- c(lower.bound_80,lower.bound_85,lower.bound_90,lower.bound_95)="" upperlimt=""><- c(upper.bound_80,upper.bound_85,upper.bound_90,upper.bound_95)="" #="" creating="" a="" dataframe="" with="" 80,85,90,95%="" confidence="" intervals="" confidents=""><- data.frame(lowerlimit,upperlimt,="" mean="xbar)" confidents="" ##="" lowerlimit="" upperlimt="" mean="" ##="" 1="" 17.55428="" 21.84572="" 19.7="" ##="" 2="" 17.28977="" 22.11023="" 19.7="" ##="" 3="" 16.94600="" 22.45400="" 19.7="" ##="" 4="" 16.41840="" 22.98160="" 19.7="" #="" ---x---x---x---="" c="" ---="" x---x---x---="" #="" making="" confidence="" intervals="" plot="" plot(y="confidents" $="" mean="" ,="" x="factor(c(80,85,90,95))," ylab="Mean" ,="" xlab="Confidence Intervals" ,="" main="Confidence Intervals Plot" )="" #="" adding="" confidence="" intervals="" plotrix::plotci(confidents$mean,="" y="NULL," uiw="confidents$upperlimt" -="" confidents$mean,="" liw="confidents$Mean" -="" confidents$lowerlimit,="" pch="5," slty="5," scol="black" ,="" col='red' ,="" err='y' ,="" add="TRUE)" #="" interpretation="" :="" by="" increasing="" the="" confidence="" the="" range="" of="" the="" interval="" is="" increasing="" #="" that="" is="" if="" we="" are="" less="" confidence="" then="" we="" will="" suggest="" high="" range="" of="" the="" statistic.="" #="" ---x---x---x---="" d="" ---="" x---x---x---="" #conditions:="" the="" conditions="" are="" random="" sampling="" and="" normal="" distribution="" #="" because="" it="" need="" to="" be="" satisfy="" the="" normal="" distribution="" bys="" using="" the="" #="" central="" limit="" theorem="" sample="" mean's="" distributions="" follows="" normal.="" ##="" part="" 2="" (test="" of="" mean)="" mu=""><- 20="" #="" ---x---x---x---="" a="" ---="" x---x---x---="" z_table=""><- round(qnorm(1-c(0.01/2)),2)="" z_table="" ##="" [1]="" 2.58="" #="" answer:="" the="" rejection="" region="" is="" to="" test="" statistic="" is="" z="">2.58. # That is if z > 2.58, we reject Null Hypothesis # ---x---x---x--- B --- x---x---x--- # Calculating the test statistic z_cal <- ((xbar="" -="" mu)/(s/sqrt(n)))="" z_cal="" ##="" [1]="" -0.1791777="" #="" ---x---x---x---="" c="" ---="" x---x---x---="" #="" conclusion="" :="" here="" z_cal="" value="" is="" less="" than="" z_table="" value="" so,="" #="" we="" accept="" the="" null="" hypothesis="" #="" ---x---x---x---="" d="" ---="" x---x---x---="" pnorm(q="-0.1791777," lower.tail="TRUE)" ##="" [1]="" 0.4288991="" #="" ---x---x---x---="" ---="" x---x---x---="" #="" conclusion="" :="" here="" p-value="" is="" less="" than="" 0.05="" so,="" #="" we="" accept="" the="" null="" hypothesis="" ##="" part="" 3="" (power="" of="" a="" test="" )="" #="" given="" that="" n="48" xbar="19.7" s="11.6" #="" ---x---x---x---="" a="" ---="" x---x---x---="" true_mu="19" error=""><- qnorm(0.975)*s/sqrt(n)="" left=""><- xbar-error="" right=""><- xbar+error="" zleft=""><- (left-true_mu)/(s/sqrt(n))="" zright=""><-(right-true_mu) (s/sqrt(n))="" p=""><- pnorm(zright)-pnorm(zleft)="" p="" ##="" [1]="" 0.9297466="" #="" type="" ii="" error="" 1-p="" ##="" [1]="" 0.07025339="" #="" ---x---x---x---="" b="" ---="" x---x---x---="" true_mu="18" zleft=""><- (left-true_mu)/(s/sqrt(n))="" zright=""><-(right-true_mu) (s/sqrt(n))="" p=""><- pnorm(zright)-pnorm(zleft)="" p="" ##="" [1]="" 0.826111="" #="" type="" ii="" error="" 1-p="" ##="" [1]="" 0.173889="" true_mu="16" zleft=""><- (left-true_mu)/(s/sqrt(n))="" zright=""><-(right-true_mu)/(s/sqrt(n))>
Answered Same DayApr 10, 2021

Answer To: Project 1 ## Part 1 (Confidence Intervals) # Given summary results are xbar = 19.7 # Mean s = 11.6 #...

Archit answered on Apr 11 2021
157 Votes
Introduction
In this project the following topics have been explained in detail with examples: -
1) Confidence Interval
2) Test of Hypothesis for one sample or two sample
3) Liner Regression
4) Power of Test
Cofidence Interval
Confidence Interval is a range in which our estimated parameter is suppossed to lie. For building a
confidence interval we need to calculate the upper limit and lower limit for the parame
ter. Let us say
that the upper limit is u and the lower limit is l then the confidence interval for the parameter will be [l,u]. If
the value of the parameter is in this range then we can say that it is statistically significant.
The confidence interval is calculated at different level of significance such as 90%, 95%, 99% or at any
other significance level as required in the situation. The most commonly used confidence interval is 95%. The
level of significance determines the percentage of the sample points that will lie inside the confidence interval.
To calculate the confidence interval for a sample find the standard error of the sample, mean of the
sample and size of the sample. Also decide a level of significance for constructing the cofidence interval.
Suppose we have a sample of 100 laptops with an average weight of 2.7 kg and standard deviation of 0.34.
Lets construct a 95% confidence interval for this sample.
Mean (xbar) = 2.7 kg, Standard Deviation (sd) = 0.34 kg, Sample size (n) = 100
Using R we will construct the confidence intervals. First we define the parameters required.
xbar = 2.7
s = 0.34
n = 100
Now we calculate the standard error (se) of the sample using the following code.
se = s/ sqrt(n)
Now we build the upper and the lower limits for the cofidence interval.
alpha <- 0.05
margin_error <- qnorm(1 - (alpha/2)) * se
lower_limit <- xbar - margin_error
upper_limit <- xbar + margin_error
CI <- data.frame(upper_limit, lower_limit, Mean = xbar)
CI
## upper_limit lower_limit Mean
## 1 2.766639 2.633361 2.7
Also let us plot a Confidence interval plot.
library(plotrix)
plotCI(CI$Mean, y=NULL,
ui = CI$upper_limit,
li = CI$lower_limit,
1
pch = 1, slty = 1, scol = "black", col = 'red',
err = 'y')
0.6 0.8 1.0 1.2 1.4
2.
64
2.
68
2.
72
2.
76
1L
2.
7
The red point in the above graph shows the mean of the sample and the horizontal lines represent the upper
and lower limit of the confidence interval.
Thus the confidence interval for the followig sample at 95% level of significance is found out to be [2.63, 2.77].
This means that 95% of the data will fall in this range and the rest 5% are not going to be ths range.
Testing of Hypothesis
The use of probability theory to make a certain decision or arriving at a particular conclusion is referred as
testing of hypothesis. Whenever we feel uncertain about a particular decision we can deploy the statistical
techniques to reach our conclusion based on the sample size. Below are some of the basic concepts of
hypothetical testing.
1) Statistical Hypothesis :-
A hypothesis a just a statement or an assumption, which may be true or may be false, about the population
about which we have draw conslusion. If the hypothesis includes information about the mean and variance of
the population then it is known as simple hypothesis otherwise if any one of the information is missing in
the hypothesis it is known as composite hypothesis.
There are two types of error:
1) Null Hypothesis :- Hypothesis that is assumed to be true and tested whether it will be rejected or
accepted is known as null hypothesis.
H0 : µ0 = µ
2) Alternative Hypothesis :- Hypothesis that is opposite to the null hypothesis and is accepted when the
null hypothesis is rejected is known as alternative hypothesis.
H1 : µ1 6= µ
2
2) Types of error :-
Sometimes it may happen the wrong hypothesis is accepted by the analyst by mistake this results in error
and leads us to wrong decisions or conclusions. There are 2 types of error in hypothetical testing :-
1) Type I error :- Type I error ocuurs when the null hypotesis is true but we reject it.
2) Type II error :- Type II error ocuurs when the null hypotesis is false but we accept it.
3) Level of Significance :-
Level...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here