Tag Info

Hot answers tagged

8

Take a look at this. Let's generate some data with missing entries: data = Table[9 k + RandomInteger[9, 10], {k, 10}] /. Thread[RandomInteger[99, 5] -> Missing[]]; data // TableForm Build TemporalData object and select replacement method for missing points: td = TemporalData[data, {Range[10]}, MissingDataMethod -> {"Interpolation", ...


8

Another option to the answer posted by @Andy Ross cropped up in a recent question of mine about corrupting an image with Poisson noise. In my own answer, I made use of LibraryLink to utilise the distributions built into C++, which you can find here: http://www.cplusplus.com/reference/random/ This was especially useful in my case because Poisson noise in an ...


5

Another way to use OrderDistribution: use the joint distribution of largest three order statistics in a sample of size four: dist = OrderDistribution[{UniformDistribution[], 4}, {2, 3, 4}]; Expectation[x + y + z, {x, y, z} \[Distributed] dist] (* 9/5 *)


5

With f[a_, {x_, y_}] := Piecewise[{{a x, x < y}, {x, x == y}, {1 - a + a x, x > y}}, 0] one simulation can be defined by sim[length_] := Module[{rv = RandomVariate[BetaDistribution[3, 1], length], y, yBar}, y[1] = First@rv; yBar[t_Integer] := yBar[t] = 1/t * Sum[y[i], {i, 1, t}]; y[t_Integer] := y[t] = f[0.5, {rv[[t]], yBar[t - 1]}]; ...


4

Here is a quick (and dirty?) implementation of the Laplace distribution. Relationship to the uniform distribution as given on Wikipedia: randomLaplace = With[{$MachineEpsilon = $MachineEpsilon}, Compile[{{µ, _Real, 0}, {b, _Real, 0}, {n, _Integer, 0}}, With[{u = RandomReal[{-1/2, 1/2} (1 - $MachineEpsilon), n]}, µ - b Sign[u] Log[1 - 2 Abs[u]] ] ...


3

It appears to be a bug in the reporting mechanism. The individual components x and y are being tested for normality but the reported value is that of a joint test for multivariate normality. The conclusion is correct, the message is wrong. SeedRandom[2154]; x = RandomReal[{-5, 5}, 100]; y = 2 x + 1 + RandomReal[{-0.1, 0.1}, 100]; X = Transpose[{x, y}]; ...


3

Hopefully I don't misunderstand but I think this will be of help: SeedRandom[0] d1 = {Range[#], RandomInteger[99, #], RandomInteger[1, #]}\[Transpose] &[20] {{1, 83, 1}, {2, 66, 1}, {3, 4, 0}, {4, 21, 0}, {5, 71, 0}, {6, 67, 1}, {7, 16, 1}, {8, 67, 0}, {9, 76, 1}, {10, 28, 1}, {11, 21, 1}, {12, 43, 1}, {13, 17, 0}, {14, 46, 0}, {15, 53, 0}, ...


1

As you requested in your edit, @Mr.Wizard's answer shows how to perform listwise deletion (= corr in Stata). An alternative is to perform pairwise deletion (= pwcorr). In a comment above you note that some variables have many missing values; in my opinion this indicates you may want to consider pairwise deletion so that you are not throwing out a lot of ...


1

You can check the documentation about the option NominalVariables http://reference.wolfram.com/language/ref/NominalVariables.html NominalVariables is an option for machine learning functions such as LinearModelFit or Classify that specifies which variables should be treated as having discrete values specified by names. So LogitModelFit[{{300, 0, ...


1

Tweak Solution Since Seth has provided 2 answers, I thought I might also put up another answer. My motivation for separating this from my original answer is that ... my original answer is a self-contained mathematical solution in transformations of random variables, essentially striving to side-step Mathematica's use of Boole which was not working, ...


1

Citing this Demonstration by Darren Glosemeyer (Wolfram Research): Single prediction bands incorporate both the variation in parameter estimates and the overall variation in response values, while the mean confidence bands incorporate only the variation in parameter estimates. As a result, single prediction bands are wider than mean prediction ...


1

With the function f[a_, {x_, y_}] := Piecewise[{{a x, x < y}, {x, x == y}, {1 - a + a x, x > y}}, 0] you can define a new function, that will perform a single simulation sim[a_Real, n_Integer] := Module[{data = Partition[Riffle[#, Accumulate[#]/Range[n]], 2] &@ RandomVariate[BetaDistribution[3, 1], n]}, f[a, #] & /@ data ] where the ...


1

I don't think you can get a solution by just throwing the problem at Solve. If you make a minor change in the argument you give to Solve (substituting 95/100 for 0get.95), you will get a message you may find more meaningful. Solve[ CDF[ChiSquareDistribution[n - 1], (n - 1)/k1] - CDF[ChiSquareDistribution[n - 1], (n - 1)/k2] == 95/100 && ...



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