Essay Available:

You are here: Home → Statistics Project → Mathematics & Economics

Pages:

3 pages/≈825 words

Sources:

1 Source

Level:

MLA

Subject:

Mathematics & Economics

Type:

Statistics Project

Language:

English (U.S.)

Document:

MS Word

Date:

Total cost:

$ 14.58

Topic:

# Data Analysis Using R (Statistics Project Sample)

Instructions:

statistical analysis using r programming.

source..Content:

Name:

Professorâ€™s name

Subject

Date

Data analysis using R

2. In an experiment to compare two diets for fattening beef steers, nine pairs of animals were chosen from the heard; members of each pair were matched as closely as possible with respect to hereditary factors. The members of each pair were randomly allocated, one to teach diet. The following table shows the weight gains (lb) of the animals over a 140-day test period on Diet 1 (X ) and on Diet 2 ( Y ).

(a) Construct a 90% confidence interval for the difference between the two diets.

#value of X and Y

#value of X and Y

X<-c(596,422,524,454,538,522,478,564,556)

Y<-c(498,460,468,458,530,582,528,598,456)

t.test(Y,X,alternative = c("two.sided", "less", "greater"),

mu = 0, paired = TRUE, var.equal = FALSE,

conf.level = 0.90)

Confidence intervals -46.95389 â‰¤ Âµ â‰¥30.06500

(b) Conduct a hypothesis test at the 5% significance level that tests whether the diets are equal.

Which one is better?

# T-tes for hypothesis.

t.test(X,Y,alternative = c("two.sided", "less", "greater"),

mu = 0, paired = TRUE, var.equal = FALSE,

conf.level = 0.95)

Results of above test.

Paired t-test

data: X and Y

t = 0.40777, df = 8, p-value = 0.6941

alternative hypothesis: true difference in means is not equal to 0

95 percent confidence interval:

-39.31068 56.19957

sample estimates:

mean of the differences

8.444444

6. Compute the following intervals the long way, feel free to check your work with test() .

(a) Produce a 92% confidence interval for the mean ToothGrowth for Guinea pigs who received

Vitamin C.

#92% confidence interval for the mean ToothGrowth for Guinea pigs who received Vitamin C.

# n sample size

n<-length(tooth_VC)

# mean for tooth_OJ

m<-mean(tooth_Vc)

#confidence level

conf.level<-0.92

# Z score

z<-qt((1+conf.level)/2,df=n-1)

se<-sd(tooth_VC)/sqrt(n)

se<-sd(tooth_VC)/sqrt(n)

# confidence interval

ci<-z*se

# upper level

upper<-m+ci

#lower level

lower<-m-c

Confidence interfeval 14.2253â‰¤ Âµ â‰¥ 19.703

(b) Produce a 97% confidence interval for the mean ToothGrowth for Guinea pigs who received

Orange Juice.

# 97% confidence interval for the mean ToothGrowth for Guinea pigs who received Orange Juice.

# n sample size

n<-length(tooth_OJ)

# mean for tooth_OJ

m<-mean(tooth_OJ)

#confidence level

conf.level<-0.95

# Z score

z<-qt((1+conf.level)/2,df=n-1)

se<-sd(tooth_OJ)/sqrt(n)

se<-sd(tooth_OJ)/sqrt(n)

# confidence interval

ci<-z*se

# upper level

upper<-m+ci

#lower level

lower<-m-c

Confidence intervals 17.21916â‰¤ Âµ â‰¥ 23.41565

(c) Produce a 95% confidence interval for the difference of the means VC-OJ

#95% confidence interval for the difference of the means VC-OJ

# n sample size

n<-length(tooth_OJ)

# mean for tooth_OJ

m1<-mean(tooth_OJ)

# mean for tooth_VC

m2<-mean(tooth_VC)

# difference in the Mean

m<-m2-m1

#confidence level

conf.level<-0.95

# Z score

z<-qt((1+conf.level)/2,df=n-1)

se<-sd(tooth_VC)/sqrt(n)

se<-sd(tooth_VC)/sqrt(n)

# confidence interval

ci<-z*se

# upper level

upper<-m+ci

#lower level

lower<-m-c

Confidence intervals -6.786586â‰¤ Âµ â‰¥- 0.6134142

(d) Use your answer in part (c)

Is there a statistical difference in the mean ToothGrowth Lengths of the two populations (the guinea pigs who get Vitamin C and those who get Orange Juice)? This is not a yes or no question!! State you conclusion properly.

7. The dataset found in ratsâ€™ zinc.csv contains measurements of zinc concentrations (in mg/ml) in the blood of two groups of rats. Group A received a dietary supplement of calcium, and group B did not. Researchers are interested in variations in zinc level as a side effect of dietary supplementation of calcium.

Investigate the claim that the zinc concentration for rats who take calcium supplements is less than the zinc concentration for rats that do not. Justify your analysis.

R code:

# reading the rats_zinc.csv file

zinccon= read.csv("rats_zinc.csv", Header="T")

#Grouping the the two categories A and B

Groupz<-split(zinccon$Zinc,zinccon$Gr...

Professorâ€™s name

Subject

Date

Data analysis using R

2. In an experiment to compare two diets for fattening beef steers, nine pairs of animals were chosen from the heard; members of each pair were matched as closely as possible with respect to hereditary factors. The members of each pair were randomly allocated, one to teach diet. The following table shows the weight gains (lb) of the animals over a 140-day test period on Diet 1 (X ) and on Diet 2 ( Y ).

(a) Construct a 90% confidence interval for the difference between the two diets.

#value of X and Y

#value of X and Y

X<-c(596,422,524,454,538,522,478,564,556)

Y<-c(498,460,468,458,530,582,528,598,456)

t.test(Y,X,alternative = c("two.sided", "less", "greater"),

mu = 0, paired = TRUE, var.equal = FALSE,

conf.level = 0.90)

Confidence intervals -46.95389 â‰¤ Âµ â‰¥30.06500

(b) Conduct a hypothesis test at the 5% significance level that tests whether the diets are equal.

Which one is better?

# T-tes for hypothesis.

t.test(X,Y,alternative = c("two.sided", "less", "greater"),

mu = 0, paired = TRUE, var.equal = FALSE,

conf.level = 0.95)

Results of above test.

Paired t-test

data: X and Y

t = 0.40777, df = 8, p-value = 0.6941

alternative hypothesis: true difference in means is not equal to 0

95 percent confidence interval:

-39.31068 56.19957

sample estimates:

mean of the differences

8.444444

6. Compute the following intervals the long way, feel free to check your work with test() .

(a) Produce a 92% confidence interval for the mean ToothGrowth for Guinea pigs who received

Vitamin C.

#92% confidence interval for the mean ToothGrowth for Guinea pigs who received Vitamin C.

# n sample size

n<-length(tooth_VC)

# mean for tooth_OJ

m<-mean(tooth_Vc)

#confidence level

conf.level<-0.92

# Z score

z<-qt((1+conf.level)/2,df=n-1)

se<-sd(tooth_VC)/sqrt(n)

se<-sd(tooth_VC)/sqrt(n)

# confidence interval

ci<-z*se

# upper level

upper<-m+ci

#lower level

lower<-m-c

Confidence interfeval 14.2253â‰¤ Âµ â‰¥ 19.703

(b) Produce a 97% confidence interval for the mean ToothGrowth for Guinea pigs who received

Orange Juice.

# 97% confidence interval for the mean ToothGrowth for Guinea pigs who received Orange Juice.

# n sample size

n<-length(tooth_OJ)

# mean for tooth_OJ

m<-mean(tooth_OJ)

#confidence level

conf.level<-0.95

# Z score

z<-qt((1+conf.level)/2,df=n-1)

se<-sd(tooth_OJ)/sqrt(n)

se<-sd(tooth_OJ)/sqrt(n)

# confidence interval

ci<-z*se

# upper level

upper<-m+ci

#lower level

lower<-m-c

Confidence intervals 17.21916â‰¤ Âµ â‰¥ 23.41565

(c) Produce a 95% confidence interval for the difference of the means VC-OJ

#95% confidence interval for the difference of the means VC-OJ

# n sample size

n<-length(tooth_OJ)

# mean for tooth_OJ

m1<-mean(tooth_OJ)

# mean for tooth_VC

m2<-mean(tooth_VC)

# difference in the Mean

m<-m2-m1

#confidence level

conf.level<-0.95

# Z score

z<-qt((1+conf.level)/2,df=n-1)

se<-sd(tooth_VC)/sqrt(n)

se<-sd(tooth_VC)/sqrt(n)

# confidence interval

ci<-z*se

# upper level

upper<-m+ci

#lower level

lower<-m-c

Confidence intervals -6.786586â‰¤ Âµ â‰¥- 0.6134142

(d) Use your answer in part (c)

Is there a statistical difference in the mean ToothGrowth Lengths of the two populations (the guinea pigs who get Vitamin C and those who get Orange Juice)? This is not a yes or no question!! State you conclusion properly.

7. The dataset found in ratsâ€™ zinc.csv contains measurements of zinc concentrations (in mg/ml) in the blood of two groups of rats. Group A received a dietary supplement of calcium, and group B did not. Researchers are interested in variations in zinc level as a side effect of dietary supplementation of calcium.

Investigate the claim that the zinc concentration for rats who take calcium supplements is less than the zinc concentration for rats that do not. Justify your analysis.

R code:

# reading the rats_zinc.csv file

zinccon= read.csv("rats_zinc.csv", Header="T")

#Grouping the the two categories A and B

Groupz<-split(zinccon$Zinc,zinccon$Gr...

Get the Whole Paper!

Not exactly what you need?

Do you need a custom essay? Order right now:

### Other Topics:

- Calculations Applying The Concepts Of The Binomial DistributionDescription: A group of 8 students apply for MBA program at CBA, CSULB. According to the historical data, probability of admittance at MBA program is 65...1 page/≈275 words| No Sources | MLA | Mathematics & Economics | Statistics Project |
- Data Analysis Using RDescription: In an experiment to compare two diets for fattening beef steers, nine pairs of animals were chosen from the heard; members of each pair were matched as closely as possible with respect to hereditary factors...3 pages/≈825 words| 1 Source | MLA | Mathematics & Economics | Statistics Project |
- Why Is Endogeneity An Issue In The Context Of A Multiple Regression Models?Description: Omitted viable bias can be corrected by adding proxy variables. In general, endogeneity issues can be corrected by including instrument variables in a model....2 pages/≈550 words| No Sources | MLA | Mathematics & Economics | Statistics Project |