6

There is no need for manual compilation. It's possible to write the code in such a way that NMaximize automatically compiles the likelihood function for you. It will also be able to compute the gradient symbolically, which allows for faster convergence and higher precision. h[a1_, l_] = ProbabilityDistribution[ a1 l Exp[-l y0] (1 - Exp[-l y0])^(a1 - 1)...


5

When I have very little experience with a software function, I find it incumbent on me to figure out what I'm probably doing wrong rather than blaming the software function. (I've learned that the hard way.) The model presented with 3 parameters ($c$, $l$, and $r$) to fit is $$-\tan ^{-1}\left(\frac{\frac{1}{2 \pi c f}-2 \pi f l}{r}\right)=-\tan ^{-1}\...


4

Update: Using OP's data: bincenters = istomax900[[All, 1]]; binwidth = First @ Differences[bincenters]; binspecs = {Min[#] - binwidth/2, Max[#] + binwidth/2, binwidth} & @ bincenters; Show[Histogram[WeightedData @@ Transpose[istomax900], binspecs], ListPlot[gaussianamax900, Joined -> True, PlotMarkers -> Automatic]] Original answer: ...


4

fn = RandomChoice[{#3, 1 - #3} -> {RandomSample[#1, #2], {}}] &; Use: fn[list,number_of_samples,probability_of_sample_success] Example: fn[{1, 2, 3, 4, 5, 6}, 3, .3] {2,1,5} fn[{1, 2, 3, 4, 5, 6}, 3, .3] {1,4,5} fn[{1, 2, 3, 4, 5, 6}, 3, .3] {}


3

You can use RandomChoice to do weighted random choice of the sampling functions and use Through to apply those functions to your data. d = {1, 2, 3, 4, 5, 6}; SeedRandom[15] Through[RandomChoice[{0.7, 0.3} -> {RandomSample[#, 1] &, Nothing &}, 12][d]] (* {{3}, {5}, {1}, {6}, {1}, {4}, {4}, {3}, {3}} *) SeedRandom[15] Through[RandomChoice[{0.7, ...


3

This is only a partial answer. (I cannot duplicate the results from the approximation found in this article. That's likely my fault.) The problem can be described as finding the pdf for the sum of $L$ independent and identically distributed Rayleigh random variables: $$Z_L=\sum_{i=1}^L X_i$$ where $X_i \sim \text{Rayleigh}(\sigma)$. All of the moments ...


3

I know I'm a billion years late on this, and an answer now won't do anyone any good, but I found it really interesting for some reason. I'm not great with probabilities, but my reasoning seemed to match the simulation, so I think it's correct. We should expect it to take $\frac{1}{p}$ tries to get a goal, where $p$ is the probability of a goal. This means ...


3

One way to get more control is to build your own version of SmoothDensityHistogram using DensityPlot and ContourPlot. data = RandomVariate[BinormalDistribution[.5], 10]; pdf = PDF[SmoothKernelDistribution[data], {x, y}]; dp = DensityPlot[ pdf, {x, -3, 3}, {y, -3, 3}, PlotLegends -> Automatic ]; cp = ContourPlot[ pdf, {x, -3, 3}, ...


2

There are essentially $8$ variables here: $$\mu(A\wedge B\wedge C), \mu(\neg A\wedge B\wedge C),\mu(A\wedge \neg B\wedge C), \mu(A,\wedge B\wedge \neg C),\mu(\neg A\wedge\neg B\wedge C), \mu(\neg A\wedge B\wedge \neg C),\mu(A,\wedge \neg B\wedge\neg C),\mu(\neg A\wedge \neg B\wedge \neg C),$$ where $\mu$ denotes the measure. Lets label them $A_1,\dots,A_8$. ...


2

TransformedDistribution accepts a parameter; although, in the case given, it does not know a common distribution that corresponds to the resulting distribution. Nonetheless, the usual probability functions work with the result. Clear["Global`*"] dist[a_] := TransformedDistribution[a*x^2, x \[Distributed] UniformDistribution[{0, 1}], Assumptions -> a ...


2

Replicate singleton data (as you did) Pass the original data as metadata and Use the metadata (#3[[1]]) as the second argument of the function "PointDensity"; that is, use ChartElementFunction -> ChartElementData["PointDensity"][#, #3[[1]]]&. DistributionChart[Thread[(data /. {a_?NumericQ} :> {a, a}) -> data], ChartStyle -> "Rainbow", ...


2

You may use Accumulateand TimeSeriesThread. With s = TimeSeries[{a, b, c}]; then t = TimeSeriesThread[Apply[Divide], {Accumulate[s], Range@s["PathLength"]}]; t["Values"] { a , (a+b)/2 , (a+b+c)/3 } Hope this helps.


2

Disclaimer: I am not up-to-speed on any current literature on this particular approximation. What I'm about to present has likely been done many years ago. The problem can be described as the need to find the probability density function (or a good approximation of it) for the sum of $L$ independent and identically distributed Rayleigh random variables ...


2

tsample = Table[jj, {jj, 0.1, 0.25, 0.01}]; ε = EstimatedDistribution[tsample, TriangularDistribution[{min, max}]] (* TriangularDistribution[{0.0750068, 0.274993}] *) dataε = RandomVariate[ε, 1000]; Show[ Histogram[dataε, Automatic, "PDF"], Plot[PDF[ε, x], {x, 0, 0.3}]] sample = Table[ii, {ii, 0.1, 0.35, 0.01}]; ω = EstimatedDistribution[sample, ...


2

The signature of SmoothDensityHistogram is as follows: SmoothDensityHistogram[data_, espec_, dfun_, OptionsPattern[]] := ... As is described in the documentation. Consequently, to specify the distribution without specifying the estimator specification, which seems to be what you want to do, you should do the following: SmoothDensityHistogram[ somedata, ...


2

Clear["Global`*"] dista = TriangularDistribution[]; distb = TriangularDistribution[]; Probability[a > b, {a \[Distributed] dista, b \[Distributed] distb}] (* 1/2 *) dista = TriangularDistribution[{0, 1}]; distb = TriangularDistribution[{1/2, 3/2}]; Probability[a > b, {a \[Distributed] dista, b \[Distributed] distb}] (* 1/24 *) dista = ...


2

Here are a few options for you to start. Try to experiment by reading examples in documentation for listed below functions. data=RandomVariate[NormalDistribution[1,3],10^3]; f1=NormalDistribution[1,3]; f2=FindDistribution[data]; options={Filling->None,PlotStyle->PointSize[.02]}; Show[Histogram[data,20,"ProbabilityDensity",PlotTheme->"Detailed"], ...


2

Perhaps this: d = {1, 2, 3, 4, 5, 6}; RandomChoice[ Flatten@{70, ConstantArray[30/Length[d], Length[d]]} -> {{}, Sequence @@ d} ] Let's check that it does what you want by drawing 10,000 samples: RandomChoice[ Flatten@{70, ConstantArray[30/Length[d], Length[d]]} -> {{}, Sequence @@ d}, 10000 ] // Counts (* Out: <|{} -> 6998, 3 ->...


2

I get this plot: followed @JimB advice. Time to learn some statistics, again.


2

SeedRandom[1] data = RandomVariate[BinormalDistribution[.5], 10]; pdf = PDF[SmoothKernelDistribution[data]]; sdh = SmoothDensityHistogram[data, MeshStyle -> Red, Mesh -> 3, Method -> {"BoundaryOffset" -> False}, PlotLegends -> Placed[BarLegend[Automatic, LabelStyle -> {GrayLevel[0.3], 30, FontFamily -> "Arial"}], After]]; ...


1

To summarize @JimB's comment, you should plot the PDF of the normal distribution that most closely resembles your data, i.e. the one with the same mean and standard deviation: Show[ Histogram[raw, Automatic, "PDF"], Plot[ PDF[NormalDistribution @@ Through[{Mean, StandardDeviation}[raw]], x], {x, -4, 4}, PlotRange -> All, Filling -> ...


1

This can be accomplished by replacing NSolve[k[dlist[[i]], p] == 0, p, Reals] by If[t = NSolve[k[dlist[[i]], p] == 0, p, Reals]; (p /. First[t]) < 0, First[t], Flatten[t]] in the Print statements. This can be tested by NSolve[k[dlist[[61]], p] == 0, p, Reals] If[t = NSolve[k[dlist[[61]], p] == 0, p, Reals]; (p /. First[t]) < 0, First[t], Flatten[...


1

The documentation about variance structures in NonlinearModelFit is not in standard terms (at least in terms familiar to me, a statistician). When one uses the options Weights -> 1/errors^2, VarianceEstimatorFunction -> (1 &), the following model is assumed: $$y=f(x) + e \epsilon$$ where $y$ is the response, $f(x)$ is the nonlinear function of $...


1

Try Outer[List, sample, tsample]


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