interarrival 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 interarrival 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 interarrival rate be 1/84 per hour; then converting into minutes would make it 0.714 minutes
See also questions close to this topic

Incorrect exp(x^2) plot
I have the following anonymous function :
f = @(x) exp(x^2);
If I evaluate some values the function seems to work fine :
>>>f(1) ans = 2.7183 >>>f(2) ans = 54.5982 >>>f(0) ans = 1
The problem comes when I plot f, with :
>>>fplot(f,[20 20])
I get this.
Anyone has an idea of what is going wrong?

Building quantile of exponential distribution in R
I'm calculating server downtime average for a lot of applications and i need to build four quantiles based on exponential distribution.
As i'm not really common with math statistic and R (only base knowledge) i have some troubles with code interpretation which should solve my proublem I have 472 rows (pair "DowntimeServer Group"), 2 columns: 1) Downtime in minutes allowed for a group of servers; 2) Number of servers in a group. Also i have a formula for exponential distribution and quantile.
For distribution:
dpexp(x, rate=1, t=0, log = FALSE) ppexp(q, rate=1, t=0, lower.tail = TRUE, log.p = FALSE) qpexp(p, rate=1, t=0, lower.tail = TRUE, log.p = FALSE) rpexp(n, rate=1, t=0)
For quantile:
eqexp(x, p = 0.5, method = "mle/mme", digits = 0)
Expected result is a graph which is splitted for four quantiles based on exponential distribution. Unfortunately i have no actual result as i don't understand how to interpretate my inputs (row number and columns) into a code. I know this sounds like "do this exercise for me" but i have no other options (i've googled it but gain no obvious solution). Thanks!

How to implement PEWMA in python?
I'm both new to programming and python but I'm slowly learning. At the moment I'm playing around a bit with a temperature dataset and I'm trying to understand basic machine learning. It was fairly simple at first when doing linear regression or something like neighbors classifier. Once I started looking into PEWMA, Probabilistic Exponential Weighted Moving Average, i feel stuck.
I feel like the core principle of what I'm trying to accomplish is:
* Have a defined function for alpha calculation
* Declare variables
* Read in dataset (this is done using pandas and I read the data from an excel file)
Since I have temperatures from several different rooms, I split the dataset. 1 numpy array(X) containing 6 columns of data and 1 numpy array(y) containing 1 column of data. y being the column that i want to test on later on. When doing other models it was quite easy and in the form of:
x_train, x_test, y_train, y_test = sklearn.model_selection.train_test_split(X, y, test_size=0.2, shuffle=False)
Once i had the data split, i simply:
numberOfNeighbours = 11 model = KNeighborsClassifier(numberOfNeighbours) model.fit(x_train, encoded_ytrain)
By using model.score(y_test) i could easily get a score of that showed the effectiveness of the model. Same goes for linear regression, however, not for PEWMA.
I did try my hands on pandas ewm function which I called upon using
df.ewm(com=0.8).mean()
but it's not really what I wanted to achieve. I want to use the data in hopes of it learning and reacting to temperature and detecting anomalies. Training and testing the model is the 4th step that i want to write.Reading in from the excel file:
fullDataTemp = pd.read_excel('tempData.xlsx') fullDataTemp = fullDataTemp[["TempLR","TempK", "TempNW", "TempSW", "TempW", "TempTV", "TempO"]] # data_cols in lambda function predictThisTemp = "TempK" print(predictThisTemp + " Chosen for prediction") X = np.array(fullDataTemp.drop([predictThisTemp], 1)) y = np.array(fullDataTemp[predictThisTemp])
My alpha calculation function:
def calc_alpha(newPewma, t, T, col, beta, alpha_calc): if t < T: alpha = 11.0/t print("EWMA calc in progress (initialization of MA)  " + col) else: alpha = (1  beta*newPewma[col])*alpha_calc print("EWMA calc in progress  " + col) return alpha
These 2 lines is for calculating the PEWMA with a dynamic alpha:
alpha =calc_alpha(y, t, T, predictThisTemp, beta, alpha_0 newPewma = beta*newPewma + (1beta)*alpha_0
This is where i get confused, as far as all documentation that I've read and even using the ewm function of pandas, you never specify which data is for training nor which is for testing. Is it even possible for me to use all columns of data to train the PEWMA model or am I mistaken?

Modelling count data with timeseries structure and predictors
I am doing an analysis of salesdata over a period of time (i.e. over a few years). Those salesdata are also dependent on some predictive variables (i.e. holiday, weekend, weather,...). The daily count has a range of 0 to 10.000 and some zerovalues. The problem I am confronted with the choice of a suitable predictive model, that includes the timestructure and the presence of zero values.
I have tried at first a poisson model. The resulting problem was a large overdispersion. To handle the overdispersion I did a QuasiPoisson and NegativeBinomialModel. But here I have the problem of the timeseries structure and the poorpredication of zeros (in general the models have a poor predictionpower). For that reason I considered a zeroinflated PoissonModel (to handle the zeros). Nevertheless the model choice is very poor (so the predictions).
I hope that someone has a idea of a suitable model choice for my modelling problem (and how to handle the tsstructure). The actual results of the models I did, don´t suffice the data.

How to add a Poisson distribution curve that approaches 3?
I want to add a curve to an existing plot. This curve should be a poisson distribution curve that approaches the mean 3.
I've tried this code points is a vector with 1000 values
plot(c(1:1000), points,type="l") abline(h=3) x = 0:1000 curve(dnorm(x, 3, sqrt(3)), lwd=2, col="red", add=TRUE)
I am getting a plot, but without any curve. I would like to see a curve that approaches 3.

Poisson Regression in R with individual fixedeffects and month/year fixedeffects
I'd like to use a fixedeffect Poisson Regression model to examine whether opting into 2 different schemes (specified as dummies in my model) can lead to increased exercise.
I have longitudinal data, over a timespan of 3 years (data measured on a monthly basis), with N=100,000+ (each ID having varying amounts of observations/months tracked). IDs can opt into the two different schemes at any point, they can opt into one only (Scheme 1) or into neither, or into both either simultaneously or at different points in time (Scheme 1 and then Scheme 2).I'd like to include individual fixedeffects (using withinindividual variations in the opting into the two different schemes).
I also want to include month/year fixedeffects to control for time trends/seasonality in exercise patterns. I am thinking of using a set of dummy variables for each specific month in a given year for this.I'd like to specify my model as the following:
y(i,my) = Λ(i) + γ(my) + βScheme1(i,my) + βScheme2(i,my) + ε(i,my)
So y(i,my) refers to the dependent variable level of exercise performed by ID i at month m in year y.
Λ(i) is the individualspecific fixedeffect.
γ(my) is the time fixedeffect.
Scheme 1 and Scheme 2 respectively take the value 1 if the ENT i has opted into the scheme at and after month m.
FYI: Really sorry, I've had to put what each variable is defined with respect to in parenthesis in the equation above
Below is what I initially ran using the
glm()
function just including Schemes 1 and 2 as dependent variables and that worked fine.PoissonModel < glm(DepVar ~ Scheme1 + Scheme2, family = poisson, data = dataset)
My issue is I am unsure how to write the code/what to do in order to include the Λ(i) and γ(my) in my regression too. Any help would be appreciated, thank you!