randomness – Sampling from specific random distribution on sets

I have a random distribution on sets in mind, that has three parameters: $n, w, k$. The goal is to sample sets of $k$ integers from $(0, n)$ (without replacement) such that the elements within each set fit in a subrange of length $w$. That is, an outcome set $S$ must have properties:

  1. $S subset mathbb{N_0} ; wedge; |S| = k$
  2. $0leq min(S) leq max(S) < n$
  3. $max(S) – min(S) < w$

You can assume that $k leq w/2 < w ll n$.

Now there are many possible distributions possible over these sets. But I’m interested in those that have as property

$$forall x:P(x in S) = frac{k}{n};,$$

that is each integer in $(0, n)$ has an equal chance of being in a set when sampled (or as close as possible). Beyond the above requirements, it’d be ideal if the distribution is an maximum entropy one, but this isn’t as important, and something close would be fine too. As a minimum bar I do think every valid set should have a non-zero chance of occurring.

Is there a practical way of sampling from a random distribution that matches the above requirements?

I’ve tried various methods, rejection sampling, first picking the smallest/largest elements, but so far everything has been really biased. The only method that works that I can think of is explicitly listing all valid sets $S_i$, assigning a probability variable $p_i$ to each, and solving the linear system $$sum_i p_i = 1 quadbigwedgequad forall_x:frac{k}{n} – delta leq sum_{x in S_i} p_i leq frac{k}{n} + delta,$$ minimizing $delta$ first, $epsilon $ second where $epsilon = max_i p_i – min_i p_i$. However this is very much a ‘brute force’ approach, and is not feasible for larger $n, k, w$.

pr.probability – Weak convergence to a “multi-Bernoulli” distribution

Let $(X_n)_{ngeq 1}$ be a sequence of random variables defined on the $d-$simplex ($dgeq 1$) : $Sigma_d=biglbraceboldsymbol{x}inmathbb{R}_+^d,,sum_{1leq ileq n} x_i=1bigrbrace$. Assuming that there exists $alphainSigma_d$ such that for $ngeq 1$, $mathbb{E}(X_n)=alpha$, and that the sequence of covariance matrices $text{Cov}(X_n)$ converges to the matrix with coefficients $M_{ij}=alpha_i(delta_{ij}-alpha_j)$ ($i,jin (n)$ and $delta_{ij}$ is the Kronecker symbol), does the following weak convergence holds: $$limlimits_{nrightarrowinfty},mathbb{P}_{X_n}longrightarrow sumlimits_{1leq ileq n} alpha_i delta_{e_i},$$
where $(e_i)_{1leq ileq n}$ is the canonical base of $mathbb{R}^n$, and $delta_{x}$ the Dirac measure for $xinmathbb{R}^d$?

The specific case for which every $X_n$ follow a Dirichlet law was solved: Weak convergence of Dirichlet distributions to a “multi-Bernoulli” distribution .

node.js – Cloudfront distribution having multiple domains

I am developing a multi-tenant project that will be a kind of micro “ecommerce” and therefore customers will be able to create their own stores and will be able to choose between creating a subdomain or using their own domain. This whole process needs to be “whitelabel”. I will only use AWS. It will be a kind of shopify.

The project will have an application made in wordpress that will be a landing page to talk about the base product.

The project will have several micro apis exposed on separate endpoints but which will be consumed by the graphql federation (a kind of BFF) and therefore there will only be a single accessible endpoint for react-apps to consume.

In addition to the api, I need to create some react-apps (I will use the concept of micro frontends) and therefore I will need:

  • 1 application for the seller to create an account, create and list their stores
  • 1 application for the seller to manage a specific store
  • 1 application for the seller to sell the products and show the catalog
  • 1 application for administrators to approve stores and do other things

The big challenge is to manage the routes and save the routing and so I thought about the following:

example.com -> wordpress landing page
example.com/seller -> the seller can create an account and see the listing of their stores

store.example.com or customdomain.com -> store that shows a seller’s products
store.example.com/backoffice or customdomain.com/backoffice -> customized subdomain for the seller to manage a specific store

Since I need the domains / subdomains to be customized to be whitelabel, I also need the api to be accessible at example.com/graphql or store.example.com/graphql or customdomain.com/graphql

I would like to know how can I do this using AWS? After some investigation I noticed that the cloudfront can do this and also use route53 to point the domains / subdomains for distribution on the cloudfront, but to be honest, I need some advice.

Thank you very much

What is the moment generating function of this distribution?

Can anyone show me how to compute this MGF? I am reviewing for an exam, and the professor put an answer for the MGF of the following distribution, but did not show his work, so I have no clue how he get the answer.

$P(x_1, x_2) = 6 * (frac{1}{3})^{x_1} * (frac{1}{4})^{x_2}, 1 leq x_1,x_2 < inf, 0$ elsewhere

$x_1 , x_2 in mathbb{Z}^{+}$

Can someone please show me how to compute the joint MGF of this distribution? Thank you for reading.

linear algebra – Sampling distribution for approximating a function on set of vectors

I have a set of vectors $X = {x_1, dots, x_n}$ and a vector $y = f(X)$. These vectors are not orthogonal to each other. For simplicity, we can also say that $f()$ is just the mean.

Now, I would like to compute values for a discrete distribution $W={w_1, dots, w_n}$ over the elements of X, such that by sampling $m < n$ elements from X according to this distribution, I will get that $f(X_m) approx f(X)$.

Any kind of reference and pointer will be appreciated.

Input a frequency distribution with unequal class widths and estimate the mean and median

The websites I have visited and the texts available to me determine the mean of an unequal frequency distribution using

mean = Sum(class marks x frequency) / Sum(frequency).

This is an example I extracted from the internet:

enter image description here

The author computed the mean wickets as 152.889, which I recoded in Mathematica as

midpts = {40, 80, 125, 200, 300, 400};
freq = {7, 5, 16, 12, 2, 3};   
mean = midpts . freq /Total(freq) // N
median = 100.5 + ((Total(freq)/2 - (7 + 5))/50) 16 

Is it a correct solution? How about the unequal class widths?

Need intuition help with exponential distribution and help solving a problem

This is one of the question asked in my textbook
I am able to solve this using Poisson distribution but can’t solve it using exponential distribution
The distance between major cracks in a highway follows an exponential distribution with a mean of five miles.
(a) What is the probability that there are no major cracks in a
10-mile stretch of the highway?
(b) What is the probability that there are two major cracks in a
10-mile stretch of the highway?

So what I tried is for the first question :

Since the mean 5 miles/per crack so λ=0.2crack/miles

So using this formula 1-e^(-λx)=(cumulative function of exponential distribution)


which was obviously false. The solution used P(X>10) instead of P(X<=10) which I don’t understand since they asked to find the probability IN a 10 miles radius.

For question 2, I’m lost, I don’t understand where im suppose to plug the 2 major cracks. I used Poisson distribution but I was wondering if its possible to solve it using exponential distribution instead.

pr.probability – Weak convergence of Dirichlet distributions to a “multi-Bernouilli” distribution

For a positive vector $alphainmathbb{R}^n$ ($ngeq 1$), denote by $text{Dir}(alpha)$ the Dirichlet distribution with parameter alpha. In terms of weak convergence, is it true that $limlimits_{varepsilonrightarrow 0^+}text{Dir}(varepsilonalpha)longrightarrow sumlimits_{i=1}^n alpha_i delta_{lbrace e_irbrace}$ (where $(e_i)_{1leq ileq n}$ is the canonical base of $mathbb{R}^n$)?