cdf

How to random sample lognormal data in Python using the inverse CDF and specify target percentiles?

南楼画角 提交于 2019-12-06 03:35:00
I'm trying to generate random samples from a lognormal distribution in Python, the application is for simulating network traffic. I'd like to generate samples such that: The modal sample result is 320 (~10^2.5) 80% of the samples lie within the range 100 to 1000 (10^2 to 10^3) My strategy is to use the inverse CDF (or Smirnov transform I believe): Use the PDF for a normal distribution centred around 2.5 to calculate the PDF for 10^x where x ~ N(2.5,sigma). Calculate the CDF for the above distribution. Generate random uniform data along the interval 0 to 1. Use the inverse CDF to transform the

Vectorizing the multivariate normal CDF (cumulative density function) in Python

淺唱寂寞╮ 提交于 2019-12-06 02:31:23
问题 How can I vectorize the multivariate normal CDF (cumulative density function) in Python? When looking at this post, I found out that there is a Fortran implementation of the multivariate CDF that was "ported" over to Python. This means I can easily evaluate the CDF for one specific case. However, I'm having a lot of trouble efficiently applying this function to multiple entries. Specifically speaking, the function I need to "vectorize" takes 4 arguments: the lower bounds of integration(vector

Getting data out of CDF-player

百般思念 提交于 2019-12-06 00:20:51
问题 For my Skeptics working group I wrote a program in Mathematica to test a dowser's ability to assess the status of persons shown to them by means of photographs. For a null measurement I distributed this document to my group's members in CDF form (the new v8 Computable Document Format, meant to be run with the CDF-player). On my computer (using mma) it all works fine, but the others can't export the data (the program does an export to an Excel file). On reading the fine print I see that the

ggplot: adjusting alpha/fill two factors cdf

混江龙づ霸主 提交于 2019-12-05 09:47:27
I'm having some issues getting my ggplot alpha to be sufficiently dark for my plot. Example code: ggplot(mtcars, aes(x=mpg, color=factor(gear), alpha=factor(carb))) + stat_ecdf() As you can see, whenever carb == 1 , it's very difficult to see the plot elements. In my real world data set, the factor for color has four levels and the alpha factor has two levels. I was hoping to have the alpha a slightly lighter shade of the color, but more visible than how it's occurring in that example). You can adjust the alpha scale, as the user in the comment suggests, either by specifying a range or a

Plot density and cumulative density function in one combined plot using ggplot2

試著忘記壹切 提交于 2019-12-05 07:00:35
问题 I would like to get a plot that combines the density of observations and the cdf. The usual problem with that is that the scales of the two are way off. How can this be remedied, i.e., two scales be used or, alternatively, one of the data series be rescaled (preferably within ggplot, as I would like to separate computation and display of data). Here's the code so far: >dput(tmp) yields structure(list(drivenkm = c(8, 11, 21, 4, 594, 179, 19, 7, 10, 36)), .Names = "drivenkm", class = c("data

Vectorizing the multivariate normal CDF (cumulative density function) in Python

≯℡__Kan透↙ 提交于 2019-12-04 08:29:19
How can I vectorize the multivariate normal CDF (cumulative density function) in Python? When looking at this post, I found out that there is a Fortran implementation of the multivariate CDF that was "ported" over to Python. This means I can easily evaluate the CDF for one specific case. However, I'm having a lot of trouble efficiently applying this function to multiple entries. Specifically speaking, the function I need to "vectorize" takes 4 arguments: the lower bounds of integration(vector) the upper bounds of integration (vector) the means of the normal random variables (vector) the

Getting data out of CDF-player

一个人想着一个人 提交于 2019-12-04 05:43:00
For my Skeptics working group I wrote a program in Mathematica to test a dowser's ability to assess the status of persons shown to them by means of photographs. For a null measurement I distributed this document to my group's members in CDF form (the new v8 Computable Document Format, meant to be run with the CDF-player ). On my computer (using mma) it all works fine, but the others can't export the data (the program does an export to an Excel file). On reading the fine print I see that the player doesn't support Export. So my question is: Is there any way to get data out of CDF-player? For

Plot density and cumulative density function in one combined plot using ggplot2

不羁岁月 提交于 2019-12-03 21:46:02
I would like to get a plot that combines the density of observations and the cdf. The usual problem with that is that the scales of the two are way off. How can this be remedied, i.e., two scales be used or, alternatively, one of the data series be rescaled (preferably within ggplot, as I would like to separate computation and display of data). Here's the code so far: >dput(tmp) yields structure(list(drivenkm = c(8, 11, 21, 4, 594, 179, 19, 7, 10, 36)), .Names = "drivenkm", class = c("data.table", "data.frame" ), row.names = c(NA, -10L), .internal.selfref = <pointer: 0x223cb78>) then I do p =

Scipy Weibull CDF calculation

此生再无相见时 提交于 2019-12-03 21:43:26
I'm doing survival calculations in Scipy and can't get the correct values. My code: x, a, c = 1000, 1.5, 5000 vals = exponweib.cdf(x,a,c,loc=0,scale=1) Val should equal 0.085559356392783004, but I'm getting 0 instead. If I define my own function I get the right answer: def weibCumDist(x,a,c): return 1-np.exp(-(x/c)**a) I could just use my own function, but I'm curious as to what I'm doing wrong. Any suggestions? Thanks. You haven't correctly mapped your parameters to those of scipy. To implement the equivalent of your weibCumDist : In [22]: x = 1000 In [23]: a = 1.5 In [24]: c = 5000 In [25]:

Plotting CDF of a pandas series in python

二次信任 提交于 2019-12-03 18:32:28
问题 Is there a way to do this? I cannot seem an easy way to interface pandas series with plotting a CDF. 回答1: I believe the functionality you're looking for is in the hist method of a Series object which wraps the hist() function in matplotlib Here's the relevant documentation In [10]: import matplotlib.pyplot as plt In [11]: plt.hist? ... Plot a histogram. Compute and draw the histogram of *x*. The return value is a tuple (*n*, *bins*, *patches*) or ([*n0*, *n1*, ...], *bins*, [*patches0*,