How to use t.test {stats} when comparing a mean against a sum (NOT a mean against a mean) ?

I'm trying to use R's built-in stats package to statistically measure the difference between what I observe and what I expect. I believe the best test to use is a t-test (using t.test) - however that seems to just compare means. Here's my simple data:

brightness_1 <- c(1,1,2,2)
brightness_2 <- c(8,9,8,10)

brightness_combined <- c(70, 71, 71, 74)

Let's say I take a lightbulb and put some energy into it, and measure the brightness. I do it four times and the results are brightness_1. Then I increase the energy and measure four more times - that's brightness_2.

Okay - so if I combine however much energy I used for both experiments, I would expect to see the brightness is the combination. Maybe I'd expect something like an average of ~10. However, what I see is that my values are much higher than expected : brightness_combined.

How can I measure this? If I use a t-test with the average of brightness_combined set as the 'mu' value, it will compare the means....but I want it to compare the sum of brightness_1 and brightness_2. If I were to sum them beforehand, I lose the number of samples, right?

You must to evaluate the energy like a continuous variable instead a categorical one... You must evaluate an exponential model or a polynomic one (second level maybe)...

Thank you for your input. How can I do this with my data?

Don you have the exact values of energy? Wats, joules, amps?

example of lm with exponential terms.
The approach is to build a model of the phenomenon and then evaluate that model.


(mydata <- tibble(
  brightness_combined=c(70, 71, 71, 74)

(mydata2 <- mutate(mydata,
  exp_b1 =exp(brightness_1),
  exp_b2 =exp(brightness_2)
lm1 <- lm(brightness_combined  ~exp_b1 + exp_b2,
          data = mydata2)

mydata2$lm_pred <- predict(lm1,newdata = mydata2,type="response")


I wasn't familiar with the exp feature before, thank you for the example!

However, isn't this ignoring that the 'expected' is supposed to be brightness_1 + brightness_2 ? In my own experiment I expect the combined_brightness to be the average of (1,1,2,2) + average of (8,9,8,10) - meaning my actual observation (70, 71, 71, 74) is much higher compared to that sum. But I think here if I'm correct it's the actual observation compared to the exponential model of each drug?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.