cdf

Determine waiting times between plane arrivals python

谁说我不能喝 提交于 2021-02-11 14:46:21
问题 I'm writing a program, that takes 200 planes distributed with the poisson distribution over 12 hours and these planes need to land at an airfield that only has 1 runway. I use the reverse CDF method from the exponential distribution to determine the inter-arrival times. However, I can't seem to calculate the waiting time in the air. E.g. a plane arrives at 100 seconds, takes 75 seconds to land and is done at 175 seconds. Plane 2 arrives at 150 seconds and must wait 175-150 = 25 seconds. How

how to plot non-standard contour plots in R (or Matlab)

那年仲夏 提交于 2020-01-16 08:47:09
问题 I would like to plot in R following contour plots representing two dimensional cumulative distributon functions (CDF) A CDF in 2 or more dimensions is not unique (Lopes et al. The two-dimensional Kolmogorov-Smirnov test) that's why there are 4 alternative plots (and probably some more). So far I have no R/Matlab code to show. I don't think it's difficult but most likely very time consuming. There might out there something I could use. EDIT Type 1 & 4 are more or less covered, but any help

R ggplot: Weighted CDF

戏子无情 提交于 2020-01-03 18:46:08
问题 I'd like to plot a weighted CDF using ggplot . Some old non-SO discussions (e.g. this from 2012) suggest this is not possible, but thought I'd reraise. For example, consider this data: df <- data.frame(x=sort(runif(100)), w=1:100) I can show an unweighted CDF with ggplot(df, aes(x)) + stat_ecdf() How would I weight this by w ? For this example, I'd expect an x^2 -looking function, since the larger numbers have higher weight. 回答1: You can calculate the cumulative distribution within the data

Use inverse CDF to generate random variable in R

别等时光非礼了梦想. 提交于 2020-01-03 06:30:35
问题 First, I have no idea wether the professor gave the wrong question. Anyway, I tried to generate F(x)~U(0,1) , where CDF F(x)=1-(1+x)exp(-x) (For this CDF, you could not calculate x=g(F(x)) by hand). And then calculate the root of F(x) to achieve what the question want. Because the root range from 0 to INF , uniroot() is out of question. Therefore, I use Newton Method to write one. Then, my code is like this: f=function(x) { ifelse(x>=0,x*exp(-x),0) } in.C=function(n) { a=runif(n) G=NULL for(i

Scipy Weibull CDF calculation

戏子无情 提交于 2020-01-01 06:57:06
问题 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. 回答1: You haven't correctly mapped your parameters to those of scipy. To

r : ecdf over histogram

元气小坏坏 提交于 2020-01-01 06:43:47
问题 in R, with ecdf I can plot a empirical cumulative distribution function plot(ecdf(mydata)) and with hist I can plot a histogram of my data hist(mydata) How I can plot the histogram and the ecdf in the same plot? EDIT I try make something like that https://mathematica.stackexchange.com/questions/18723/how-do-i-overlay-a-histogram-with-a-plot-of-cdf 回答1: Also a bit late, here's another solution that extends @Christoph 's Solution with a second y-Axis. par(mar = c(5,5,2,5)) set.seed(15) dt <-

批量整理MMS数据

半腔热情 提交于 2019-12-24 03:17:00
1. 程序说明   对大量MMS数据文件,根据文件名,将其移动到相应的文件夹内。 2. 程序算法   MMS数据文件名格式如下 不同的字段之间使用下划线"_"分隔。遍历指定目录下的所有cdf文件,对每一个文件的文件名通过下划线分离出所有字段,并检测每一个字段所对应的目录是否存在,若不存在,则建立相应的文件夹,并将文件移入相应的文件夹中。对于日期,需要分别建立与年和月相对应的目录。   程序使用PowerShell实现。 3. 程序代码 # organize mms data # writen by Liangjin Song on 20191220 # the directory where the mms data is saved $mmsdir = "D:\test" ######################################## begin ########################################## # get the current position $currentdir = Split-Path - Parent $MyInvocation . MyCommand . Definition cd $mmsdir # list all of the cdf files Get-ChildItem . \ | ForEach

Errors running Maximum Likelihood Estimation on a three parameter Weibull cdf

一曲冷凌霜 提交于 2019-12-22 14:57:12
问题 I am working with the cumulative emergence of flies over time (taken at irregular intervals) over many summers (though first I am just trying to make one year work). The cumulative emergence follows a sigmoid pattern and I want to create a maximum likelihood estimation of a 3-parameter Weibull cumulative distribution function. The three-parameter models I've been trying to use in the fitdistrplus package keep giving me an error. I think this must have something to do with how my data is