作者:mobiledu2502886985 | 来源:互联网 | 2023-05-17 11:38
ImnotquitesureifIcanaskthisquestionhereoronSuperUser,我不太确定我能不能问这个问题或者是关于超级用户,Iwant
I'm not quite sure if I can ask this question here or on SuperUser,
我不太确定我能不能问这个问题或者是关于超级用户,
I want to know how can I plot a CDF chart of my output in excel.
我想知道如何用excel绘制输出的CDF图。
my data is something like this (my real data have 22424 records):
我的数据是这样的(我的真实数据有22424条记录):
1 2.39E-05
1 2.39E-05
1 2.39E-05
2 4.77E-05
2 4.77E-05
2 4.77E-05
4 9.55E-05
4 9.55E-05
4 9.55E-05
4 9.55E-05
4 9.55E-05
4 9.55E-05
8 0.000190931
8 0.000190931
3 个解决方案
3
You can use the NORMDIST
function and set the final parameter to true:
可以使用NORMDIST函数将最终参数设置为true:
As an example, suppose I have 20 data points from 0.1 to 2.0 in increments of 0.1 i.e. 0.1, 0.2, 0.3...2.0.
例如,假设我有20个数据点,从0.1到2.0,增量为0.1,即0.1,0.2,0.3…2.0。
Now suppose that the mean of that dataset is 1.0 and the standard deviation is 0.2.
假设数据集的均值是1。0,标准差是0。2。
To get the CDF plot I can use the following formula for each of my values:
为了得到CDF图,我可以对我的每个值使用以下公式:
=NORMDIST(x, 1.0, 0.2, TRUE) -- where x is 0.1, 0.2, 0.3...2.0
To remove duplicate entries from your data and sum values that are the same you can use the following code.
要从您的数据中删除重复的条目,并使用相同的值,您可以使用以下代码。
- In excel, place you data in sheet1, starting in cell A1
- 在excel中,将数据放在sheet1中,从单元格A1开始
- Press
ALT + F11
to open VBE
- 按ALT + F11打开VBE
- Now
Insert > Module
to place a module in the editor
- 现在插入>模块,在编辑器中放置一个模块
- Cut and paste code below into module
- 将下面的代码剪切粘贴到模块中
- Place cursor anywhere in
RemoveDuplicates
and Press F5
to run the code
- 将光标放在removeduplicate文件中的任何位置,按F5运行代码
As a result, your unique, summed results will appear in Sheet2 in your workbook.
因此,您的独特的汇总结果将出现在您的工作簿中的Sheet2中。
Sub RemoveDuplicates()
Dim rng As Range
Set rng = Range("A1:B" & GetLastRow(Range("A1")))
rng.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Worksheets("Sheet2").Range("A1"), Unique:=True
Dim filteredRng As Range
Dim cl As Range
Set filteredRng = Worksheets("Sheet2").Range("A1:A" & GetLastRow(Worksheets("Sheet2").Range("A1")))
For Each cl In filteredRng
cl.Offset(0, 1) = Application.WorksheetFunction.SumIf(rng.Columns(1), cl.Value, rng.Columns(2))
Next cl
End Sub
Function GetLastRow(rng As Range) As Long
GetLastRow = rng.End(xlDown).Row
End Function