How to fit functions with same parameters?

Hello.
I have some functions with the same parameters and want to fit these parameters with each data.
Example:
p is parameters set. Now I consider two parameters p[1] and p[2] as examples.

example_1(x) = p[1] + p[2] * x 
example_2(x) = p[1] * x^2 - p[2] * x
example_3(x) = p[1] + p[2] - x^2  

And I have data sets for each function:

x_1, y_1, error_y_1 #data for function example_1
x_2, y_2, error_y_2 #data for function example_2
x_3, y_3, error_y_3 #data for function example_3

How do you fit parameters in such a situation? What package do you use?

Thank you for your kindness :smiling_face_with_three_hearts:

“fit” can mean many things. Maybe start with GitHub - JuliaNLSolvers/LsqFit.jl: Simple curve fitting in Julia ? But that package cannot make use of the error_y_1 info, for that you could code your own objective and use Optim.jl to minimize this. Or use some Bayesian approach.

I think I understand your problem.
You have only one parameter tuple p=(p1,p2) which must fit three data sets
{x_1,y_1},{x2,y2} and {x3,y3} simutanenously.

The solution is to write your own fitness function fitness(p)
then use BlackBoxOptim to find the optimum value of the p tuple