Say a user could enter project data into my software. Each project has 2 variables "size" and "work" and they're related but the relationship is not known. Is there a way to programmatically determine the relationship between the variables based on previous data and forecast the amount of work provided if only given the size of the project in the future?

For Example, say the user had manually entered the following projects.

  • Project 1 - Size:1, Work: 4
  • Project 2 - Size:2, Work: 7
  • Project 3 - Size:3, Work: 10
  • Project 4 - Size:4, Work: x

What should I look into to be able to programmatically determine, that Work = Size*3+1 and therefor be able to say that x=13?

1 Answer 1


This is called regression analysis. In your example, you're looking for a linear relationship between Work and Size,

Work = a * Size + b + noise

Given a set of (Work, Size) observations, you can solve for a and b using ordinary least squares. This method can handle any number of explanatory variables (in addition to Size).

More sophisticated approaches to this type of problem fall under the umbrella of machine learning.

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.