English 中文(简体)
R:如何使人口获得价值(用于获得x<2>)?
原标题:R: How to get the p-value (for getting x < 2) for a population (modeled by a combination of three normal distributions)?

由于对我前一个职位作出了令人 wonder的回答,我使用了下文链接中规定的程序,使我的数据与三个正常分布相适应:

https://stats.stackchange.com/questions/10062/ ,-r- Pack-to-use-to-calculate-component-parailes-for-a-mixture-model>https://stats.stack Exchange.com/questions/10062/ -r- Package-to-use-to-calculate-component-parailes-for-a-mixture-model

在符合我的数据之后,三个正常分发的参数如下:

      pi      mu sigma
1 0.5552 -0.4868 2.044
2 0.2739  8.3846 1.399
3 0.1709 12.5317 1.036

为了检查我的数据(x)和模型分发(ee)之间的协议,我采取了以下步骤:

e1 <- rnorm(5552, mean=-0.4868, sd=2.044)
e2 <- rnorm(2739, mean=8.3846, sd=1.399)
e3 <- rnorm(1709, mean=12.5317, sd=1.036)
ee <- c(e1,e2,e3)
qqplot(x, ee)

I got the qqplot as follows: (https://i.stack.imgur.com/3favy.png

看来不是坏的,因此,我想计算这一模式人口获得价值等于或低于2.0的数值。 你们能否想教我如何利用R来计算这一价值?

示范人口的密度图见本文(

问题回答

我认为,你只是想用类似东西计算尾矿的概率。

> sum(ee <= 2) / length(ee)
> [1] 0.4936

您的参数载于数据框架,param(而且可能的话,这将与单列的矩阵相配合)。

个人对“2线”的贡献:

> probs <- with(param, pi*pnorm(2, mu, sigma) )
> probs
[1] 4.930888e-01 6.883473e-07 2.409615e-25

总数:

> prob <- with(param, sum(pi*pnorm(2, mu, sigma)) )
> prob
[1] 0.4930895

仅仅看,你会猜测,几乎所有捐款都将来自第一部分,因为另两个捐款的冲动手段远不错。 第一笔捐款的价值主要以(批量)估计数为主,因为其大部分数额是“2英尺”。





相关问题
Generating N numbers that sum to 1

Given an array of size n I want to generate random probabilities for each index such that Sigma(a[0]..a[n-1])=1 One possible result might be: 0 1 2 3 4 0.15 0.2 0.18 0.22 0.25 ...

为什么我随意 du弄。 粉碎吗?

10个帐篷的清单有10个。 可能的命令或变更。 为什么是任意的。 只剩下5 000个工件后,便可复制件?

Estimating/forecasting download completion time

We ve all poked fun at the X minutes remaining dialog which seems to be too simplistic, but how can we improve it? Effectively, the input is the set of download speeds up to the current time, and ...

probability of deck of cards [closed]

for(i=1;i<=n;i++) { pick a random index j between 1 and n inclusive; swap card[i] and card[j]; } for the above code am trying to find the probability of original card[k] winding up in slot ...

Nth Combination

Is there a direct way of getting the Nth combination of an ordered set of all combinations of nCr? Example: I have four elements: [6, 4, 2, 1]. All the possible combinations by taking three at a time ...

热门标签