My data set relates to goods sold. I have a unit price, qty sold at that price and a number of other variable, such as sales person, geography, marketing support. the qty sold varies throughout any sampled period of time irrespective of price. It also 'appears' to vary more when the price is changed-as common sense would sugggest.

What I would like to measure is the impact/significance of each of the other variables on the qty sold. I'm not a stats expert or coder butr have some experience/knowledge of using linear regression and correlation coefficients in my work

  • $\begingroup$ Are you trying to choose the best subset of predictors? If so, this falls under the general category called "variable-selection", which has been discussed on this site a lot - stats.stackexchange.com/questions/tagged/feature-selection. But, the sentence What I would like to measure is the impact/significance of each of the other variables on the qty sold. makes me think it may suffice to simply look at the marginal relationships between each variable and the response, as not mention of the "joint effects" is made. $\endgroup$ – Macro Jul 19 '12 at 12:37

Yes, substantially you should use a linear model, where 'qty sold' is the dependent variable and (initially) all the other variables are the predictors. You can also choose to not insert all the variables in the model, for example because you have theoretical resasons for which some variables are not important in this specific case. Bytheway, starting from your full model, then you should (step by step) reduce it, since surely not all variables will significally influence the dependent variable. Each time, you observe the changes in your model after the reduction, and decide whether continuing to reduce it or accept it. At the end of the process, you should have the more economic linear model that explains the behavior of your dependent variable.

If you want to use R, as suggested by Arielf (and also I suggest you to use it...), this is a guide that explains the basic commands.


this.is.not.a.nick's answer is good as a general and solid set of guidelines.

If you need a more exact howto recipe, here's a start:

  • Use R. It can be downloaded from www.r-project.org
  • write your data set into a CSV file where the 1st column is the target variable (say qty_sold) and the rest of the columns are the independent input variables
  • Once inside R you may load your data into a data-frame using the read.csv() function and run the lm() function to generate the model.
  • run a summary() on the model to get all the linear coefficients

And the actual minimalistic code example:

    R> dat <- read.csv('my_sales_file.csv', header=T)  # read the data
    R> model <- lm(qty_sold ~ . , data=dat)            # learn the model
    R> summary(model)                                  # show the model

The above assumes that your CSV file 1st line is a header (column names), and that the target variable column is called qty_sold.



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.