Question

In: Statistics and Probability

Generate 7 integers with equal probability from a function which returns 1/10 with probability P and...

  1. Generate 7 integers with equal probability from a function which returns 1/10 with probability P and (1-P)
  2. What are the ROC curve and meaning of sensitivity, specificity, confusion matrix
  3. What is the definition of a P-value? How to explain p-value to customers

Solutions

Expert Solution

(1)

We use discrete uniform distribution with parameters (a=1 and b=10) to generate 7 integers with equal probability from a function which returns 1/10 i.e., probability p=1/10.

The shorthand X ∼ Discrete Uniform (a, b) is used to indicate that the random variable X has the discrete uniform distribution with integer parameters a and b, where a < b. A discrete uniform random variable X with parameters a and b has probability mass function

P(x)=1/(b-a+1),    x=a, a+1, a+2,…,b

Using R software we have generated 7 integers with equal probability from a function which returns 1/10 as (7, 5, 2, 4, 8, 3, 6).

# R code to generate 7 integers with equal probability from a function which returns 1/10 .

require(extraDistr)

rdunif(n=7, min=1, max=10)       # Discrete uniform, a=1, b=10

In order to test whether our procedure is true or not, we generate 10,0000 numbers from the same model and see the probability of each generated number, it will be close to 1/10.

prop.table(table(rdunif(n=10000, min=1, max=10)))

(2)

Receiver Operating Characteristic (ROC) Curve:

A Receiver Operating Characteristic (ROC) Curve is a way to compare diagnostic tests. It is a plot of the true positive rate against the false positive rate.

A ROC plot shows:

· The relationship between sensitivity and specificity. For example, a decrease in sensitivity results in an increase in specificity.

· Test accuracy; the closer the graph is to the top and left-hand borders, the more accurate the test. Likewise, the closer the graph to the diagonal, the less accurate the test. A perfect test would go straight from zero up the top-left corner and then straight across the horizontal.

· The likelihood ratio; given by the derivative at any particular cutpoint.

Test accuracy is also shown as the area under the curve (which you can calculate using integral calculus). The greater the area under the curve, the more accurate the test. A perfect test has an area under the ROC curve (AUROCC) of 1. The diagonal line in a ROC curve represents perfect chance. In other words, a test that follows the diagonal has no better odds of detecting something than a random flip of a coin. The area under the diagonal is 0.5 (half of the area of the graph). Therefore, a useless test (one that has no better odds than chance alone) has a AUROCC of 0.5.

A ROC curve showing two tests. The red test is closer to the diagonal and is therefore less accurate than the green test.

Sensitivity:

The sensitivity of a test (also called the true positive rate) is defined as the proportion of people with the disease who will have a positive result. In other words, a highly sensitive test is one that correctly identifies patients with a disease. A test that is 100% sensitive will identify all patients who have the disease. It’s extremely rare that any clinical test is 100% sensitive. A test with 90% sensitivity will identify 90% of patients who have the disease, but will miss 10% of patients who have the disease.

Specificity:

The specificity of a test (also called the True Negative Rate) is the proportion of people without the disease who will have a negative result. In other words, the specificity of a test refers to how well a test identifies patients who do not have a disease. A test that has 100% specificity will identify 100% of patients who do not have the disease. A test that is 90% specific will identify 90% of patients who do not have the disease.

Tests with a high specificity (a high true negative rate) are most useful when the result is positive.

Confusion matrix:

A confusion matrix, in predictive analytics, is a two-by-two table that tells us the rate of false positives, false negatives, true positives and true negatives for a test or predictor. We can make a confusion matrix if we know both the predicted values and the true values for a sample set.

In machine learning and statistical classification, a confusion matrix is a table in which predictions are represented in columns and actual status is represented by rows. Sometimes this is reversed, with actual instances in rows and predictions in columns. The table is an extension of the confusion matrix in predictive analytics, and makes it easy to see whether mislabeling has occurred and whether the predictions are more or less correct.

(3)

P-value:

P-value is the observed level of significance. It is the probability that the difference is by chance in hypothesis testing. For example, if we have to compare average sales of two shops, if the p-value is <0.05 (level of significance), it means the difference is not only due to chance but it is statistically significant. P-value >0.05 (given level of significance) means that the difference is merely due to chance and no significant difference is there.

In other words, in statistical hypothesis testing, the p-value or probability value is, for a given statistical model, the probability that, when the null hypothesis is true, the statistical summary (such as the absolute value of the sample mean difference between two compared groups) would be greater than or equal to the actual observed results.


Related Solutions

Let P be the uniform probability on the integers from 1 to 99. Let B be...
Let P be the uniform probability on the integers from 1 to 99. Let B be the subset of numbers which have the digit 3. Let A be the subset of even numbers. What is P(A), P(B)? What is P(A|B)? P(B|A)?
The language is MATLAB Write a function that will generate three random integers, each in the...
The language is MATLAB Write a function that will generate three random integers, each in the inclusive range from 10 to 80. It will then return a string consisting of the three integers joined together, and also a character vector consisting of the three integers joined together. For example, if the random integers are 11, 29, and 76, the string that is returned will be "112976" and the character vector that is returned will be '112976'. I'm really confused on...
In Haskell Write a function equal that returns whether two sets are equal. equal :: Set...
In Haskell Write a function equal that returns whether two sets are equal. equal :: Set -> Set -> Bool
a)The demand function for a product is modeled by p = 12,000 1 − 7 7...
a)The demand function for a product is modeled by p = 12,000 1 − 7 7 + e−0.001x . Find the price p (in dollars) of the product when the quantity demanded is x = 1000 units and x = 1500 units. What is the limit of the price as x increases without bound?   x = 1000 units (Round your answer to two decimal places.)____$   x = 1500 units (Round your answer to two decimal places.)___$ What is the limit...
Write a program that uses a custom function to generate a specified number of random integers...
Write a program that uses a custom function to generate a specified number of random integers in a specified range. This custom function should take three arguments; the number of integers to generate, the lower limit for the range, and the upper limit for the range. Values for these arguments should be entered by the user in main. The custom function should display the random integers on one line separated by single spaces. The function should also report how many...
USING PYTHON, write a function that takes a list of integers as input and returns a...
USING PYTHON, write a function that takes a list of integers as input and returns a list with only the even numbers in descending order (Largest to smallest) Example: Input list: [1,6,3,8,2,5] List returned: [8, 6, 2]. DO NOT use any special or built in functions like append, reverse etc.
Write a function that receives a StaticArray with integers and returns a new StaticArray object with...
Write a function that receives a StaticArray with integers and returns a new StaticArray object with the content from the original array, modified as follows: 1) If the number in the original array is divisible by 3, the corresponding element in the new array should be a string ‘fizz’. 2) If the number in the original array is divisible by 5, the corresponding element in the new array should be a string ‘buzz’. 3) If the number in the original...
Say I want to generate random variables from the probability distribution p={ 2-2x 0<x<1 0 ....
Say I want to generate random variables from the probability distribution p={ 2-2x 0<x<1 0 . elsewhere My scheme is to generate U's from [0,1],double them and plug them into the probability distribution. So U = 0.3 gives me p(0.6)=0.8 as random variable. Prove my idea is right or wrong.
One dimensional dynamic array Write a function that returns the number of integers in an input...
One dimensional dynamic array Write a function that returns the number of integers in an input file stream with the following interface: int findNumber(ifstream &x); Then, use this number to dynamically allocate an integer array. Write another function that reads each number in an input file stream and assign the value to the corresponding array element with the following interface: void assignNumber(ifstream &x, int y[ ]); In your main( ), first open “in.dat” as an input file. Next, apply findNumber(...
Python: Write a function that receives a one dimensional array of integers and returns a Python...
Python: Write a function that receives a one dimensional array of integers and returns a Python tuple with two values - minimum and maximum values in the input array. You may assume that the input array will contain only integers and will have at least one element. You do not need to check for those conditions. Restrictions: No built-in Python data structures are allowed (lists, dictionaries etc). OK to use a Python tuple to store and return the result. Below...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT