{"id":27246,"date":"2025-09-07T09:38:08","date_gmt":"2025-09-07T15:38:08","guid":{"rendered":"https:\/\/rankexploits.com\/musings\/?p=27246"},"modified":"2025-09-07T18:35:52","modified_gmt":"2025-09-08T00:35:52","slug":"statistical-test-described-by-joshua","status":"publish","type":"post","link":"https:\/\/rankexploits.com\/musings\/2025\/statistical-test-described-by-joshua\/","title":{"rendered":"Statistical Test Described by Joshua"},"content":{"rendered":"<p>In comments, Joshua described, and so indirectly proposed, a statistical test one might use to determine whether a particular data set for the number of trans mass murders, <i>k<\/i>, out of a collection of <i>n<\/i> mass murders could be used to test the hypothesis that trans individuals commit mass murders at the same rate as non-trans individuals.  I don&#8217;t think his intention in posting this was to propose a test. I think his intention was to tell me how woeful my view that the main problem with running statistical tests on hypotheses about the rate at which trans individuals commit mass murders is that we don&#8217;t have reliable data.  But, whether or not he intended to do so, he <i>did propose<\/i> a method which, of course, we could use to test actual samples.<br \/><!--more-->\n<\/p>\n<p>In this post, I&#8217;m going to quote from the (currently reserved) comment in which he describes a general statistical test. He applied the method to hypothetical data.  I&#8217;ll also be correcting some of the numerical errors that crept into his analysis of that hypothetical data.   I will also be releasing that comment and placing it in the comments thread for this post so you can see the full comment.<\/p>\n<p>On to Joshua&#8217;s comment!  I&#8217;ll skip the first bit as irrelevant to the proposed statistical test and start with this.<\/p>\n<h2>Joshua&#8217;s method extracted from comment<\/h2>\n<blockquote>\n<p>Oh, and it\u2019s cute that you\u2019d want to take the time to show me a test, but really don\u2019t waste your time. I can just ask Grok to run some numbers for me:<\/p>\n<\/blockquote>\n<p>Joshua then post Grok&#8217;s answer to a question Joshua asked; the question itself is not.   So we will call the entity responding &#8220;Joshua-Grok&#8221;.  Content from Joshua&#8217;s comment is in blockquotes. I will break that up and add my own observations. <\/p>\n<p>Joshua-Grok&#8217;s answer begins:<\/p>\n<blockquote>\n<p>\nExpected Proportion Under the Null<\/p>\n<p>If trans people make up 1% of the population, we expect 1% of shooters to be trans by chance.  For a sample of n shooters, the expected number of trans shooters is n \u00d7 0.01.\u201d .<\/p>\n<\/blockquote>\n<p>That is indeed what we expect if individual trans individuals become shooters at the same rate as non-trans individuals.<\/p>\n<blockquote>\n<p>\n2. Binomial Test Setup<\/p>\n<p>Let n be the number of school\/church shooters in the sample (e.g., 50 or 100 over a decade).<br \/>\nLet k be the number of trans shooters observed.<\/p>\n<p>The probability of observing k or more trans shooters by chance, given a population proportion of 0.01, is calculated using the binomial distribution:P(X ? k) = 1 \u2013 P(X < k), where X follows a binomial distribution with parameters n and p = 0.01.<\/p>\n<\/blockquote>\n<p>This would seem to tells us something about the situation Joshua wanted Joshua-Grok to analyze. It seems to be school or church shooters (as opposed to other possible shooters.) Joshua wants Grok to assume 1% of the general population is trans.  The variables &#8216;n&#8217; and &#8216;k&#8217; are the total  number of shooters and total number of trans shooters respectively.<\/p>\n<p>I&#8217;ll now tease out his notation so we agree what it is.  I&#8217;ll also translate this into R commands. This will allow those familiar with R to repeat the calculations.<\/p>\n<p>1) The notation  P(X ? k) contains a ? which likely means WordPress stripped something. Based on the wording &#8220;P(X ? k)&#8221;, we can infer P(X ? k) must be P(X ? k). That is the probability that &#8220;k or more&#8221; will be observed out of whatever sample size &#8220;n&#8221; is later used and single probability &#8220;p&#8221; are used. Joshua-Grok says it will use p=0.01.<\/p>\n<p>2) Based on the above, P(X < k) must mean \"the probability of observing fewer than k shooters\" given the parameters which will be n shooters, with the probability that any individual shooter is trans is 0.01\".\n\nJoshua appears to be rounding to three decimal places. So if n=50 and the population of trans is 0.01 in R P(X < k) would be calculated as \nP(X < k) = round(pbinom(k-1,50,0.01),3);\n\nThe reason for k-1 is that, pbinom calculates \"the probability of observing k or fewer\", Joshua is saying just \"fewer\".  \n\nJoshua-Grok continues:\n\n\n\n\n<blockquote>\nWe want the smallest k where P(X ? k) < 0.05, indicating statistical significance.<\/p>\n<\/blockquote>\n<p>This statement tells us Joshua-Grok has picked a <i>single sided<\/i> test. He doesn&#8217;t say why he picked a single sided test, but this is his prerogative.  Some might have picked a two sided test.  He&#8217;s also picked a confidence level of 5%. That&#8217;s also his prerogative and pretty conventional.<\/p>\n<p>Joshua-Grok now starts to calculate.<\/p>\n<blockquote>\n<p>\n3. Calculating the Threshold<\/p>\n<p>Let\u2019s test for different sample sizes (n) to find the minimum number of trans shooters (k) that would reject the null hypothesis at p < 0.05.Sample Size: n = 50 (e.g., 5 shootings\/year \u00d7 10 years):<\/p>\n<\/blockquote>\n<p>Okie dokie! Let&#8217;s do that!<\/p>\n<blockquote>\n<p>Expected number of trans shooters: 50 \u00d7 0.01 = 0.5.<\/p>\n<\/blockquote>\n<p>Yes.<\/p>\n<blockquote>\n<p>\nUsing a binomial calculator (or cumulative distribution function), we compute P(X ? k) for increasing k until p < 0.05:\n \t\n\n\n\n<li>For k = 2: P(X ? 2) ? 0.264 (not significant).<\/li>\n<li>For k = 3: P(X ? 3) ? 0.080 (not significant).<\/li>\n<li>For k = 4: P(X ? 3) ? 0.019 (significant at p < 0.05).<\/li>\n<p>Proportion: 4\/50 = 8%. So, if 8% or more of shooters are trans, the result is statistically significant.<\/p>\n<\/blockquote>\n<p><i>If<\/i> P(X ? 2) means what Joshua says it means &#8220;The probability of observing k or more trans shooters by chance&#8221;&#8211; the correct results for the calculation above should be:<\/p>\n<p>>  round(1-pbinom(c(2,3,4)-1,50,0.01),3)<br \/>\n[1] 0.089 0.014 0.002<\/p>\n<p>We can now replace Joshua&#8217;s numbers with the correct values and also correect the declarations of significance.<\/p>\n<li>For k = 2: P(X ? 2) ? 0.089 (not significant).<\/li>\n<li>For k = 3: P(X ? 3) ? 0.014 (significant at p < 0.05).<\/li>\n<li>For k = 4: P(X ? 3) ? 0.002 (significant at p < 0.05).<\/li>\n<p>Proportion: 3\/50 = 6%. So, if 6% or more of shooters are trans, the result is statistically significant.<\/p>\n<p>But maybe some of you don&#8217;t trust my R. So I can also ask Grok:<\/p>\n<blockquote>\n<p>Thanks! I&#8217;m going to divert a little to something &#8220;Joshua&#8221; claimed. He was interested in a coin that got 0.01 heads in a single flip. He wanted to flip it 50 times. And he wanted the probability of getting the following three things:<\/p>\n<p>&#8220;k or more&#8221; heads, for k values of 2, 3 and 4.<br \/>\nCan you give me those values? (You need not explain.)<\/p>\n<\/blockquote>\n<p>Initially, Lucia-Grok gave me ~ 0.091, 0.014, and 0.002.  Those did <i>not<\/i> exactly match my values from R, <i>but they were close<\/i>.  I told Grok what I got using R and asked it if it had approximated.  Grok gave me a long winded answer which ended with &#8220;The correct probabilities, using the binomial distribution, are: [..]  0.089 [..]    0.014 [..]. 0.002 . These match your R output.&#8221;<\/p>\n<p>Back to Joshua-Grok which repeats the analysis, but this time with a different number of shooters. The new sample size is n=100. <\/p>\n<blockquote>\n<p>\nSample Size: n = 100 (e.g., 10 shootings\/year \u00d7 10 years):Expected number: 100 \u00d7 0.01 = 1.<\/p>\n<p>Testing values of k:<\/p>\n<li>For k = 4: P(X ? 4) ? 0.189 (not significant).<\\li>\n<li>For k = 5: P(X ? 5) ? 0.081 (not significant).<\\li>\n<li>For k = 6: P(X ? 6) ? 0.029 (significant).<\\li><\/blockquote>\n<p>How do <I>these<\/i> match what I get with R?<br \/>\n> round(1-pbinom(c(4,5,6)-1,100,0.01),3)<br \/>\n[1] 0.018 0.003 0.001<\/p>\n<p>Correcting Joshua&#8217;s text we get:<\/p>\n<p>Sample Size: n = 100 (e.g., 10 shootings\/year \u00d7 10 years):Expected number: 100 \u00d7 0.01 = 1.<br \/>\nTesting values of k:<br \/>\nFor k = 4: P(X ? 4) ? 0.018 (significant).<br \/>\nFor k = 5: P(X ? 5) ? 0.003 (significant).<br \/>\nFor k = 6: P(X ? 6) ? 0.001 (significant).<\/p>\n<p>As before, I asked Grok to estimate.<\/p>\n<blockquote>\n<p>Joshua next moved on to a different claim . He now wanted to flip the same coin 100 times.  He wanted the probability of k or more heads for k values of 4, 5 and 6. Can you give me those?<\/p>\n<\/blockquote>\n<p>As before, Grok first used a Poisson estimate and returned (0.015, 0.003, and 0.001).<\/p>\n<p>So I asked &#8220;Did you do this exactly? Or are they approximated?&#8221;  It admitted to approximating and now returned these numbers as correct.  (0.018, 0.003, and 0.001).  These match my R values&#8211; which is not surprising because Grok hooked in R to do the calculation.  Grok even gives the code!<\/p>\n<p>Back to Grok answering Joshua: <\/p>\n<blockquote>\n<p>Proportion: 6\/100 = 6%. If 6% or more of shooters are trans, the result is significant.<\/p>\n<\/blockquote>\n<p>Well&#8230; except that 6 out of 100 was <b>not<\/b> the threshold for significance.  From the following we can see the threshold for significance is 4. So the correct proportion is 4%. <\/p>\n<p>Joshua-Grok now repeats but with n= 20 shooters! <\/p>\n<blockquote>\n<p>\nSample Size: n = 20 (e.g., 2 shootings\/year \u00d7 10 years): Expected number: 20 \u00d7 0.01 = 0.2.<\/p>\n<p>Testing values:For k = 2: P(X ? 2) ? 0.017 (significant).<\/p>\n<\/blockquote>\n<p>Grok says 0.017.   Let&#8217;s check:<\/p>\n<p>> round(1-pbinom(c(2)-1,20,0.01),3)<br \/>\n[1] 0.017<\/p>\n<p>Hey! The Joshua-Grok got a number right!!!!<\/p>\n<p>Joshua-Grok then generalizes its results. But bear in mind, Joshua-Grok&#8217;s conclusions for n=50 and n=100 are based on incorrect results for the cumulative probability.  So these generalizations are based on wrong numbers for those two cases.  Neverthless, quoting it:<\/p>\n<blockquote>\n<p>\n4. Generalizing the Threshold<\/p>\n<p>The required percentage decreases as the sample size increases because larger samples provide more statistical power. Roughly:<\/p>\n<li>For n = 20, you\u2019d need ~10% (2 trans shooters) to reach significance.<\/li>\n<li>For n = 50, you\u2019d need ~8% (4 trans shooters).<\/li>\n<li>For n = 100, you\u2019d need ~6% (6 trans shooters).<\/li>\n<\/blockquote>\n<p>If we use the correct numbers the above becomes:<\/p>\n<p>The required percentage decreases as the sample size increases because larger samples provide more statistical power. Roughly:<\/p>\n<li>For n = 20, you\u2019d need ~10% (2 trans shooters) to reach significance.<\/li>\n<li>For n = 50, you\u2019d need ~6% (3 trans shooters).<\/li>\n<li>For n = 100, you\u2019d need ~4% (4 trans shooters).<\/li>\n<p>Back to Joshua-Grok who continues:<\/p>\n<blockquote>\n<p>\nHowever, these percentages are sensitive to the sample size and the true population proportion. If the trans population is <b>0.5% instead of 1%<\/b>, the threshold percentages would be slightly <b>higher<\/b> (e.g., ~10% for n = 50), and if it\u2019s 2%, they\u2019d be <b>lower<\/b> (e.g., ~6% for n = 50).<\/p>\n<\/blockquote>\n<p>Bold mine. <\/p>\n<p><i>Of course<\/i> the percentages of shooters that would make us reject the hypothesis that trans become mass murders at the same rate as non-trans are sensitive to the number of mass shootings observed in a period and true population proportion of trans which may not be 1%.<\/p>\n<p>But, before we debate if the proportion of trans in the general population is doing, let&#8217;s discuss what Joshua-Groke claims. Focus on the part I made bold. As a generalization, something is backwards. Because if the proportion trans in the general population is <I>lower<\/i> than 1% the threshold percentage of shooters required to reach significance is <I>lower<\/i> than if the percentage of trans is  1%.  You don&#8217;t even need to do the numbers to know this.  After all, if there were 0.00001% trans in the general population, you&#8217;d marvel if 2 out of the 50 randomly draws of people were trans!   Likewise if the proportion of trans is higher, the threshold value to reject the proposition they commit mass murder at the same rate is higher. Say 50% were trans.  You would be unsurprised if 50% of the shooters were trans. That&#8217;s about what you would expect!<\/p>\n<p>So what <i>are<\/i> the right numbers for 0.005% trans?<\/p>\n<p>For the 0.5% trans, the threshold for 50 is 2, and 2\/50 is 4% not 10%.   For 2% trans the threshold is 4, and 4\/50 is 8%. Here&#8217;s the R.<\/p>\n<p>> round(1-pbinom(c(1,2,3,4)-1,50,0.005),3)<br \/>\n[1] 0.222 0.026 0.002 0.000<\/p>\n<p>> round(1-pbinom(c(1,2,3,4)-1,50,0.02),3)<br \/>\n[1] 0.636 0.264 0.078 0.018<\/p>\n<p>Ok&#8230; so I&#8217;ve also been replicating with Grok.  Naturally, I asked Grok. What does Grok say? <i>Now things get a little interesting.  <\/i><\/p>\n<h2>Turns out Grok makes mistakes!<\/h2>\n<blockquote>\n<p>Suppose the probability of heads on a single toss of a coin is 0.5%.  If we toss it 50 times, what is the probability that we would get &#8220;k&#8221;  or more heads. Please do this for k=c(1,2,and 3).<\/p>\n<\/blockquote>\n<p>Grok came back formatted nicely but basically told me c(0.221, 0.080 and 0.013).  It should be evident these do <I>not<\/i> match c(0.222 0.026 0.002). Grok conveniently also gave me R code to run for myself.<\/p>\n<p>I ran the code Grok gave me and told it the R code it supplies gives c(0.222 0.026 0.002). Those match my final numbers, not Grok&#8217;s.<\/p>\n<p>Grok redoes stuff, tells me his numbers and <i>accused me of having the wrong value for &#8220;p&#8221; or &#8220;n&#8221; stored.<\/i> His code snippet provided both values! So, as if!  So, I give Grok simpler code with &#8220;p&#8221; and &#8220;n&#8221; hard wired in. Once again, R returns my previous numbers. I tell Grok Grok still decides it&#8217;s right!!   It does post details of what it does.  I read that long, long long discussion and tell Grok,<\/p>\n<blockquote>\n<p>\nHmmm&#8230;. for P(X=1) you do P(X=1)=50*0.005*0.995^49.  Then you say that&#8217;s 0.14095.<\/p>\n<p>My R says<br \/>\n> 50*0.005*0.995^49<br \/>\n[1] 0.1955559\n<\/p>\n<\/blockquote>\n<p>It took a little more bullying on my part, but finally Grok found it&#8217;s mistake. It had computed  50*0.005*0.78271435 = 0.1409514, which is wrong.  Feel free to check.  Grok had stored that as a result and re-used that number for subsequent calculations. <\/p>\n<p>Interestingly, this is an incredibly unsophisticated mistake.  Grok was able to do  all sorts of nifty binomials, explain and so on. And then, just like any human, it is capable of the equivalent of a transcription error. Once it makes that error, and &#8220;writes that number down&#8221;, it just steam rolls ahead with the wrong number.<\/p>\n<p>Once it corrected its mistake, Grok replicates my numbers within rounding.<\/p>\n<blockquote>\n<p>Your output is essentially correct, and the differences are due to R\u2019s rounding behavior (e.g., 0.221199217 rounds to 0.222, 0.001158029 rounds to 0.002). My previous calculations for  k = 2, 3  were incorrect because I used an erroneous P(X = 1) ~~ 0.1409514 , likely from a miscalculation of  (0.995)^49 or a typo in my manual process.<\/p>\n<\/blockquote>\n<p>So, Grok can do great stuff. It can also go wrong and really stick to that.  You have to check things with R!<\/p>\n<h2>Returning from the Grok makes mistakes interlude<\/h2>\n<p>Yes, the results of the threshold value (whether by number of %) depends on the sample size and the probability&#8211; in the trans case, the proportion of trans in the population. Estimating either are actually very contentions matters; but Joshua tells me the proportion of trans is &#8220;(roughly 0.5-1.5%, per Gallup and Williams Institute estimates&#8221;.  Well, that&#8217;s a factor of 3. And is that range even wide enough? Who knows? <\/p>\n<p>As I previously wrote <a href=\"https:\/\/rankexploits.com\/musings\/2025\/heart-of-america-2025\/#comment-251692\">as I previously wrote  <\/a> when discussing analyzing data on the issue of whether or not trans individuals were more or less likely to commit mass murders of some sort, &#8216;Most of us actually touched on much of the \u201cmain\u201d problem in any statistical analysis which is we simply don\u2019t know numbers. There are some others\u2013 including cherry picking and also\u2026 I don\u2019t know it\u2019s name. It\u2019s not the texas sharp shooter. It\u2019s\u2026. something to do with picking the observation and then only doing the statistic because you saw that thing. \u2019   I guess that&#8217;s called &#8220;post hoc theorizing&#8221;.  <a href=\"https:\/\/en.wikipedia.org\/wiki\/Post_hoc_analysis\">Wikipedia says post hoc theorizing not so bad<\/a> as long as you recognize and admit you are doing it and don&#8217;t pretend the analysis is based on a pre-planned experiment.<\/p>\n<p>But at least now Joshua has suggested a &#8220;method&#8221;. I&#8217;m not sure he&#8217;ll continue to &#8220;like&#8221; it now that it gives answers he probably doesn&#8217;t like. And he&#8217;s suggested a range for p.  So, there is that. We can now apply the Joshua-Grok method (with correct numerical results) to other problems. Of course, we can also criticize the method.  I mean&#8230; &#8220;Why a one sided test?&#8221;  \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In comments, Joshua described, and so indirectly proposed, a statistical test one might use to determine whether a particular data set for the number of trans mass murders, k, out of a collection of n mass murders could be used to test the hypothesis that trans individuals commit mass murders at the same rate as &hellip; <a href=\"https:\/\/rankexploits.com\/musings\/2025\/statistical-test-described-by-joshua\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Statistical Test Described by Joshua<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-27246","post","type-post","status-publish","format-standard","hentry","category-data-comparisons"],"_links":{"self":[{"href":"https:\/\/rankexploits.com\/musings\/wp-json\/wp\/v2\/posts\/27246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rankexploits.com\/musings\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rankexploits.com\/musings\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rankexploits.com\/musings\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/rankexploits.com\/musings\/wp-json\/wp\/v2\/comments?post=27246"}],"version-history":[{"count":37,"href":"https:\/\/rankexploits.com\/musings\/wp-json\/wp\/v2\/posts\/27246\/revisions"}],"predecessor-version":[{"id":27287,"href":"https:\/\/rankexploits.com\/musings\/wp-json\/wp\/v2\/posts\/27246\/revisions\/27287"}],"wp:attachment":[{"href":"https:\/\/rankexploits.com\/musings\/wp-json\/wp\/v2\/media?parent=27246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rankexploits.com\/musings\/wp-json\/wp\/v2\/categories?post=27246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rankexploits.com\/musings\/wp-json\/wp\/v2\/tags?post=27246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}