Python-统计分布 [英] Python - Statistical distribution

查看:149
本文介绍了Python-统计分布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对python世界很陌生.另外,我不是统计学家.我需要用计算机科学编程语言来实现数学家开发的数学模型.经过一些研究,我选择了python.我对这样的程序设计(PHP/HTML/javascript)很满意.

I'm quite new to python world. Also, I'm not a statistician. I'm in the need to implementing mathematical models developed by mathematicians in a computer science programming language. I've chosen python after some research. I'm comfortable with programming as such (PHP/HTML/javascript).

我有一列从MySQL数据库中提取的值&需要计算以下内容-

I have a column of values that I've extracted from a MySQL database & in need to calculate the below -

1) Normal distribution of it. (I don't have the sigma & mu values. These need to be calculated too apparently). 
2) Mixture of normal distribution
3) Estimate density of normal distribution
4) Calculate 'Z' score

值数组与下面的值类似(我已填充示例数据)-

The array of values looks similar to the one below ( I've populated sample data)-

d1 = [3,3,3,3,3,3,3,9,12,6,3,3,3,3,9,21,3,12,3,6,3,30,12,6,3,3,24,30,3,3,3]


mu1, std1 = norm.fit(d1)

我知道正态分布可以计算如下-

The normal distribution, I understand could be calculated as below -

import numpy as np
from scipy.stats import norm

mu, std = norm.fit(data)

请问我如何开始(2),(3)&的一些指示. (4)请在这?我一直在网上查询,希望能收到专家的来信.

Could I please get some pointers on how to get started with (2),(3) & (4) in this please? I'm continuing to look up online as I look forward to hear from experts.

如果这个问题没有完全道理,请让我知道缺少什么方面,以便我尝试&获取有关的信息.

If the question doesn't fully make sense, please do let me know what aspect is missing so that I'll try & get information around that.

非常感谢您在这里提供的帮助.

I'd very much appreciate any help here please.

推荐答案

问题的某些部分不清楚.这可能有助于提供您要达到的目标的背景,而不是您要采取的具体步骤.

Some parts of your question are unclear. It might help to give the context of what you're trying to achieve, rather than what are the specific steps you're taking.

1)+ 3)在正态分布中-拟合分布以及估计均值和标准差-基本上是同一件事.均值和标准差完全确定分布.

1) + 3) In a Normal distribution - fitting the distribution, and estimating the mean and standard deviation - are basically the same thing. The mean and standard deviation completely determine the distribution.

mu, std = norm.fit(data)

等于说找到最适合分布的均值和标准差".

is tantamount to saying "find the mean and standard deviation which best fit the distribution".

4)计算Z得分-您必须解释您要尝试做的事情.这通常是指数据点的均值在标准值的上方(或下方)多少.偏差.这是您这里需要的吗?如果是这样,那就很简单

4) Calculating the Z score - you'll have to explain what you're trying to do. This usually means how much above (or below) the mean a data point is, in units of standard deviation. Is this what you need here? If so, then it is simply

(np.array(data) - mu) / std

2)正态分布的混合-完全不清楚.通常,这意味着该分布实际上是由多个正态分布生成的.这是什么意思?

2) Mixture of normal distribution - this is completely unclear. It usually means that the distribution is actually generated by more than a single Normal distribution. What do you mean by this?

这篇关于Python-统计分布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆