3
$\begingroup$

I have two data sets, both resemble $y = x^2$, but say I don't know that yet. They are both evenly sampled, but the sampling rates are not the same between them, and they exist over different domains. Both sets may return data at the same $x$ value. How do I perform a regression over such a data set?

If I combine them into one large dataset, the fit will be weighted towards the dataset that has the higher density points (or the one with more total points maybe?) But, I want the two datasets to be weighted evenly in the $x$ dimension - that is, even though there is much higher data density around the point $x=5$ for the red set compared to the black set, I would want the black point to have as much weight as the red points between say $x = 4.5$ and $x=5.5$. I feel this is a very naive way of saying it, but perhaps someone with a stats background can fix this up.

Example data set.

$\endgroup$
  • $\begingroup$ Why do you want to merge these dataset ? You have a superbe fit for each one. To this respect the pink curve is deceiving. Why not instead adding a dummy variable in your regression indicating if your point comes from the dataset 1 or 2 ? $\endgroup$ – brumar Jun 24 '15 at 7:11
  • $\begingroup$ Because I want to reduce them to one set that best matches the setup. $\endgroup$ – James Jun 24 '15 at 11:10
  • $\begingroup$ What do you call the "setup" ? y is your dependent variable, right ? Oh...Or maybe it's just a fictitious example to have an answer for your more complex case ? $\endgroup$ – brumar Jun 24 '15 at 12:26
  • $\begingroup$ Yes, this is a simplified version of something else I want to do. $\endgroup$ – James Jun 25 '15 at 0:09
3
$\begingroup$

You could use weighted regression to achieve your goal. Apart from the data, for each observation a weight is given that indicates how important the error for that observation is. More information and an example here: How to use weights in function lm in R?

$\endgroup$
  • $\begingroup$ How can the weights be calculated? $\endgroup$ – James Jun 25 '15 at 0:10
  • $\begingroup$ The weights are subjective. In your case, the Data1 errors shoud be weighed more than the Data2 errors. Try 2 and 1 respectively first, and go from there. $\endgroup$ – spdrnl Jun 25 '15 at 9:48
2
$\begingroup$

Are these two datasets obtained by sampling the same population? And is the data longitudinal/correlated (eg. are you sampling the same two lab mice over and over again)? If the two datasets are sampled from the same population, and the data is not longitudinal/correlated, then in my mind it is fine to merge the data. You are simply adding more data points to your sample. The difference in domain is not an issue, as long as you actually want to model the data for that entire domain.

But, I want the two datasets to be weighted evenly in the x dimension - that is, even though there is much higher data density around the point $x=5$ for the red set compared to the black set, I would want the black point to have as much weight as the red points between say $x=4.5$ and $x=5.5$.

By this, do you mean that you want ONE black point at $x=5$ to equal in weight the MULTIPLE red points between $x=4.5$ and $x=5.5$? This seems strange to me, because you're essentially saying that you trust the black measurements much more than the red measurements, but if you are using the same setup and same sampling population, I don't see why this should be the case?

It would help if there was more information :) but hope this is helpful!

$\endgroup$
  • $\begingroup$ +1: You ask some good questions and make relevant, useful points. Welcome to our site! $\endgroup$ – whuber Jan 3 '17 at 22:42
  • $\begingroup$ Thanks for the comments. I basically have two methods for measuring the same data set at different resolutions. I want a way to do a combined regression without unfairly biasing it towards the data set with more points. I trust each data set the same amount. $\endgroup$ – James Jan 4 '17 at 3:59
  • $\begingroup$ From what it sounds like, you are not trying to compare the two methods, but rather trying to define the relationship between $x$ and $y$ using the two datasets. If the only difference between the two datasets are sampling intervals (I assume this is what you meant by resolution?), and the data is not sensitive to any other parameters like time (ie. on average, you would not expect to observe different $y$ given the same $x$, within measurement and random error), I see no problem in combining the data and fitting one model to it. $\endgroup$ – dwhdai Jan 4 '17 at 15:29
  • $\begingroup$ I think one important decision to make is whether you trust the data points equally, or the datasets equally. The former is more common, and suggests that each point (regardless of colour) was sampled under similar conditions with similar measurement errors, etc. This would give me more confidence to merge the two datasets. The latter suggests that the two datasets are sampled under different conditions (besides sampling interval/time, which is assumed unimportant), which only you would know the rationale for and in that case, I would explore weighted regression as @spdrnl mentioned. $\endgroup$ – dwhdai Jan 4 '17 at 15:35

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.