Statistics – Simulation of these special cubes on regular cubes

I did this when I played certain board games, and it's a suggested way to replace fate dice. Assign each side of a cube with the same number of faces, here a d6 with each number. It's easier to remember whether its logical and lower numbers on the replacement die correspond to a lower number or a worse effect on the simulated one. Suggestion:

begin {array} {cc}
textbf {d6} & textbf {Special} \
1 & -1 \
2 & 0 \
3 & 0 \
4 & 1 \
5 & ​​1 \
6 & 2
end {array}

The notable drawback is that it increases the cognitive load, slowing the roll (and counting) process by an amount that depends on the type of player you have.

If you really want to simulate it with something else, the special cast is pretty close to 3d2-4 or 3d {0,1} -1. If you do not have any dice lying around (and if you need to use other dice to simulate dice, the above method is probably better), you can use dice with the number of heads (or tails, your preference) counted as d { becomes. 0.1} s. roll $ N $ Special dices, dice $ 3N text {d} {0,1 } $ and subtract $ N $, The following Anydice program will convince you of equivalence.

If necessary, use a Diceroller that allows custom cubes and use them. Requires and uses software and takes away the tactility of dicing, but is cheap, fast and easy. In fact, your special role in the above program is implemented on Anydice, so you can put the view on "scooter" and you're gone.

Probability or Statistics – Determine the sum of two independent normal mixing distributions with Mathematica

Suppose a random variable $ X_1 $ is a mixture of two normal distributions with $ mu_A $ and $ mu_B $ Standard deviations of $ sigma_A $ and $ sigma_B $ each and given by weights $ w_ {1_A} $ and $ w_ {1_B} $, Suppose that another random variable exists, $ X_2 $that is independent of $ X_1 $, but is also a mixture of two normal distributions. in addition, $ X_2 $ has the same means and standard deviations as $ X_1 $but has given his own weights by $ w_ {2_A} $ and $ w_ {2_B} $, Can I use Mathematica to find $ X_1 $ + $ X_1 $?

I have tried:

[ScriptCapitalD] = MixtureDistribution[{w1A, w1B}, {NormalDistribution[muA, sdA], NormalDistribution[muB, sdB]}]  + MixtureDistribution[{w2A, w2B}, {NormalDistribution[muA, sdA], NormalDistribution[muB, sdB]}] 

but apparently the problem is beyond Mathematica. Any suggestions on how to find out anyway with Mathematica?

Statistics – standard deviation of fidelity

If you study Cohens and Fleiss & # 39; Kappa to measure fidelity, you can use this formula to estimate the standard deviation:
$$ SD ( kappa) = sqrt { frac {P_o (1-P_o)} {(1-P_e) ^ 2}} $$
from where $ P_o $ is the proportion of observed agreement and $ P_e $ is the expected match.

However, if the observed data is non-coincident, then it does $ P_o <0 $, the specified formula for $ SD ( kappa) $ does not work, because it is not a real numeric value.

My question is, is there a workaround for this problem?

I suspect that taking the absolute value inside the square root is not a valid approach … (?)

Thank you for your answers and comments!

PHP – solution for the statistics of the website

I have a website that was developed by PHP and uses PostgreSQL.
I recorded all user activities in a table.
Now I want to add a function f for statistical purposes:
s = f (x, y) with x is one of the user activities, y is userid
The report is daily, which means that the administrator can view the report from date to date. We need report y and s.
I changed the code to accomplish the purpose, but it triggered a new issue where the request might timeout.
Could you point out the solution to this problem?
Many thanks.

st.statistics – derive the policy in a Markov decision process (statistics question)

I am dealing with the following situation: In a Markov decision-making process, each state has a finite number of possible actions, and each action leads to a discrete probability distribution over the successor states. We will define a policy that selects one of these actions for each state (ie the policy is stationary and can not contain probabilistic combinations of different actions). We would like to choose this policy so that a friendly agent who knows the underlying MDP including the actions for each state and can observe the transition processes in the induced Markov chain can guess what action we are taking in each state with high probability. My question is this: Given a (probably finite) set of observations generated by the induced Markov chain, how should the friendly agent guess the measures taken in each state? In other words, with a limited number of discrete PDF files and a series of observations, how can we select the PDF files that most likely make the data? I realize that this is probably not a difficult statistic issue, but I have no background in this area.

SQL Server – To set up a custom table for self-calculated statistics

I want to do some analysis in my database and collect the results in a custom spreadsheet or custom report so that I can then export the captured values ​​with my c # tool to create a PowerPoint presentation.

Values are e.g. 
relative counts:

and so on.

Who can help me here? I have a SQL Server Standard Edition

Probability – Comparison of the Gaussian with the Gaussian order statistics

I would like to calculate the probability of
$ mathbb {P} (Y> max (X_i)), Y sim N (0, 1), X_i sim N (0, sigma_i) $

All random variables have a mean of zero, but the differences are different.

My previous attempts were unsuccessful. I tried to look at events $ A_i = P (Y> X_i) $ and their interfaces and unions. But that did not work.

Then I took a step back and tried to look for similar results online. If that $ X_i $ For an IID, this would mean that Y is compared to the nth order statistics of a normal random variable. This question seems to be related: It seems that even for the simplified case there is no solution in closed Form for the order statistics.

Am I missing a trick here? Is it possible to calculate this in closed form?

Concatenation of statistics in a cube queue

I first thought up the question of "rolling in a chain of methods" and was interested in whether this could be improved. It could, so now I have this class:

public class DiceQueue : IEnumerable
    public int Sides { get; }
    internal Random Rnd = new Random();
    public DiceQueue(int sides) { Sides = sides; }

    public int Roll() => Rnd.Next(Sides) + 1;
    public IEnumerator GetEnumerator() { while (true) { yield return Roll(); } }
    IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();

Quite simple: just create a queue by calling the constructor with multiple pages, and then it can be used as an infinite enumerator. But in general you just want to quit a lot of X values ​​or just throw a single die. But this class is not that interesting because I want to do statistics with random throws!
So, therefore this class:

public class Statistics : IEnumerable>
    public string Name { get; private set; }
    public long Sum { get; private set; } = 0;
    public long Total { get; private set; } = 0;
    public long Min { get; private set; } = long.MaxValue;
    public long Max { get; private set; } = long.MinValue;
    public double Average => 1.0 * Sum / Total;
    public double TotalOf(int value) => Totals.ContainsKey(value) ? 100.0 * Totals(value) / Total : 0.0;
    protected Dictionary Totals { get; set; } = new Dictionary();
    public event EventHandler Added;
    protected virtual void OnAdded(StatisticsEventArgs e) { Added?.Invoke(this, e); }
    public Statistics() : this("No name") { }
    public Statistics(string name) { Name = name; }
    public Statistics Add(long value)
        if (!Totals.ContainsKey(value)) { Totals.Add(value, 0); }
        Totals(value) += 1;
        Sum += value;
        if (Max < value) { Max = value; }
        if (value < Min) { Min = value; }
        OnAdded(new StatisticsEventArgs(this, value));
        return this;
    public IEnumerable Report()
        yield return $"Report for: {Name}";
        yield return $"The total sum is {Sum} for {Total} values for an average value of {Average:0.00}.";
        yield return $"The values are all between {Min} and {Max}.";
        yield return "List of values";
        foreach (var point in this) { yield return $"* Value {point.X} occurred {point.Y} times: {100.0 * point.Y / Total:00.0}%."; }
        yield return new string('-', 40);
    public override string ToString() => string.Join(Environment.NewLine, Report());
    public IEnumerator> GetEnumerator()
        foreach (var total in Totals.OrderBy(pair => pair.Key)) { yield return new Point { X = total.Key, Y = total.Value }; }
    IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();

It has a name and you just add values ​​and there are different statistics about it. The Report () method generates a summary summary text report, but it is mainly used for the ToString () method. Interesting way to create multi-line reports, by the way.
There is also an event that fires when a new value is added so that the system can display a running total.
But I have to show some guys. First:

public class Point
    public T X { get; internal set; }
    public T Y { get; internal set; }

No rocket science. And while C # has a point data type somewhere, I wanted one that is more general …

public class StatisticsEventArgs : EventArgs
    public Statistics Stats { get; }
    public long LastValue { get; }
    public StatisticsEventArgs(Statistics stats, long lastValue)
        Stats = stats;
        LastValue = lastValue;

Yes, well … The event requires a dispute. That should be it. This is an attempt to follow the standard for events.
But I want to use the statistics in a concatenated way, and I want to compile statistics on multi-dice dice rolls. That's why I also have the following extension methods:

public static class Toolkit
    public static IEnumerable Do(this IEnumerable data, Action action)
        foreach (var item in data)
            yield return item;
    public static IEnumerable> TakeGroup(this IEnumerable data, int count)
        while (true) { yield return data.Take(count).ToList(); }

The Do () method only performs one action with one value from an enumerator before passing the value to the next method. Maybe not elegant, but I have no other options here, as far as I know.
The TakeGroup () method captures an X set of values ​​and returns them as a list. This will continue until infinity. Too bad that this can lead to problems if the base enumeration is limited. So I have to find a solution. Maybe a partitioner? Well, I have to clarify that, but that works for my current purpose …
Then something to test.

public static class StatisticsTest
    public static void Execute(int count)
        Console.WriteLine($"We've rolled for a total of {D6X3RollQueue.Take(count).Count()} times.");
    private static readonly DiceQueue D6 = new DiceQueue(6);
    private static readonly Statistics D6Stat = new Statistics("Rolling d6");
    private static readonly Statistics D6X3MinStat = new Statistics("Minimum of 3D6 (1 to 6)");
    private static readonly Statistics D6X3MaxStat = new Statistics("Maximum of 3D6 (1 to 6)");
    private static readonly Statistics D6X3MinMaxStat = new Statistics("Sum(Min+Max) of 3D6 (2 to 12)");
    private static readonly Statistics D6X3SumStat = new Statistics("Sum of 3D6 (3 to 18)");
    private static readonly IEnumerable D6RollQueue = D6.Do(d => D6Stat.Add(d));
    private static readonly IEnumerable D6X3RollQueue = D6RollQueue.TakeGroup(3)
                                                                        .Do(d => D6X3MinStat.Add(d.Min()))
                                                                        .Do(d => D6X3MaxStat.Add(d.Max()))
                                                                        .Do(d => D6X3MinMaxStat.Add(d.Min() + d.Max()))
                                                                        .Select(d => d.Sum())
                                                                        .Do(d => D6X3SumStat.Add(d));


This shows why I want to have a cube queue. In the queue, I can collect different statistics for all the roles I have made, while I can roll as many times as I want. By declaring a queue as D6RollQueue I can take a single role with me D6RollQueue.First() or make an X-number of throws with `D6RollQueue.Take (X) & # 39; and then do something with the result while the queue keeps track of all the statistics. So when I make a dice game, I can just roll as many times as I want while having different stats statistics.
And with the TakeGroup () method, I can keep statistics on groups of throws like throwing three dice and statistics on the minimum and maximum values.

Go on, shoot it. Can it be improved?
(It's not that important that the random number generator is predictable.)