Hello.
I hope everyone is fine and having a great day.
Right now I am not.
Context: I have a dataset, about greenhouse gazes emissions from 1990 to 2020, and I have to analyze it in Scilab. Specifically, I am trying to find the probability distribution that my dataset might be following.
In the code portion I will give you, I am testing the normal distribution.
dataWorldMin=dataWorldMin( : )
year=year( : )
function z=normDis(B,x)
z=(1./sqrt(2.*%pi.*B(1))).exp(-(1./2).((x-B(2)).^2)./B(1))
endfunction
function w=normRes(B,x,y)
w=normDis(B,x)-y
endfunction
AI=[1 0.5]
[R,Aopt]=leastsq(list(normRes,year,dataWorldMin),AI)
The “dataWorldMin” variable is a line matrix that stock the GHG emissions in the world for the 31 past years.
The year matrix is the line matrix of each of those yers (1990-2020).
The normDis is the normal distribution function.
The normRes is the residuaal function.
AI is the iniatial values of the parameters, Aopt being the optimal values I want to find. and R is the residual.
Now, the problem:
The Aopt, so the optimal value of the parameters stays the same as the initial value. So whatever it is that I give as AI, it gives me the same thing as Aopt. Which is not normal, especially since the Aopt value is unique and should be the same for everyone, independently of what we use as the inital value (At least that’s what I was taught)
I don’t really know what is causing that anymore, so please, I would be really grateful if anyone of you could enlighten me.
Thanks. And have a good day !