The ratio figures interval

Hello,
I would like to ask:

I have an interval. I know if zero is in the interval. I but only one interval. I want 100 intervals. For everyone I know if zero is in the interval or not … I need this result:

For example:
Zero is in the interval: 54
Zero is not in the interval 46

Thank you for the advice :slight_smile:

data = RandomReal[NormalDistribution[0, 1], 100];
Needs["HypothesisTesting`"]
Int = MeanCI[data]
Int1 = Int[[1]]
Int2 = Int[[2]]
If[Int1*Int2 >= 0, "Null is not in interval", "Null is in interval"]

data1 = RandomReal[NormalDistribution[0, 1], 30];
Needs[“HypothesisTesting`”]

data2 = For[i = 1, i < 20, 
  i++, {Print[MeanCI[RandomChoice[data1, 20]]]}]

My job … :frowning: but i don’t know…

Hi,

regarding the question whether 0 is in the interval, would this not work for you?

IntervalMemberQ[Interval[Int], 0.]

Now, if that is what you want then this line might solve your problem:

Tally[IntervalMemberQ[Interval[#], 0.] & /@ Table[MeanCI[RandomChoice[data1, 20]], {i, 1, 100}]]

The false counts the cases that 0 is not in the interval and true the cases when it is in the interval. If you want sentences rather then True and false, this might help:

TableForm[Tally[IntervalMemberQ[Interval[#], 0.] & /@ Table[MeanCI[RandomChoice[data1, 20]], {i, 1, 100}]] /. {True -> "Zero is in the interval.", False -> "Zero is not in the interval."}]

ScreenShot2015-11-19at13.42.35.png

Cheers,

Marco