Mikel  Okuneva

Mikel Okuneva

1596906000

Taking on T-Tests with SciPy

Ah T-Tests, one of the many ways to determine statistical significance. But what exactly are they? And how exactly does everything work?

T-Tests, otherwise known as a Student’s T-Test, are a simple way to compare averages between two groups to assess whether or not they are different from each other. They are frequently used when one either does not know the true population standard deviation, or if the sample size is small. This is all done assuming that the data is normally distributed.

There are two kinds of T-Tests, a one-tailed T-Test, and a two-tailed T-Test.

one-tailed T-Test is used to determine if the mean of one group is much higher than the other, or much lower, depending on which you select. Only one is selected for the test.

On the other hand, a two-tailed T-Test is used to see if mean of one group is higher or lower than the other group.

Image for post

Image for post

A One-Tailed(left) and a Two-Tailed(right) T-Test. Source: UCLA: Statistical Consulting Group

one group is higher or lower than the other group.

Image for post

A small cup of coffee

To start, you have to actually gain a basic understanding of your data. Once you do, you’ll know what questions to ask, and then determine your null and alternative hypothesis, 𝐻0 and 𝐻1 respectively.

For example, a company is trying to use a new process of brewing coffee that results in less acidity. What kind of test is used for this?

That’s right, a one-tailed T-Test! So, let’s say that the population mean of the new coffee, or 𝜇 (pronounced “mew”), is 4.4 ph. We will be estimating this using the sample mean, x̄ (x-bar).

First, we’re going to set 𝐻0 and 𝐻1. For our null hypothesis, we’re going to assume that there will be no difference in acidity, and for the alternative hypothesis we will state that the new coffee’s acidity will be lower than standard coffee.

In more mathematical terms:

𝐻0:𝜇=4.4

𝐻1:𝜇<4.4

Next, we need to determine the alpha value, 𝑎, so that we can compare it to the resulting P-Value and determine if our results are statistically significant.

Wait, what the heck are those?!

The alpha value is how much risk we’re willing to take when it comes to the probability of the experiment returning a false positive (we falsely reject the null hypothesis) or a false negative (we falsely fail to reject the null hypothesis). The lower 𝑎a is, the lower the chance of a false positive. However, if an alpha value is too low then you risk getting a false negative! Typically, 𝑎 is set to 0.05 or 0.01, 5% or 1% risk.

Simplified, the P-Value is the probability of seeing a sample statistic at least as extreme as the one observed assuming 𝐻0 is true.

A low P-Value indicates that it is unlikely that the results you obtained from your experiment happened by chance, while inversely a high P-Value suggests that it is likely that your results did happen due to natural variation.

For the coffee experiment, we’ll just set 𝑎 to 0.05.

Now we can begin our experiments! Or more accurately in this case, grab the example experiment data and check it out. Our coffee company only made 100 cups of coffee using this new method, so this is a pretty good sample size!

Note that that as the number of samples, 𝑛n, becomes larger, the resulting distribution of the mean will reach a more distinct bell curve shape! This applies no matter what the initial sample or population distribution actually was. This is called Central Limit Theorem, and you can read more about it here and here!

#statistics #t-test #taking

What is GEEK

Buddha Community

Taking on T-Tests with SciPy

How to Bash Read Command

Bash has no built-in function to take the user’s input from the terminal. The read command of Bash is used to take the user’s input from the terminal. This command has different options to take an input from the user in different ways. Multiple inputs can be taken using the single read command. Different ways of using this command in the Bash script are described in this tutorial.

Syntax

read [options] [var1, var2, var3…]

The read command can be used without any argument or option. Many types of options can be used with this command to take the input of the particular data type. It can take more input from the user by defining the multiple variables with this command.

Some Useful Options of the Read Command

Some options of the read command require an additional parameter to use. The most commonly used options of the read command are mentioned in the following:

OptionPurpose
-d <delimiter>It is used to take the input until the delimiter value is provided.
-n <number>It is used to take the input of a particular number of characters from the terminal and stop taking the input earlier based on the delimiter.
-N <number>It is used to take the input of the particular number of characters from the terminal, ignoring the delimiter.
-p <prompt>It is used to print the output of the prompt message before taking the input.
-sIt is used to take the input without an echo. This option is mainly used to take the input for the password input.
-aIt is used to take the input for the indexed array.
-t <time>It is used to set a time limit for taking the input.
-u <file descriptor>It is used to take the input from the file.
-rIt is used to disable the backslashes.

 

Different Examples of the Read Command

The uses of read command with different options are shown in this part of this tutorial.

Example 1: Using Read Command without Any Option and variable

Create a Bash file with the following script that takes the input from the terminal using the read command without any option and variable. If no variable is used with the read command, the input value is stored in the $REPLY variable. The value of this variable is printed later after taking the input.

#!/bin/bash  
#Print the prompt message
echo "Enter your favorite color: "  
#Take the input
read  
#Print the input value
echo "Your favorite color is $REPLY"

Output:

The following output appears if the “Blue” value is taken as an input:

Example 2: Using Read Command with a Variable

Create a Bash file with the following script that takes the input from the terminal using the read command with a variable. The method of taking the single or multiple variables using a read command is shown in this example. The values of all variables are printed later.

#!/bin/bash  
#Print the prompt message
echo "Enter the product name: "  
#Take the input with a single variable
read item

#Print the prompt message
echo "Enter the color variations of the product: "  
#Take three input values in three variables
read color1 color2 color3

#Print the input value
echo "The product name is $item."  
#Print the input values
echo "Available colors are $color1, $color2, and $color3."

Output:

The following output appears after taking a single input first and three inputs later:

Example 3: Using Read Command with -p Option

Create a Bash file with the following script that takes the input from the terminal using the read command with a variable and the -p option. The input value is printed later.

#!/bin/bash  
#Take the input with the prompt message
read -p "Enter the book name: " book
#Print the input value
echo "Book name: $book"

Output:

The following output appears after taking the input:

Example 4: Using Read Command with -s Option

Create a Bash file with the following script that takes the input from the terminal using the read command with a variable and the -s option. The input value of the password will not be displayed for the -s option. The input values are checked later for authentication. A success or failure message is also printed.

#!/bin/bash  
#Take the input with the prompt message
read -p "Enter your email: " email
#Take the secret input with the prompt message
read -sp "Enter your password: " password

#Add newline
echo ""

#Check the email and password for authentication
if [[ $email == "admin@example.com" && $password == "secret" ]]
then
   #Print the success message
   echo "Authenticated."
else
   #Print the failure message
   echo "Not authenticated."
fi

Output:

The following output appears after taking the valid and invalid input values:

Example 5: Using Read Command with -a Option

Create a Bash file with the following script that takes the input from the terminal using the read command with a variable and the -a option. The array values are printed later after taking the input values from the terminal.

#!/bin/bash  
echo "Enter the country names: "  
#Take multiple inputs using an array  
read -a countries

echo "Country names are:"
#Read the array values
for country in ${countries[@]}
do
    echo $country
done

Output:

The following output appears after taking the array values:

Example 6: Using Read Command with -n Option

Create a Bash file with the following script that takes the input from the terminal using the read command with a variable and the -n option.

#!/bin/bash  
#Print the prompt message
echo "Enter the product code: "  
#Take the input of five characters
read -n 5 code
#Add newline
echo ""
#Print the input value
echo "The product code is $code"

Output:

The following output appears if the “78342” value is taken as input:

Example 7: Using Read Command with -t Option

Create a Bash file with the following script that takes the input from the terminal using the read command with a variable and the -t option.

#!/bin/bash  
#Print the prompt message
echo -n "Write the result of 10-6: "  
#Take the input of five characters
read -t 3 answer

#Check the input value
if [[ $answer == "4" ]]
then
   echo "Correct answer."
else
   echo "Incorrect answer."
fi

Output:

The following output appears after taking the correct and incorrect input values:

Conclusion

The uses of some useful options of the read command are explained in this tutorial using multiple examples to know the basic uses of the read command.

Original article source at: https://linuxhint.com/

#bash #command 

Tủ locker

Tủ locker dòng W900 là sản phẩm có thể xếp chồng lên được 3 tầng cho 1 cột, có thể kết hợp nhiều cột tủ lại với nhau theo mong muốn (không giới hạn số lượng cột tủ)

#tủ_locker #tủ_sắt_locker #locker #tu_sat_locker #tu_locker #tủ_locker_sắt #tủ_nhân_viên #tu_locker_sat #tủ_locker_giá rẻ #tu_locker_gia_re #tủ_cá_nhân_locker #tủ_sắt_nhiều_ngăn #tủ_đựng_đồ_nhân_viên

Website: 

tủ locker

tủ locker giá rẻ

tu locker gia re

tủ cá nhân locker

tủ sắt nhiều ngăn


 

Smart Locker

APROP đã tin tưởng chọn Smart Locker là đơn vị đồng hành trong việc triển khai lắp đặt hệ thống Smart Locker Wireless với công nghệ hiện đại để phục vụ việc gửi/ nhận hồ sơ cho văn phòng.

#tủ_locker #tủ_sắt_locker #locker #tu_sat_locker #tu_locker #tủ_locker_sắt #tủ_nhân_viên #tu_locker_sat #tủ_locker_giá rẻ #tu_locker_gia_re #tủ_cá_nhân_locker #tủ_sắt_nhiều_ngăn #tủ_đựng_đồ_nhân_viên

Website: 

tủ locker

tủ locker

tủ sắt locker

locker

tu sat locker


 

tu locker

1635748246

Sự hiện diện của giải pháp Smart Locker, như một nâng tầm dịch vụ, sẽ giúp khách hàng chứa đựng tư trang trước khi thoải mái tận hưởng thời gian mua sắm.

#tủ_locker #tủ_sắt_locker   #locker #tu_sat_locker #tu_locker #tủ_locker_sắt #tủ_nhân_viên #tu_locker_sat #tủ_locker_giá rẻ #tu_locker_gia_re #tủ_cá_nhân_locker #tủ_sắt_nhiều_ngăn #tủ_đựng_đồ_nhân_viên

Website: 

locker

tủ sắt nhiều ngăn

tủ đựng đồ nhân viên

tủ locker

tủ sắt locker


 

locker

Tủ thông minh giúp tăng đáng kể thời gian lao động cá nhân và đơn giản khâu vận hành. Công nghệ điện tử và điện thoại thông minh được sử dụng nhằm hạn chế lãng phí nguồn lực. 

#tủ_locker #tủ_sắt_locker #locker #tu_sat_locker #tu_locker #tủ_locker_sắt #tủ_nhân_viên #tu_locker_sat #tủ_locker_giá rẻ #tu_locker_gia_re #tủ_cá_nhân_locker #tủ_sắt_nhiều_ngăn #tủ_đựng_đồ_nhân_viên

Website: 

ilocker

tu locker sat

tủ locker giá rẻ

tu locker gia re

tủ cá nhân locker