Problems performing a lognormal fitting with Scipy2019 Community Moderator Electionscipy, lognormal distribution - parametersScipy: lognormal fittinguse scipy.stats to automatically fit and use the parameter in pdf calculationA lognormal distribution in pythonLog Normal Random Variables with Scipywhy return np.random.normal(10 - 1. / (x + 0.1), 0.5) worksScaling the fitted PDF of a log-normal distribution to the histrogram in pythonFitting bimodal gaussian distribution with some parameters fixedWrapping function to use different paremetres in pythonFitting data using scipy truncnorm

Why is there an extra space when I type "ls" on the Desktop?

Is "cogitate" an appropriate word for this?

Is every open circuit a capacitor?

Why can't we use freedom of speech and expression to incite people to rebel against government in India?

Why would the IRS ask for birth certificates or even audit a small tax return?

I can't die. Who am I?

How do you make a gun that shoots melee weapons and/or swords?

What does "rhumatis" mean?

Does the in-code argument passing conventions used on PDP-11's have a name?

Did Amazon pay $0 in taxes last year?

Can a Mexican citizen living in US under DACA drive to Canada?

Quitting employee has privileged access to critical information

Are Wave equations equivalent to Maxwell equations in free space?

Can a space-faring robot still function over a billion years?

Short story about an infectious indestructible metal bar?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

Remove object from array based on array of some property of that object

What is the meaning of option 'by' in TikZ Intersections

New invention compresses matter to produce energy? or other items? (Short Story)

Problems with rounding giving too many digits

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

3.5% Interest Student Loan or use all of my savings on Tuition?

Where do you go through passport control when transiting through another Schengen airport on your way out of the Schengen area?

Error in TransformedField



Problems performing a lognormal fitting with Scipy



2019 Community Moderator Electionscipy, lognormal distribution - parametersScipy: lognormal fittinguse scipy.stats to automatically fit and use the parameter in pdf calculationA lognormal distribution in pythonLog Normal Random Variables with Scipywhy return np.random.normal(10 - 1. / (x + 0.1), 0.5) worksScaling the fitted PDF of a log-normal distribution to the histrogram in pythonFitting bimodal gaussian distribution with some parameters fixedWrapping function to use different paremetres in pythonFitting data using scipy truncnorm










1















I have been reading a lot of past question regarding this topic, however I have not managed to find a solution to this problem. When using python scipy.stats.lognormal.fit for a set of data (Y), the output parameters are the shape, loc and scale respectively. The shape it is supposed to be equal to the standard deviation of the normally distributed random variable X such that exp(X)= Y, and the scale equal to the exp(mu), were mu is the mean of the same normally distributed random variable X. I have three sets of data for which I am performing the fitting, however there is particularly one of them giving me trouble, and I have not been able to find the reason. I cannot share the code as the sample is very specific and has a size of 270, so I am reading it directly from a file, but the problem is that I am getting different values of standard deviation= scale and mu= ln(scale) by performing the fitting in two different ways: One fitting directly the data Y by using lognorm.fit, and another one performing the fitting into the normally distributed sample X. I checked with another softwares (Matlab and Excel), and the second option is giving the right results, so my guess is that it is related with the convergence or a particular characteristic of the lognorm.fit, however I have tried several things unsuccesfully, as for example using an optimzer:



#def opti_wrap(fun, x0, args, disp=0, **kwargs):
# return minimize(fun, x0, args=args, method='SLSQP',
# tol=1e-12, options='maxiter': 1000).x


or playing with the loc value when doing the lognorm.fit.



Any ideas what could be the issue?










share|improve this question







New contributor




derekrp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Managed to fix the problem. Apparently the loc parameter is the problem. Depending of the value it gives problems with the fitting process. In order to fix the problem, I fixed it using floc= 0, and now the results are matching the fitting process by using the normalized set of data.

    – derekrp
    yesterday
















1















I have been reading a lot of past question regarding this topic, however I have not managed to find a solution to this problem. When using python scipy.stats.lognormal.fit for a set of data (Y), the output parameters are the shape, loc and scale respectively. The shape it is supposed to be equal to the standard deviation of the normally distributed random variable X such that exp(X)= Y, and the scale equal to the exp(mu), were mu is the mean of the same normally distributed random variable X. I have three sets of data for which I am performing the fitting, however there is particularly one of them giving me trouble, and I have not been able to find the reason. I cannot share the code as the sample is very specific and has a size of 270, so I am reading it directly from a file, but the problem is that I am getting different values of standard deviation= scale and mu= ln(scale) by performing the fitting in two different ways: One fitting directly the data Y by using lognorm.fit, and another one performing the fitting into the normally distributed sample X. I checked with another softwares (Matlab and Excel), and the second option is giving the right results, so my guess is that it is related with the convergence or a particular characteristic of the lognorm.fit, however I have tried several things unsuccesfully, as for example using an optimzer:



#def opti_wrap(fun, x0, args, disp=0, **kwargs):
# return minimize(fun, x0, args=args, method='SLSQP',
# tol=1e-12, options='maxiter': 1000).x


or playing with the loc value when doing the lognorm.fit.



Any ideas what could be the issue?










share|improve this question







New contributor




derekrp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Managed to fix the problem. Apparently the loc parameter is the problem. Depending of the value it gives problems with the fitting process. In order to fix the problem, I fixed it using floc= 0, and now the results are matching the fitting process by using the normalized set of data.

    – derekrp
    yesterday














1












1








1








I have been reading a lot of past question regarding this topic, however I have not managed to find a solution to this problem. When using python scipy.stats.lognormal.fit for a set of data (Y), the output parameters are the shape, loc and scale respectively. The shape it is supposed to be equal to the standard deviation of the normally distributed random variable X such that exp(X)= Y, and the scale equal to the exp(mu), were mu is the mean of the same normally distributed random variable X. I have three sets of data for which I am performing the fitting, however there is particularly one of them giving me trouble, and I have not been able to find the reason. I cannot share the code as the sample is very specific and has a size of 270, so I am reading it directly from a file, but the problem is that I am getting different values of standard deviation= scale and mu= ln(scale) by performing the fitting in two different ways: One fitting directly the data Y by using lognorm.fit, and another one performing the fitting into the normally distributed sample X. I checked with another softwares (Matlab and Excel), and the second option is giving the right results, so my guess is that it is related with the convergence or a particular characteristic of the lognorm.fit, however I have tried several things unsuccesfully, as for example using an optimzer:



#def opti_wrap(fun, x0, args, disp=0, **kwargs):
# return minimize(fun, x0, args=args, method='SLSQP',
# tol=1e-12, options='maxiter': 1000).x


or playing with the loc value when doing the lognorm.fit.



Any ideas what could be the issue?










share|improve this question







New contributor




derekrp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I have been reading a lot of past question regarding this topic, however I have not managed to find a solution to this problem. When using python scipy.stats.lognormal.fit for a set of data (Y), the output parameters are the shape, loc and scale respectively. The shape it is supposed to be equal to the standard deviation of the normally distributed random variable X such that exp(X)= Y, and the scale equal to the exp(mu), were mu is the mean of the same normally distributed random variable X. I have three sets of data for which I am performing the fitting, however there is particularly one of them giving me trouble, and I have not been able to find the reason. I cannot share the code as the sample is very specific and has a size of 270, so I am reading it directly from a file, but the problem is that I am getting different values of standard deviation= scale and mu= ln(scale) by performing the fitting in two different ways: One fitting directly the data Y by using lognorm.fit, and another one performing the fitting into the normally distributed sample X. I checked with another softwares (Matlab and Excel), and the second option is giving the right results, so my guess is that it is related with the convergence or a particular characteristic of the lognorm.fit, however I have tried several things unsuccesfully, as for example using an optimzer:



#def opti_wrap(fun, x0, args, disp=0, **kwargs):
# return minimize(fun, x0, args=args, method='SLSQP',
# tol=1e-12, options='maxiter': 1000).x


or playing with the loc value when doing the lognorm.fit.



Any ideas what could be the issue?







python scipy






share|improve this question







New contributor




derekrp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




derekrp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




derekrp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









derekrpderekrp

61




61




New contributor




derekrp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





derekrp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






derekrp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Managed to fix the problem. Apparently the loc parameter is the problem. Depending of the value it gives problems with the fitting process. In order to fix the problem, I fixed it using floc= 0, and now the results are matching the fitting process by using the normalized set of data.

    – derekrp
    yesterday


















  • Managed to fix the problem. Apparently the loc parameter is the problem. Depending of the value it gives problems with the fitting process. In order to fix the problem, I fixed it using floc= 0, and now the results are matching the fitting process by using the normalized set of data.

    – derekrp
    yesterday

















Managed to fix the problem. Apparently the loc parameter is the problem. Depending of the value it gives problems with the fitting process. In order to fix the problem, I fixed it using floc= 0, and now the results are matching the fitting process by using the normalized set of data.

– derekrp
yesterday






Managed to fix the problem. Apparently the loc parameter is the problem. Depending of the value it gives problems with the fitting process. In order to fix the problem, I fixed it using floc= 0, and now the results are matching the fitting process by using the normalized set of data.

– derekrp
yesterday













0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






derekrp is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55022049%2fproblems-performing-a-lognormal-fitting-with-scipy%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








derekrp is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















derekrp is a new contributor. Be nice, and check out our Code of Conduct.












derekrp is a new contributor. Be nice, and check out our Code of Conduct.











derekrp is a new contributor. Be nice, and check out our Code of Conduct.














Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55022049%2fproblems-performing-a-lognormal-fitting-with-scipy%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved