3
$\begingroup$

Assume having a dataset composed of 3 source columns and 1 results column. Here I'd like to measure the effect of A, B from source3 based on the results. However, results column is also affected by the other numerical features, like source1, source2. Is there an effective method to measure this effect of categorical features while excluding the effect of numerical features?

>>data
     source1 source2 source3 results
1       1       7       A       9    
2       2       8       A      11
3       3       9       B      14
4       4      10       B      16
5       5      11       B      18
$\endgroup$
1
$\begingroup$

Running a linear regression including all three source variables will spit out a beta coefficient for source3. It is interpreted as the expected change in results as we change from source3's category A to category B (or vice versa depending on software implementation), while keeping fixed the values of source1 and source2. So if your data (approximately) meet the assumptions of linear regression this is seems like a nice, well-trodden path for you to choose.

$\endgroup$
  • $\begingroup$ can you elaborate a bit more? step 1: linear regression to get function f: result~source1+source2+ source3. Here, source3 is categories. (need to covert with dummy variables, right?). step2: get f(B->A0 and f(A->B) results. step3: compare the different. right? $\endgroup$ – HappyCoding Jun 21 '18 at 5:47
  • $\begingroup$ therefore, to generalize the solution, it actually doesn't require the assumption on linear right? We can get any model (nn, or trees, or rules) in step1, and then perfrom step2 and step3 as the same. how do you think? $\endgroup$ – HappyCoding Jun 21 '18 at 5:49
  • $\begingroup$ I'm sorry but I don't quite understand your notation in step2. Step 1 is to run a linear regression, Step 2 is extract the regression coefficient from the model and interpret it. In R this would be coef(lm(results~source1+source2+source3, data = data)). It will give you a coefficient for source3 which is interpreted as the effect of source3 on resultswhile holding constant source1 and source2. So you are controlling for the effects of those variables. This sounds like what you wanted in the OP. $\endgroup$ – klumbard Jun 21 '18 at 13:16
  • $\begingroup$ Furthermore, linear regression is a well-understood modeling technique and is very interpretable. A neural network is a black box and is typically used for a prediction exercise; you're not learning as much about the effect of source3 from a neural network. Rather you're trying to maximize the accuracy of your results predictions, and sacrificing interpretability in doing so $\endgroup$ – klumbard Jun 21 '18 at 13:19
  • $\begingroup$ step2 here f(B->A) means after having the model, we then substitute all A by B. According to the suggestion, via coef(lm), we get f=1+ 1* source1 + 2*source2 + source3B. However, notice that from this lm model, we still can't exactly comment on the effect of source3B and source3A. are we saying source3A has no effect? $\endgroup$ – HappyCoding Jun 24 '18 at 9:09

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.