085: Chi-square test and Bayes' theorem
Mountain paths with winding paths.
Li Luogen's house looked very close, and it felt like it was on the opposite hillside, but it took Kong Shucheng and Li Ruiyun seven or eight minutes to go around a wooden bridge by the lake.
Just when the two of them were about to arrive at the door of Li Luogen's house, a fat and strong black dog suddenly came out of the bamboo forest next to them. The big dog like a black tiger moved very quickly, rushing towards Kong Shucheng in front of him.
Suddenly, Li Ruiyun shouted: "Chi Fang, are you stupid? I don't even know me anymore?"
The big black dog, after hearing the familiar voice, immediately stopped attacking, turned to Li Ruiyun, and wagged its tail happily. At this moment, Kong Shucheng had already been scared out of a cold sweat by it.
Li Ruiyun squatted down slightly and patted the big black dog gently: "Go, Chi Fang, while playing." ”
Kong Shucheng stood aside and ate the melon in fear.
Li Ruiyun smiled at him: "Don't be afraid, it looks scary." ”
Kong Shucheng straightened his chest: "Hehe, I'm generally not afraid of dogs, but it looks really fierce, and it feels like a square face, like a black tiger." Oh yes, what did you just call it?"
"Chi-square, its name is Chi-square. ”
"Chi-square?"
Kong Shucheng felt that this name was a bit unique. It sounds familiar, but I can't remember where I've heard it.
"It's the name that my uncle gave it. My uncle said that its dog head looks a little square, as if it has been stuck by the door, so I call it Chi-square. Oh yes, Kong Shucheng, did you know that the chi-square test is still a mathematical term?"
"Mathematical terminology?"
Li Ruiyun smiled: "Yes." Chi-square test is actually a very widely used hypothesis testing method, which is generally used in statistical inference of categorical data. These include: chi-square test for comparison of two rates or two component ratios, chi-square test for comparison of multiple rates or multiple component ratios, and correlation analysis of categorical data. In fact, it is very simple, the chi-square test is the degree of deviation between the actual observed value and the theoretical inferred value of the statistical sample, and the degree of deviation between the actual observed value and the theoretical inferred value determines the size of the chi-square value........."
"Professor Li, don't say it, I don't know what 'comparison' is, I just know that I'm stupid. ”
"Uh........."
Li Ruiyun smiled awkwardly, the explanation of the "chi-square test" is indeed beyond the norm for Kong Shucheng.
Kong Shucheng: "Professor Li, to be honest, I have only watched one movie starring Uncle Ge, called "Carla is a Dog". But I never expected that Chifang was also a dog. ”
"Haha, Kong Shucheng, you're really funny. Oh yes, don't call me Professor Li in the future, it sounds so old-fashioned. Besides, I didn't get to that point. As he spoke, Li Ruiyun knocked on the mahogany door of his uncle's house.
"Knock knock, knock knock"
Seconds later.........
In the inner courtyard, there was a sound of slippers, from far and near.
"Who?"
A sound of snorting that hadn't woken up from a big sleep came from inside the door.
"Uncle, it's me. ”
"Oh, it's Xiaoyun, why did you arrive so late?"
Uncle Li Luogen came to the door, but he didn't rush to open the door.
After five or six seconds, the door still didn't open.
“.........”
Kong Shucheng was curious.
People are coming, why don't they open the door?
Could it be that the uncle inside the door is not well-dressed, and he is ashamed to see people?
Kong Shucheng turned his head to look at Li Ruiyun next to him, and was about to speak, when he saw her suddenly put her finger to her mouth: "Shhh, don't make a sound, my uncle won't open the door now." ”
"Why?"
"He's going to trick me. ”
"Huh? he'......... How can he be tricky?"
"Every time he came, he would hang me out the door and ask me to answer him a question. If I get it right, he'll open the door. ”
"So, what if you want to answer incorrectly?"
"WeChat sends red envelopes, with a minimum guarantee of 10 yuan, and the uncle will open the door for me. ”
“.........”
Kong Shucheng was speechless.
In my mind, a famous sentence of Zhuge Kongming Dou Wang Lang echoed - "I have never seen such a brazen person". The little niece has just come back from out of town, and she has come to visit her uncle in the stars and moons, and the uncle still wants to extort red envelopes?
While thinking about it, the "brazen" uncle inside the door began to ask questions: "Xiaoyun, let's say you are a female bandit." ”
Li Ruiyun snorted coldly: "Uncle, you come again, I was a female bandit last time." ”
"I'm just assuming. ”
"If it doesn't work, why can't I always be a bandit, can't I be a heroine?"
"Well, let's say you're a well-known heroine who accidentally stole a bandit's den. ”
"Am I so tasteless?"
"Please continue to listen to the questions, otherwise the red envelope will be doubled. ”
"Okay. ”
"Classmate Xiaoyun, as the leader of the bandits' den, I recently heard that the officers and soldiers have also changed their commanders, and they may be coming to suppress the bandits. So you're scared. ”
"I'm little Li Feiyun, I'm not afraid of the sky and the earth. ”
"No, you're really scared this time. Because the other party's new commander is very powerful, he can wear Yang in a hundred steps and step on Ruiyun. ”
"Foot on Ruiyun? Okay, I'm scared!"
"Well, that's good! It's good to know that you're afraid! As a female bandit, you send the second leader to find out the news and see if the other party is really going to attack the mountain. Soon, the second leader in charge of the investigation returned, and he said that the officers and soldiers would not come, because the mother of the new commander was sick and was going home to visit the doctor. Excuse me, female bandit Xiaoyun, assuming that the officers and soldiers come once in 5 years, at this time, should you believe the words of the second leader?"
Li Ruiyun took a deep breath: "Uncle, which method do you want me to use to calculate?"
"Just use the simplest Bayesian theorem. ”
"Well, you're annoying......... Bayes' theorem again. ”
Li Ruiyun stood at the door of his uncle's house, immediately twisted his fingers, and began to calculate: "Assuming that the officers and soldiers come once every five years, then the probability of coming this year is 20 percent, and the second leader who sent out says that the officers and soldiers will not come, then the probability of coming this year is 0; if the second leader is a thief and a natural villain, then the probability of him telling a lie is 70 to 80 percent, and if it is calculated at 75 percent, then the probability of him telling the truth is 25 percent." If he tells the truth, he says that the probability that the officers and soldiers will not come is 25% * 80% = 20%, and if he says that the officers and soldiers will come, then the probability that the officers and soldiers will come is 25% 820% = 5%; if he says a lie and he says that the officers and soldiers will not come, then the probability that the officers and soldiers will come is 75% * 20% = 15%, and he says that the officers and soldiers will come, then the probability of the officers and soldiers coming is 75% * 80% = 60%.................. This time, the second leader kept saying that the officers and men would not come, so according to the results of the fifth calculation, the probability that the officers and men would come was 15 percent, and the probability that they would not come was 20 percent. The final ratio is: come/don't come = 15/20 = 3/4. In other words, the probability of coming is 3/7 = 42.86%, and the probability of not coming is 4/7 = 57.4%. ”
After saying a lot of crackling, Li Ruiyun was also a little out of breath.
Kong Shucheng next to him has a cute face.
What "female bandits", what "come and don't come", what "Bayesian theorem".........
Why did he suddenly feel that it was time for him to drink "six walnuts" again?
..................