How do I find if 2 random variables are conditionally independent given the joint conditional PMF? - statistics

This is the question, but I can not find a way on how to tackle it...
I know that if they are independent then:
p(X, Y|Z) = p(X|Z)p(Y|Z)
p(X|Y, Z) = p(X|Z)
p(Y|X, Z) = p(Y|Z)
Does someone have some tips on how to tackle this?

You are to check if P(x=a,y=b|z=c)=P(x=a|z=c)P(y=b|z=c) for every combination of a,b,c equal to 0 or 1. For example, P(x=1,y=1|z=0)=0.49 but also P(x=1|z=0)P(y=1|z=0)=(P(x=1,y=0|z=0)+P(x=1,y=1|z=0))*(P(x=0,y=1|z=0)+P(x=1,y=1|z=0))=(0.49+0.21)(0.49+0.21)=0.49.
There are seven cases to go but once you found that P(x=a,y=b|z=c)\not=P(x=a|z=c)P(y=b|z=c) for some a,b,c you are done, in which case the answer is NO (x,y are not conditionally independent w.r.t. z). Otherwise, the answer is YES.
All the required values can be read from the table.

Related

Application of a custom function to generate iterations across a distance range

Bit of a complex query but I will try to articulate it as best I can:
Essentially I have a list of objects for which I am trying to work out the probability of said items hitting particular points below on the seabed having been dropped at the surface. So there are two steps I need guidance on:
I need to define a custom function, ERF(a,b), where I need to refer to specified values dependent on the Item Number (see in the column names) in order to then use them as multipliers:
These multipliers can be found in a dictionary, Lat_Dev (note please ignore the dataframe column reference as this was a previous attempt at coding a solution, info is now found in a dictionary format).
The function then needs to be repeated for set iterations between a & b with the step size defined as 0.1m. This range is from 0-100m. a is the lower limit and b the upper limit (e.g. a = 0.1m & b = 0.2m). This is done for each column (i.e. Item_Num).
Hopefully the above is clear enough. Cheers,

Selection based on several inputs without extreme duplication

I have a library of data that i need to pull specific rows from, at the moment i have an ID made up of several dropdown menus =$C$2&$F$2... that i compare to an index made up of a combination of column content: =[#Column1]&[#Column2]... that i then use to pull the right data for that instance with VLOOKUP.
Now however i need a much more varied set with more selections, 5 columns worth. That creates 16 sets for every index on the first column and will generate thousands of lines if i am to create one version of every permutation.
The best scenario would be a way to use a modular form of the selections above, if there is any input on X, Y and Z then it functions like now, but if Y and Z are empty it only pulls X. Easy in theory but i dont know the format it will have to take, and it gets even more complicated if i want X and Z for instance, or Y and Z, but still create a neat list of the selections.
An alternative might be a way to pull tables based on a selection, and make one table for every "part" of my query but i cant find a way to do that either.
What i need is any way to pull and combine several rows from a library (based on dropdown or similar input) and assembled in a neat list that i can print.
First post, and thanks in advance =)

Assignment by type in excel

I am trying to solve an assignment problem in excel but cannot achieve it yet. As you can see below I need to assign some jobs to some people. I have to do this by some rules;
1-Each assignment counts one and this adds on point cell. (aa has 2 points if I give it another job aa's new point became 3 points)
2-It is great if points are not bigger than 6.
3-If it is possible type 1 and type 2 must match. If it is not, any type2 can fit any type1.
I need to fill C and D (if job count is 2) with names column with considering type columns and point column. Can you please help me?

How to get a list of values between two values without knowing which is greater in Python?

I need to create a list of the values between x and y, not including x and y. I'm aware range() can be used to accomplish this. However, I need to be able to do this without knowing whether x or y is greater.
The main problems I'm running into are that range() does not seem to work when the first argument is greater, and I can't know whether to increment x or y in order to make sure x and y are not included.
I'm aware there's a way to do this in several lines with if statements and for loops, however I'm looking for a method that only takes one or two lines, perhaps with a built-in function.
You can try using the min max function
for i in range(min(x,y)+1, max(x,y)):
print(i)
for num in range(min(x, y), max(x, y))
... do something...

Best way working with trigonometric functions

I wan't to compute some trigonometric formulas.
Is better to simplify as much as I could my formulas ?
Examples:
Ex. 1: u = atan2(cos(pi/4), sin(pi/4)*cos(0))/(2*pi)
Ex. 2: u = atan((pi/4)/cos(pi/4))/(2*pi)
These examples give me two different outputs, although in theory, both of them return the same result.
So, what is the best way to work such formulas ?

Resources