4
$\begingroup$

I have a set of data that represents periodic readings. The data shows an upward trend but I need to test for a statistical difference from zero. I believe I should use the t test, two tailed but what should I use for the second set of data? Zeros, the starting value?

0.2245
0.243
0.2312
0.1795
0.1923
0.17
0.2025
0.2059
0.2394
0.205
0.2201
0.2261
0.1817
0.2143
0.2126
0.237
0.1984
0.228
0.2292
0.2236
0.2096
0.2258
0.2155
$\endgroup$
  • $\begingroup$ To be more specific I plotted the above data and R and added a trend line geom_smooth(method="lm") which results in an upward trend. I need to find if that upward trend is significantly different from no change. $\endgroup$ – Greg Mar 3 '13 at 16:59
6
$\begingroup$

A t-test would be able to test if the average of all the values is different from 0. There is no second set of data, you want a one-sample t-test. In R:

x <- c(1,2,3,4) #PUT YOUR DATA HERE
t.test(x)

would do.

But if you want to test whether the trend is different from 0, that's a different question. How to do that would depend on whether the time intervals in your data are equal, whether you want to look at possible seasonality and so on. A simple (but possibly incorrect) method would be:

x <- c(1,2,3,4) #PUT YOUR DATA HERE
time <- seq(1,length(x))
model1 <- lm(x~time)

before that, though, I would make some plots, e.g

plot(x~time)

and perhaps look at some smoothers.

$\endgroup$
  • $\begingroup$ But do we also need to show that the data comes from a normal distribution ? $\endgroup$ – Oren Jun 12 '18 at 13:03
1
$\begingroup$

No, don't use 0s, use the one sample t-test and test whether the mean differs from 0 (it does).
In R it goes as follows:

x <- c(0.2245, 0.243, 0.2312, 0.1795, 0.1923, 0.17, 0.2025, 0.2059, 
0.2394, 0.205, 0.2201, 0.2261, 0.1817, 0.2143, 0.2126, 0.237, 
0.1984, 0.228, 0.2292, 0.2236, 0.2096, 0.2258, 0.2155)
> t.test(x)

        One Sample t-test

data:  x 
t = 52.3, df = 22, p-value < 0.00000000000000022
alternative hypothesis: true mean is not equal to 0 
95 percent confidence interval:
 0.2052 0.2222 
sample estimates:
mean of x 
   0.2137 
$\endgroup$
  • $\begingroup$ I agree with Peter Flom that the problem is definitely more difficult than sketched here if you want to know about a trend, then reading times are necessary (or are they equally spaced). $\endgroup$ – Henrik Mar 3 '13 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.