Lab Assignment

  1. Generate random points for a study area of interest to you (as in the example above). Conduct a hypotheses test that the mean difference is a) equal to zero then b) greater than 0.02. For each use thet.testfunction. In your answer include your hypothesis statements, p-value, and a sentence interepting your results from each hypothesis test. Include a screenshot showing your bounding box coordinates plotted on Google Maps (out of 5)

If students follow the lab. they have already done part one of this question

Students need to first select an study area. They then go to the (http://bboxfinder.com/) and find bbox of their study area: This is my own selected area -81.507419,45.964666,-81.493774,45.971631

X1 <- runif(29, min = 81.808421, max = 81.851207)
Y1 <- runif(29, min = 6.825655, max = 6.852244)
df1 <- data.frame(X1, Y1)


X2 <- runif(29, min = 81.808421, max = 81.851207)
Y2 <- runif(29, min = 6.825655, max = 6.852244)
df2 <- data.frame(X2, Y2)

d <- sqrt((df1$X1 - df2$X2)^2 + (df1$Y1 - df2$Y2)^2)

This is hypothesis for mean difference is equal to zero \[H_0: \mu = 0\] \[H_a: \mu \ne 0\] Test it using t.test

t.test(d, mu=0)
## 
##  One Sample t-test
## 
## data:  d
## t = 13.965, df = 28, p-value = 3.843e-14
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  0.01525606 0.02050078
## sample estimates:
##  mean of x 
## 0.01787842

This is hypothesis for mean difference is grater than 0.02

\[H_0: \mu \geq 0.02\]

\[H_A: \mu \lt 0.02\]

the above would change to

t.test(x=d, alternative ="less", mu=0.02)
## 
##  One Sample t-test
## 
## data:  d
## t = -1.6572, df = 28, p-value = 0.05432
## alternative hypothesis: true mean is less than 0.02
## 95 percent confidence interval:
##       -Inf 0.0200562
## sample estimates:
##  mean of x 
## 0.01787842
  1. For the GPS data, is the mean difference significantly different from zero ( \(α=0.05\) )? Use thet.test function. In your answer include your hypothesis statements, p-value, and a sentence interepting your results from each hypothesis test. (out of 5)

To answer this question, students need to use the following dataset I gave them in the GPS DATA section of the lab

df <- read.csv("https://www.dropbox.com/s/f7xcibye2epgqgy/dfprocessed.csv?dl=1")
open_dis <- df$dis[which(df$loctype=="Open")]
forest_dis <- df$dis[which(df$loctype=="Forest")]

This is hypothiss

\(H_0: \mu = 0\) \(H_a: \mu \ne 0\)

so now we are testing \(H_0: \mu = 0\) on the sample mean difference in d

t.test(df$dis, mu=0)
## 
##  One Sample t-test
## 
## data:  df$dis
## t = 7.9199, df = 35, p-value = 2.587e-09
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  20.99730 35.47209
## sample estimates:
## mean of x 
##   28.2347
  1. For the GPS data, was the difference between the two receivers statistically different between locations under forest canopy vs. open sky? Was there more or less difference when under forest canopy? Conduct both one tailed and two tailed hypothesis tests. For this question you can use thet.test function. In your answer include your hypothesis statements, p-value, and a sentence interepting your results from each hypothesis test. (out of 5)

To answer the question that was the difference between the two receivers statistically different between locations under forest canopy vs. open sky? assume \(\mu_1\) is data of forst and \(\mu_2\) is for open sky. \[H_0: \mu_1 = \mu_2\] \[H_A: \mu_1 \ne \mu_2\]

t.test(forest_dis,open_dis)
## 
##  Welch Two Sample t-test
## 
## data:  forest_dis and open_dis
## t = 0.90004, df = 33.962, p-value = 0.3744
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -7.316132 18.947130
## sample estimates:
## mean of x mean of y 
##  30.33474  24.51924

for the part two that asks Was there more or less difference when under forest canopy? Again we assume \(\mu_1\) is data of forst and \(\mu_2\) is for open sky.

\[H_0: \mu_1 \leq \mu_2\] \[H_A: \mu_1 \gt \mu_2\]

t.test(forest_dis,open_dis,alternative = "less")
## 
##  Welch Two Sample t-test
## 
## data:  forest_dis and open_dis
## t = 0.90004, df = 33.962, p-value = 0.8128
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
##      -Inf 16.74153
## sample estimates:
## mean of x mean of y 
##  30.33474  24.51924
  1. For the GPS data, test whether the distance between the two receivers were statistically lower when accuracy was low (<=12, vs high >12). For this question you can just use the t.test function. In your answer include your hypothesis statements, p-value, and a sentence interepting your results from each hypothesis test. (out of 5) assume \(\mu_1\) is when accuracy was low and \(\mu_2\) is when accuracy was high. \[H_0: \mu_1 \leq \mu_2\] \[H_A: \mu_1 \gt \mu_2\]
# use this codes to filter gps data based on the accuracy 
low_accuracy <- df$dis[which(df$acc<=12)]
high_accuracy <- df$dis[which(df$acc>12)]

t.test(low_accuracy,high_accuracy,alternative = "less")
## 
##  Welch Two Sample t-test
## 
## data:  low_accuracy and high_accuracy
## t = -1.2662, df = 33.555, p-value = 0.1071
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
##      -Inf 3.011402
## sample estimates:
## mean of x mean of y 
##  24.00091  32.96657