# Fitting multiple line

Short version: How can I find a function that maps X to Y when data looks like this.

Note:

For a pair of emissivity and distance relation between temperature and raw_thermal_data is linear.

Long Version:

I am working on a project which uses thermal(IR) camera. Now we extract temperature from sensor reading (raw thermal data )

For some reason I need to find a function that maps temperature data to raw thermal data. Now,

temperature = F ( raw_thermal_data, emissivity, distance )


I am trying to find,

raw_thermal_data = F1 ( temperature, emissivity, distance )


For a pair of emissivity and distance relation between temperature and raw_thermal_data is linear.

Looks like for every pair of emissivity and distance, intercept of the line is different.

Any thoughts?

• are those the only emissivity and distance combinations possible or can there be more ?If those are the only ones then learning separate intercept and slopes for each combination might be a possibility. Jul 22 '20 at 5:27
• No. Technically emissivity can be any value in between 0 and 1. And distance can be any positive number. ( but for actual usage we are considering distance upto 1m ) Jul 22 '20 at 6:01

Not knowing the data in detail, this look like a linear model with "dummys".

A standard linear model looks like ($$\beta_0$$ is the intercept, $$\beta_1$$ is the slope):

$$y = \beta_0 + \beta_1 x + u.$$

Now, when you have two distinct "groups" for which there is a "flag" in the data, you can assign a indicator variable or "dummy" (say $$d$$, a vector with =1 "true" or =0 otherwise). You can add this to your linear model:

$$y = \beta_0 + \beta_1 x + \beta_2 d + u.$$

$$d$$ introduces a separate intercept for the assigned group ($$d=1$$).

You can also add "interaction terms" to allow for a separate slope for group $$d$$ by simply multiplying $$x$$ and $$d$$.

$$y = \beta_0 + \beta_1 x + \beta_2 d + \beta_3 x d + u.$$

Note that since there already is one intercept in the model (the $$\beta_0$$), you can only add "contrasts" to the intercept. So when you have $$i$$ groups for which you want to have an individual intercept, you would add $$i-1$$ indicators/dummys to the model. For the "reference group", the intercept will be $$\beta_0$$ and for the group which is identified by the "dummy" ($$d$$ above), the intercept would be $$\beta_0 + d$$.

• Thanks. This makes sense. I will dig into this. Jul 22 '20 at 8:46