This is a very simple exercise that I'm hoping may help people with limited knowledge in statistical analysis (like myself). I am having trouble deciding what statistical analysis I can perform (in R) to determine whether or not my data are closer to one linear model or another.

For example: I have measurements of sodium and chloride in various dilute solutions:

Na <- c(1.56, 1.00, 1.60, 3.23, 2.02, 2.81, 2.09, 26.24, 1.59, 0.42)
Cl <- c(1.40, 0.91, 1.22, 2.67, 1.67, 3.01, 2.17, 27.42, 1.45, 0.51)

For simplicity, this solution is a dilution of either table salt dissolved in water or natural seawater. For each case, Cl/Na will be a specific ratio that reflects the composition of the original solution. We can visualize this by:

abline(0,1)    # expected slope for table salt dissolved in water
abline(0,1.16) # expected slope for natural seawater.

I want to know which model, table salt in water or seawater, is a more statistically accurate fit to the provided data. Linear regression analysis in R gives a line of best fit with a slope of 1.05 (lm(Cl~Na)), right in between the two models.

So, which solution do I more likely have and why? The line of best fit slope is closer to that of table salt dissolved in water, but that does not seem very statistically sound. Thoughts?

Edit: @whuber mentioned that there is one anomaly in the dataset - in reality, the provided data is just a subset of the original data. There are actually hundreds of data points in between the apparent outlier and the rest of the provided data.

Also, here is a log(Na)-log(Cl) summary of the complete dataset:

    Min.  1st Qu.   Median     Mean  3rd Qu.     Max.     NA's 
-0.46870 -0.06186  0.02654  0.02218  0.12780  0.47510      183 

Edit2: As for the "true nature of my investigation": The 'solution' in question is likely a mixture of both table salt water and natural seawater. What I'd like to do is find a definitive way (through statistical analysis) to show that I have more of one or the other. I had hoped that my simplified question/dataset would yield an answer from the community, but it seems I was off base. If it helps, a complete dataset is now hosted below:


Looking at the distribution of the complete data shows I have more Cl/Na about 1.00, but this does not seem 'sound enough' to back up an argument. The probability that I have one solution or the other is unknown. I have the raw data and relevant models for Cl to Na to run with.

For clarification, the original question is still the one I'd like to solve. An alternative question could be: Which solution do I have more of and what analysis did I use to come to that conclusion?

  • 1
    $\begingroup$ It's a good question (+1). But in your particular example a severe problem exists: one observation (10% of the total) is far from the others. It will control every aspect of your estimates, but you hardly dare delete it outright because it represents a substantial fraction of the data! Since you are analyzing chemical concentrations, it is natural--and scientifically meaningful--to express them as logarithms. When you do that, your problematic value becomes much less of an issue, too. The answer is then pretty clear. $\endgroup$
    – whuber
    Commented Apr 28, 2016 at 18:44
  • 2
    $\begingroup$ Thanks whuber. In reality, hundreds of data points exist between my apparent outlier and the rest of the data. I chose a random subset, and this is what we got! I can change that data point to be more similar to the others. I'm mainly interested in the statistical approach to solving this question. $\endgroup$
    – James
    Commented Apr 28, 2016 at 18:47
  • $\begingroup$ That's good information to know about the outlier--it will spare us from focusing unnecessarily on an incidental aspect of your example. It would be interesting to see a brief statistical summary of the values in log(Na) - log(Cl) (such as the output of summary) for your entire dataset. $\endgroup$
    – whuber
    Commented Apr 28, 2016 at 18:51
  • $\begingroup$ Is it possible some of your observations could come from table salt water and others from seawater? If not, and you are sure the solution is one or the other, then could you assign probabilities to each of those possibilities? If none of the above, then please tell us more specifically about your circumstances and objectives. $\endgroup$
    – whuber
    Commented Apr 28, 2016 at 19:09
  • $\begingroup$ @whuber - I tried to be as simple as possible in my original post. In reality, it is extremely likely that the dataset is a mixture of the two solutions (not to mention a mixture of who-knows-what-else, but I digress). As such, I completely expect a slope that doesn't definitively point to saltwater or seawater. What I'd like to really nail down is which slope is the data more similar to: with stats! $\endgroup$
    – James
    Commented Apr 28, 2016 at 19:13

1 Answer 1


So I've been working on understanding this question for a while over the last 20 hours or so. There has been lots of useful discussion, but no definitive answer. I've found a couple resources that might help others understand why I've chosen to go this route.

1) Soil Equilibria: What happens to acid rain? By Sharon Anthony, Michael Beug, Roxanne Hulet, and George Lisensky is a good chemistry learning book and has what I believe to be a thorough explanation of how to use a t-test, but not necessarily why to use one.

2) This blog post over at minitab.com explains when to use a t-test as well as additional information on how to use it.

I think the kicker here is that as per the original post, I am expecting a slope of either 1.00 or 1.16, depending on which solution I have if I scatter plot Na and Cl. Another way to phrase this is I am expecting a ratio for Cl to Na of either 1.00 or 1.16 for every sample in the set. This gives me two hypothesis to test in my t-test.

The t-test is defined as:

$t=\frac{|x-known| * \sqrt N}s$

where $t$ will give a value for the comparison of the experimental mean to the known value, which we can then compare to a tabulated t table for our corresponding degrees of freedom ($N$) and confidence interval (lets pick 95%). $s$ is the standard deviation, $x$ is the mean Cl to Na ratio for this example, and $known$ is the known value or hypothesis I want to test:

For hypothesis 1) the ratio of Cl to Na is equal to 1.16 for each sample.

Our mean Cl to Na ratio $x$ is (in R) mean(Cl/Na) or 0.95. Similarly, $s$ = sd(Cl/Na) or 0.14. Now if we plug and chug into our t-test equation, we get a $t$ of 4.5. The corresponding $t$ in the tabulated table for 95% confidence and $N = 9$ is 2.26. Our calculated $t$ is greater than the tabulated t value so the mean Cl/Na is different than 1.16 at the 95% confidence interval.

For hypothesis 2) the ratio of Cl to Na is equal to 1.00 for each sample.

We will use the same steps as in hypothesis 1 (only change $known$), which gives $t = 1.07$. 1.07 is less than our tabulated t value of 2.26 for the same $N$ and confidence interval of 95%, so we can say that our mean Cl/Na is not different than 1.00 at the 95% confidence interval.

So to answer the question, I most likely have a table salt dissolved in water solution based on a t-test. I hope some stat enthusiasts can comment on whether or not this is a valid answer!

Edit: 9 degrees of freedom with 10 samples.

Edit2: R t.test(Cl/Na,mu=1) apparently does not come to the same conclusion as I did above. I do not know why.

  • 1
    $\begingroup$ A t-test does not answer your question. If you want to go that route, the answer depends on the prior probabilities you place on the two hypotheses (which is why I asked you about them yesterday). But why do you pose your question in this way in the first place? Why not learn as much as you can by looking at the distribution of the ratios? What about estimating the mixture proportions? You can't reasonably hope for a definitive answer until the true nature of your investigation is clear. $\endgroup$
    – whuber
    Commented Apr 29, 2016 at 17:34
  • $\begingroup$ The question is structured as such in hope that I would get a simple clear cut answer. It seemed to me that there would be a simple way to say 'this data is better represented by model x as opposed to model y'. The distribution of the ratios from the complete dataset show the median ratio is indeed about 1.00, but I'm not sure I can definitively say 'model x fits better than model y' merely by looking at the distribution. I can estimate proportions based on the mean ratio, but I was looking for an answer geared towards the initial question. I gave it a shot at least! I'll add an edit in the OP $\endgroup$
    – James
    Commented Apr 29, 2016 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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