# Tag Info

15

ClearAll[hangingRootogram] hangingRootogram[dat_, estdist_, binspec_: Automatic][sc___ : .9, o: OptionsPattern[]] := With[{hd = HistogramDistribution[dat, binspec], bins = HistogramList[dat, binspec][[1]]}, With[{es = sc Min@Differences@bins}, DiscretePlot[{Sqrt@PDF[estdist, x] - Sqrt@PDF[hd, x], Sqrt@PDF[estdist, x]}, {x, bins}, ExtentSize -&...

8

The defined function RootHistogram makes a "hanging rootogram" more-or-less following this definition. The first argument is the data. The second argument dist is optional distribution. The function uses SmoothHistogram for the hanging curve and the third argument, bandWidth, is the band width argument of SmoothHistogram. The bspec argument is given to ...

6

I don't know how to interprete scaling of frequencies and associated expected curve so I will just plot PDF. This answer isn't complete then! Here is a simple way to hang those bars using ChartElementFunction: d = NormalDistribution[0, 1] n = 100 data = RandomVariate[d, n]; bspec = {-5, 5, .5}; f[{{xmin_, xmax_}, {ymin_, ymax_}}, ___] := Module[{ m ...

6

You don't seem to have a random sample from any probability distribution but rather have measurements/observations that might have a similar functional form as a probability density function. Your curve has an area of about 0.43 going from 0 to 10. While the tail of the distribution you envision might be heavy enough to hold the remaining 0.57 of a ...

5

If you want to create a ProbabilityDistribution for a two-point random variable, here is one way to do so: x1 =. x2 =. p1 =. twoPointRV = TransformedDistribution[y x1 + (1 - y) x2, y \[Distributed] BinomialDistribution[1, p1]] Now you can use twoPointRV symbolically as a ProbabilityDistribution: mean = Expectation[x, x \[Distributed] twoPointRV] (* ...

4

You might be able to make use of ScalingFunctions. lq[q_ /; q != 1][x_] := (x^(1 - q) - 1)/(1 - q) invlq[q_][z_] := Abs[(1 + z - q z)^(1/(1 - q))] spec[q_] := {{lq[q], invlq[q]}, {lq[q], invlq[q]}}; Plot[x^2, {x, 1, 30}, PlotRange -> All, ScalingFunctions -> spec[0.8]] This works in Mathematica 10.1 but it is not officially supported, as ...

3

I think I've got your idea, you simply want to know when all three points are lying uniformly in a unit disk, how to calculate the possibility of the Circumsphere lying fully in the unit sphere, right? So, there's quite a lot mistakes in your code: What is If doing up here? Probability can only handle codes that'll generate True and False only, so using ...

3

Avoid using capital letters as variables so that they don't conflict with Mathematica's existing definitions/functions (here "N" was part of the problem). There were some erroneous underscores as well, used when referencing a function from another function. rd = 1; n = 5; pb = 1; c[α_, r_, x_] := x^2 - x^2*Hypergeometric2F1[1, 2/ α, 1 + 2/ α, -x^α/(β*r^α)]; ...

3

Do you mean rd = 1; n = 5; pb = 1; c[α_, r_, x_] := x^2 - x^2*Hypergeometric2F1[1, 2/α, 1 + 2/α, -x^α/(β*r^α)]; β = 3.1623; α = 4; p = Integrate[((c[α, r, rd] - c[α, r, r])/(rd^2 - r^2))^(n - 1)*2*n*r*(1 - r^2)^(n - 1), {r, 0, 1}] Integrate[10*r*(1 - 0.08904220055024259*r^2 - Hypergeometric2F1[1/2, 1, 3/2, -(0.31622553204945764/r^4)])^4, {r, 0,...

3

data = Import["data.dat", "List"] tsm = TimeSeriesModelFit[data, "AR"] Normal[tsm] Result: ARProcess[0.00435059, {1.41701, -0.0804567, -0.245416, -0.0753475, -0.0415635}, 5.10131*10^-7] Then you can read off the coefficients and noise variance.

2

This is a much simpler approach than already given and simply takes theoretical and measured values: rootogram[theory_, observations_] := Show[{ ListLinePlot[{theory}, PlotMarkers -> {Automatic, 10}], Graphics[{Table[ Line[{{i, theory[[i]]}, {i, measurements[[i]] - theory[[i]]}}], {i, Length[theory]}]}] }] theory = {3, 5, 7, 9, ...

2

You can specify such a ProbabilityDistribution by using DiracDelta which have some interesting properties: x1=1; x2=0; p1=.3; p2=.7; d = ProbabilityDistribution[p1 DiracDelta[x - x1] + p2 DiracDelta[ x-x2], {x, -Infinity, Infinity}]; RandomVariate[d] Expectation[x, x \[Distributed] d] ProbabilityDistribution will automatically transfrom your ...

1

I agree with Jim Baldwin, but here is the code I put together based on this data originating from a random sample (Just in case that helps you for some reason). Your original problem was the 0 data point causing the functions not to evaluate. dist = {0.0258899, 0.047329, 0.0683456, 0.0861312, 0.103529, 0.118554, 0.124337, 0.127011, 0.131217, 0.134408, 0....

1

I offer the following based on Monte Carlo integration, but trying to make use of the facilities Mathematica provides: weights = {2/3, 1/3}; means = {-3, 2}; sd = Sqrt[2]; distributions = NormalDistribution[#, sd] & /@ means; fdist = MixtureDistribution[weights, distributions]; qdist1 = TransformedDistribution[Log[PDF[fdist, f]], Distributed[f, ...

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