Question a: Total phosphorus concentrations in buffered streams would be less than that in not buffered streams. Hnull: The mean phosphorus concentrations of a given sample from buffered streams with vegetation (xbar1) minus the mean phosphorus concentrations of a sample from not buffered streams (xbar2) is greater than or equal to zero. Halt: The mean phosphorus concentration of a given sample from buffered streams (xbar1) minus streams with no buffer, without vegetation, (xbar2) is less than zero. A one-side, two sample t-test should be conducted

Removes scientific notation

options(scipen = 999)

Question b: Test Statistic and p-value Sample Size of buffered streams

n1<-10

Mean total phosphorus in buffered streams in mg/L

xbar1<-1.5

Standard deviation of total phosphorus in buffered streams in mg/L

s1<-.3

Sample size of not buffered streams

n2<-10

Mean total phosphorus in not buffered streams in mg/L

xbar2<-1.7

Standard deviation of total phosphorus in not buffered streams in mg/L

s2<-.8

Calculating the Welch’s t-statistic

t.stat<-(xbar1-xbar2)/sqrt(s1^2/n1+s2^2/n2)
t.stat
## [1] -0.7402332

Calculating the Welch’s degrees of Freedom

A<-s1^2/n1
B<-s2^2/n2

Degrees of Freedom

df<-round((A+B)^2/(A^2/(n1-1)+B^2/(n2-1)),2)
df
## [1] 11.48
p.value<-pt(t.stat,df)
p.value
## [1] 0.237013

Calculating the p-value. Pt returns the p-value (probability) of less than the test statistic (in this case, t-stat) with the appropriate df. to calculate the appropriate p-value, we need to calculate p. We hypothesized that total phosphorus concentrations in buffered streams would be less than that in not buffered streams. We sampled 10 buffered streams and 10 not buffered streams. Based on our sample, we found that average phosphorus concentration in buffered streams has a sample mean of 1.5mg/L, and not buffered streams, a sample mean of 1.7mg/L. Average phosphorus concentrations in buffered streams is .2mg/L less than that of not buffered streams. We conducted a two independent sample Welch’s t-test (t=-0.74,df=11.48, p=0.23). This p-value provides no evidence against the null hypothesis, suggesting that the average phosphorus concentration in buffered streams could be greater than that of not buffered streams depending on the sample size.

Question c: Difference of Means One-side, two-sample t-test

Difference in means

diff.means<-xbar1-xbar2
diff.means
## [1] -0.2

Multiplier

multiplier<-qt(0.95, df)
multiplier
## [1] 1.789038
lower<-xbar1-xbar2-multiplier*sqrt((s1^2/n1)+(s2^2/n2))
lower
## [1] -0.6833715
upper<-xbar1-xbar2+multiplier*sqrt((s1^2/n1)+(s2^2/n2))
upper
## [1] 0.2833715

The 90% confidence interval for total phosphorus concentrations in streams is (-0.68 mg/L, 0.28 mg/L). We are 90% confident that this interval includes the true difference in means of phosphorus concentrations between buffered streams and not buffered streams located in the streams of piedmont North Carolina.