The code below uses the dnorm() function to calculate the probability distribution for the filtered and unfiltered datasets.
It takes the 'x' values (from the distribution) as input and returns the probability (taken from the bell curve) as output.
The code below creates a cumulative distribution function generator for both the unfiltered and filtered
datasets using the ecdf() function. Two tibbles are created, each with two
columns. In each tibble the first column is t that contains values running from -45 to 45
in increments of 0.1, and the second column is cdf containing values of the cdf generator
evaluated at the same values of t.
The code below creates the corresponding CDF for the normal distribution models (both unfiltered and
filtered) using the qnorm() function. The two CDFs are evaluated in the range from 0 to 1 in
increments of 0.01. The results are stored in two tibbles, each with two columns (this includes t,
which is just the 0 to 1 range in increments of 0.01, and the CDF values).
The code below visually compares the CDFs of models and datasets to estimate the quality of agreement. 2 plots are created that overlay the two model CDFs on top of the unfiltered and filtered datasets CDFs.
The code below calculates the confidence interval for the unfiltered and filtered datasets, and then prints out the two versions of the experimental result in the format mean ± confidence interval.
ci_filtered<-2*stat.table.filtered$sdci<-2*stat.table$sdcat("The confidence interval for the unfiltered dataset is ",stat.table$mean,"+-",ci,"\n")cat("The confidence interval for the unfiltered dataset is ",stat.table.filtered$mean,"+-",ci_filtered)
The confidence interval for the unfiltered dataset is 26.21212 +- 21.49065
The confidence interval for the unfiltered dataset is 27.75 +- 10.16686
The code below performs a 1 sample t-test which can tell us the probability that the confidence interval obtained contains the true mean.
One Sample t-test
t = -5.1471, df = 65, p-value = 2.648e-06
alternative hypothesis: true mean is not equal to 33.02
95 percent confidence interval:
mean of x