10

Your question seems to miss some points in What topics can I ask about here?. This answer is for helping you to write the code by yourself and if you encounter any problem, feel free to post another question. In Mathematica use: (* comment *) syntax for commenting your code LowerTriangularize function for accessing the lower triangular part of a matrix ...


7

Your integral has a closed form solution, so take that and give it a name: g[x_] := 1/3 E^(-x/2) Sqrt[2/\[Pi]] Sqrt[x] (3 + x) + Erfc[Sqrt[x]/Sqrt[2]] One way to find the value of x where g[x]==0.05 is to solve: Minimize[Abs[(g[x] - 0.05)^2] && x \[Element] Reals, x] {2.92244*10^-18, {x -> 11.0705}}


6

Clear["Global`*"] Your integral is the complement of the CDF for a GammaDistribution. dist = GammaDistribution[5/2, 2]; pdf[x_] = PDF[dist, x] (* Piecewise[{{x^(3/2)/(E^(x/2)*(3*Sqrt[2*Pi])), x > 0}}, 0] *) The integral is int[x_] = Assuming[x > 0, 1 - CDF[dist, x] // Simplify] (* 1 - GammaRegularized[5/2, 0, x/2] *) While ...


5

dist = TransformedDistribution[x^2, x \[Distributed] NormalDistribution[0, 1]] (* ChiSquareDistribution[1] *) CDF[dist, x] PDF[dist, x] Plot[{CDF[dist, x], PDF[dist, x]}, {x, 0, 5}, PlotRange -> {0, 1.1}, PlotLegends -> Placed["Expressions", {0.7, 0.5}]] EDIT: Alternatively, cdf[x_] = Probability[y^2 <= x, y \[Distributed] ...


3

(* English words, lowercase, length > 2 *) words = ToLowerCase@Select[WordList[], StringLength[#] > 2 &]; (* Get first two chars, throw out any pairs containing non-letters/punctuation *) pairs = Select[Characters[words][[All, ;; 2]], AllTrue[#, LetterQ] &]; (* Probability function *) countProbs[list_] := Map[#/Length[list] &, Counts[list]...


3

Here is a pedestrian way to achieve the same that also works with older MMA: We first define the normalized ProbabilityDistribution of the radius:p r0 = 1; pdf[x_] = Exp[-x^2/2]/Integrate[ Exp[-y^2/2], {y, 0, r0}] p = ProbabilityDistribution[pdf[x], {x, 0, r0}]; With this distribution we can create r-values: r. The angle is uniformly distributed, what we ...


3

Assuming you're using the new spatial statistics from v12.2: {x0, y0} = {1.5, 2}; σ = .7; R = 3.0; reg = Disk[{x0, y0}, R]; pts = RandomPointConfiguration[ InhomogeneousPoissonPointProcess[ Function[10000*Exp[-((#1 - x0)^2 + (#2 - y0)^2)/(2*σ)]], 2], reg]; Show[RegionPlot[reg], ListPlot[pts]]


2

If the "integer data" consists of counts that might be expected to follow a Poisson distribution given the predictor value, then a Poisson regression should be considered. That can be accomplished using GeneralizedLinearModelFit. glm = GeneralizedLinearModelFit[dataHist5, t, t, ExponentialFamily -> "Poisson"] Show[ListPlot[dataHist5], ...


2

(* Get the weekly closing prices *) dataweekly = FinancialData["^SPX", "Close", {{2010, 7, 1}, Today, "Week"}]; (* 6 week rolling weekly return *) rolling = MovingMap[100*(Last[#]/First[#] - 1) &, dataweekly, {6, "Week"}]; DateListPlot[rolling]


2

Not certain what your really want to do, but maybe the following will spark some ideas. Manipulate[ Module[{dw, dpw}, dw = dataweekly[[All, 4]]; dpw = datapercweekly; Grid[{ {ListLinePlot[dw, ImageSize -> 350], ListLinePlot[dpw, ImageSize -> 350]}, {ListLinePlot[MovingAverage[dw, n], ImageSize -> 350], ListLinePlot[...


2

dist = EmpiricalDistribution[ tableOfRandomVariable[[All, 2]] -> tableOfRandomVariable[[All, 1]]]; DiscretePlot[CDF[dist, x], {x, 0, 14}, ExtentSize -> Right, ExtentMarkers -> {"Filled", "Empty"}]


2

I think this may be what you were looking for originally: dist = TransformedDistribution[ x^2 + y^2 + (1 - x - y)^2, {x, y} \[Distributed] DirichletDistribution[{1, 1, 1}] ] where $x+y+\underbrace{(1-x-y)}_{z}= 1$. You can then get the mean and variance (for example) Mean[dist] --> 1/2 Variance[dist] --> 1/60 You can confirm these ...


2

σ = 9; L[s_, d_] = (1/(σ*Sqrt[2*π]))* E^(-(1/2)*((s - (-50 - 11*Log[d]))/σ)^2); The probability distribution is dist[s_] = ProbabilityDistribution[L[s, d], {d, 0, Infinity}, Method -> "Normalize"]; r[s, d] is the PDF of the distribution r[s_, d_] = PDF[dist[s], d] Verifying the normalization, Integrate[r[s, d], {d, 0, Infinity}] (* ...


1

If the $d$ takes on values from 0 to $\infty$, then the normalizing constant is given by Integrate[L[s, d], {d, 0, ∞}] (* 1/11 E^(-(1019/242) - s/11) *) So you could define the following function which is non-negative and integrates to 1 for a pdf associated with $d$: r[s_, d_] := L[s, d]/(1/11 E^(-(1019/242) - s/11)) You should avoid using capital letters ...


1

data = (SeedRandom[1234]; RandomVariate[ NormalDistribution[2, 1/2], 20]) (* {1.74583, 1.9647, 1.20305, 2.7683, 3.33901, 1.34158, 1.45272, 2.07147, \ 2.05208, 1.16345, 2.01788, 2.08509, 2.46734, 1.58657, 1.95452, 2.5167, \ 1.81824, 2.0943, 1.93193, 1.95803} *) dist = NormalDistribution[m, s]; param = FindDistributionParameters[data, dist] (* {m -> ...


1

Clear["Global`*"] k[h_, x_] = PDF[NormalDistribution[0, h], x] (* E^(-(x^2/(2 h^2)))/(h Sqrt[2 π]) *) Assuming that the first part takes the argument x - y rather than being distributed across x - y t[x_, y_] = ((k[h, #]*k[g, #] - k[g, #])^2) &[x - y] // Simplify (* (E^(-(((g^2 + h^2) (x - y)^2)/( g^2 h^2))) (-1 + E^((x - y)^2/(2 h^2))...


Only top voted, non community-wiki answers of a minimum length are eligible