inter-arrival times in exponential distributions
Arrivals occur following a Poisson distribution with a rate parameter of 84 arrivals per hour. Find: the probability that the time to arrival of the next customer is less than one minute.
When calculating the inter-arrival rate, would I have to convert it into minutes as the question is asking for the probability that is is less than an minute but the rate parameter has been given in terms of hours.
If this is the case, would the inter-arrival rate be 1/84 per hour; then converting into minutes would make it 0.714 minutes
See also questions close to this topic
Exponential Probability in Python
Suppose that the average checkout time of a store cashier is 2 minutes. Find the probability of a customer checkout being completed in less than 2 minutes.
I tried scipy.stats... seems i cant get the right parameter or function
How to create a sequence of complex exponential based on the length of list?
For example, if the length of the input is 3, I'd like the output to be e^(3+2+1) + e^(2+1) e^1.
I'm just thinking about it and have a feeling this might be a useful thing to know down the line. If you have an actual application for this I'd like to know what you used it for too.
def pseudo_code(list_ = [9,10,11]: sequence = [e^(3+2+1),e^(2+1),e^1] for i in range(len(list_)): list_[i] / sequence[i]
Fitting Exponential Distribution to Task Duration Counts
In my dataset, I have ants that switch between one state (in this case a resting state) and all other states over a period of time. I am attempting to fit an exponential distribution to the number of times an ant spends in a resting state for some duration of time (for instance, the ant may rest for 5 seconds 10 times, or it could rest for 6 seconds 5 times, etc.). While subjectively this distribution of durations seems to be exponential, I can't fit a single parameter exponential distribution (where the one parameter is rate) to the data. Is this possible to do with my dataset, or do I need to use a two parameter exponential distribution?
I am attempting to fit the data to the following equation (where lambda is rate):
lambda * exp(-lambda * x).
This, however, doesn't seem to be mathematically possible to fit to either the counts of my data or the probability density of my data. In R I attempt to fit the data with the following code:
fit = nls(newdata$x.counts ~ (b*exp(b*newdata$x.mids)), start = list(x.counts = 1, x.mids = 1, b = 1))
When I do this, though, I get the following message:
Error in parse(text= x, keep.source = FALSE): <text>:2:0: unexpected end of input 1: ~ ^
I believe I am getting this because its mathematically impossible to fit this particular equation to my data. Am I correct in this, or is there a way to transform the data or alter the equation so I can make it fit? I can also make it fit with the equation lambda * exp(mu * x) where mu is another free parameter, but my goal is to make this equation as simple as possible, so I would prefer to use the one parameter version.
Here is the data, as I can't seem to find a way to attach it as a csv: https://docs.google.com/spreadsheets/d/1euqdgHfHoDmQKXHrtOLcn5x5o81zY1sr9Kq6NCbisYE/edit?usp=sharing
How to perform Gamma and Poisson Distribution Test in Excel
How do i perform a statistic Test for my Data, in Excel, in order to know whether my data distributed Gamma or Poisson distribution ?
Question about poissrnd, the poisson generator in Matlab
I got a problem when using poissrnd. If n is a series of numbers. In theory the variance of poisson(k×n) should be k times the variance of poisson(n). However, I got k∧2 instead of k. My code is attached. Can anyone point out what is wrong with my understanding and explain why it doesn't work as theory. Please help me, thanks!
Combining Perlin Noise and Poisson Disc Sampling in Python
I am attempting to replicate realistic vegetation placement on a 2d grid. To accomplish this I am using poisson disc sampling(Bridson algorithm) vegetation placement and perlin noise to determine density of vegetation per area.
When I exclude perlin noise and keep a constant minimum distance, I achieve desirable results. However, when I vary the minimum distance via perlin noise, the results do not make sense.
What am I doing incorrectly?
Python 3.4.4. I attempted looking at psuedo-code from here, i've looked around StackOverflow, even here. I also copied the code from [github] (https://github.com/emulbreh/bridson) and altered it slightly.
But I cannot seem to grasp my error.
import subprocess as sp import matplotlib.pyplot as plt import numpy as np from scipy.misc import toimage import noise from Poisson import poisson_disc_samples def generate_perlin_poisson(width, height): # Perlin Noise print('Perlin Noise') shape = (height, width) scale = 100.0 octaves = 6 persistence = 0.5 lacunarity = 2.0 world = np.zeros(shape) for i in range(shape): for j in range(shape): world[i][j] = noise.pnoise2(i / scale, j / scale, octaves=octaves, persistence=persistence, lacunarity=lacunarity, repeatx=shape, repeaty=shape, base=0) toimage(world).show() min_rad = 1 max_rad = 5 z = np.interp(world, (np.amin(world), np.amax(world)), (min_rad, max_rad)) # # Notepad PrintOut # fileName = 'perlin_world.txt' # programName = "notepad.exe" # with open(fileName, 'w') as f: # for row in range(z.shape): # # print(row, z[row]) # f.write(str(z[row].tolist()) + '\n') # # sp.Popen([programName, fileName]) # Bridson Poisson Disc Sampling print('Bridson Poisson Disc Sampling') plt.scatter(*zip(*poisson_disc_samples(width=height, height=width, r_max=max_rad, r_min=min_rad, r_array=z)), c='g', alpha=0.6, lw=0) plt.show() print('Completed.') if __name__ == '__main__': width, height = 256, 256 generate_perlin_poisson(width, height)
from random import random from math import cos, sin, floor, sqrt, pi, ceil def euclidean_distance(a, b): dx = a - b dy = a - b return sqrt(dx * dx + dy * dy) def poisson_disc_samples(width, height, r_max, r_min, k=3, r_array=, distance=euclidean_distance, random=random): tau = 2 * pi cellsize = r_max / sqrt(2) grid_width = int(ceil(width / cellsize)) grid_height = int(ceil(height / cellsize)) grid = [None] * (grid_width * grid_height) def grid_coords(p): return int(floor(p / cellsize)), int(floor(p / cellsize)) def fits(p, gx, gy, r): yrange = list(range(max(gy - 2, 0), min(gy + 3, grid_height))) for x in range(max(gx - 2, 0), min(gx + 3, grid_width)): for y in yrange: g = grid[x + y * grid_width] if g is None: continue r = r_array[int(floor(g))][int(floor(g))] if distance(p, g) <= r: # too close return False return True p = width * random(), height * random() queue = [p] grid_x, grid_y = grid_coords(p) grid[grid_x + grid_y * grid_width] = p z_max = width * height * 8 z = 0 while queue: qindex = int(random() * len(queue)) # select random point from queue qx, qy = queue.pop(qindex) r = r_array[int(floor(qx))][int(floor(qy))] # print('min_dist:', r) z += 1 if z > z_max: print('max iteration exceeded') break for _ in range(k): alpha = tau * random() d = r * sqrt(3 * random() + 1) px = qx + d * cos(alpha) py = qy + d * sin(alpha) if not (0 <= px < width and 0 <= py < height): continue p = (px, py) grid_x, grid_y = grid_coords(p) if not fits(p, grid_x, grid_y, r): continue queue.append(p) grid[grid_x + grid_y * grid_width] = p return [p for p in grid if p is not None]
I expected results like , where I can almost visualize the perlin noise map. Btw this is from the 1st link up above.
But I get outputs like . The gray scale map is the associated generated perlin noise.
I am aware there are more efficient ways of doing things. I plan to stick to Python however.
EDIT: I apologize, I cannot get the images to show, there are on imgur. The links from the images do work however.