Posts

Showing posts from January, 2020

What Does Derivatives Mean in Real World

Image
Introduction to Derivatives It is all about slope! Slope =  Change in Y Change in X   We can find an  average  slope between two points.   But how do we find the slope  at a point ? There is nothing to measure!   But with derivatives we use a small difference ... ... then have it  shrink towards zero .   Let us Find a Derivative! To find the derivative of a function  y = f(x)  we use the slope formula: Slope =  Change in Y Change in X  =  Δy Δx And (from the diagram) we see that: x changes from   x to x+Δx y changes from   f(x) to f(x+Δx) Now follow these steps: Fill in this slope formula:  Δy Δx  =  f(x+Δx) − f(x) Δx Simplify it as best we can Then make  Δx  shrink towards zero. Like this: Example: the function  f(x) = x 2 We know  f(x) = x 2 , and we can calculate  f(x +Δx )  : Start with:   f(x +Δx ) = (x...

Introduction to Linear Regression

Image
Introduction to Linear Regression Author(s) David M. Lane Prerequisites Measures of Variability ,  Describing Bivariate Data Learning Objectives Define linear regression Identify errors of prediction in a scatter plot with a regression line In simple linear regression, we predict scores on one variable from the scores on a second variable. The variable we are predicting is called the  criterion variable  and is referred to as Y. The variable we are basing our predictions on is called the  predictor variable  and is referred to as X. When there is only one predictor variable, the prediction method is called  simple regression . In simple linear regression, the topic of this section, the predictions of Y when plotted as a function of X form a straight line. The example data in Table 1 are plotted in Figure 1. You can see that there is a positive relationship between X and Y. If you were going to predict Y from X, the higher the value of X, the...

Baye's Theorm

Image
Bayes' Theorem Bayes can do magic! Ever wondered how computers learn about people? Example: An internet search for "movie automatic shoe laces" brings up "Back to the future" Has the search engine watched the movie? No, but it knows from lots of other searches what people are  probably  looking for. And it calculates that probability using Bayes' Theorem. Bayes’ Theorem  is a way of finding a  probability  when we know certain other probabilities. The formula is: P(A|B) =  P(A) P(B|A) P(B) Which tells us:   how often A happens  given that B happens , written  P(A|B) , When we know:   how often B happens  given that A happens , written  P(B|A)     and how likely A is on its own, written  P(A)     and how likely B is on its own, written  P(B) Let us say P(Fire) means how often there is fire, and P(Smoke) means how often we see smoke, then: P(Fire|Smoke) means how...

Probabilities Review

Given: Totals = {20: 16576, 30: 16619, 40: 16632, 50: 16805, 60: 16664, 70: 16704} Purchases = {20: 3392, 30: 4974, 40: 6670, 50: 8319, 60: 9944, 70: 11713} totalPurchases = 45012 Sample size (total no. of people) =  100000.0 Purchases[30] : This means the number of persons at age 30 who did a purchase. Totals[30] : This means the total number of persons at age 30. - P(Age) The probability of 30's persons(P(30)): totals[30]/100,000 -P(Purchase) And P(Purchase) is the overall probability of buying something, regardless of your age: P(Purchase) = float(totalPurchases) / 100000.0 - P(Purchase|Age) : (نسبة الشراء في هذه الفئة العمرية) The probability of someone in their 30's buying something P(Purchase|30) =  total_persons_of_30s_did_purchase/total_Persons_Of_Age_30 = purchases[30]/totals[30] -P(Purchase, Age) :  [comma means both and when we say both we mean according to total population] (نسبة شراء هذه الفئة العمرية بالنسبة للمجتمع ككل) The pr...

Conditional Probability

Image

How to Measure the Covariance and Correlation of Data Samples

Image
When comparing data samples from different populations, two of the most popular measures of association are  covariance  and  correlation . Covariance and correlation show that variables can have a positive relationship, a negative relationship, or no relationship at all. A sample is a randomly chosen selection of elements from an underlying population. Sample covariance measures the strength and the direction of the relationship between the elements of two samples, and the sample correlation is derived from the covariance. The sample covariance between two variables,  X  and  Y ,  is Here’s what each element in this equation means: s XY  = the sample covariance between variables  X  and  Y  (the two subscripts indicate that this is the sample covariance, not the sample standard deviation). n  = the number of elements in both samples. i  = an  index  that assigns a number to each samp...

Important Anaconda Statistics Functions

Image
Percentile: - In a dataset, what is the point at which x% of the values are less than that value? - Percentile(values, 50) is another name for the mean value. Skew: How "lopsided" ( with one side lower or smaller than the other ) is the distribution. kurtosis: - How thick is the tail, and how sharp is the peak compared to a normal distribution. - Higher peaks have higher kurtosis.

The Uniform Distribution (Rectangular Distribution), Cumulative Uniform Distribution (CDF), and The Probability Density Function

Image
Random Variables - Continuous A Random Variable is a set of  possible values  from a random experiment. Example: Tossing a coin: we could get Heads or Tails. Let's give them the values  Heads=0  and  Tails=1  and we have a Random Variable "X": In short: X = {0, 1} Note: We could choose Heads=100 and Tails=150 or other values if we want! It is our choice. Continuous Random Variables can be either  Discrete or Continuous : Discrete Data can only take certain values (such as 1,2,3,4,5) Continuous Data can take any value within a range (such as a person's height) In our Introduction to  Random Variables  (please read that first!) we look at many examples of Discrete Random Variables. But here we look at the more advanced topic of  Continuous Random Variables. The Uniform Distribution The Uniform Distribution (also called the Rectangular Distribution) is the simplest distribution. It has equal probability fo...