### MYaseen208

Thoughts on statistics, Research, R, Python, LaTex, and other distractions.

# Subject ▸ Python

## Linear Model using Python

Python Basics Variables and Data Types Variable Assignment Calculations With Variables Types and Type Conversion Logical Operators Comparison If-Else Function Help Simple Linear Regression Multiple Linear Regression Polynomial Regression Regression with Dummy Variables Example 1 Example 2 Example 3 Regression with same slopes and different intercepts Regression with different slopes and different intercepts Python Basics Variables and Data Types Variable Assignment x = 5 x # dir(x) 5 Calculations With Variables x + 2 # Sum of two variables 7 x - 2 # Subtraction of two variables 3 x*2 # Multiplication of two variables 10 x**2 # Exponentiation of a variable 25 x%2 # Remainder of a variable 1 x/float(2) # Division of a variable 2.

## Regression Analysis with Python

Introduction Statistics Variable Measurement Measurement Scales Regression Analysis Simple Linear Regression Example Multiple Linear Regression Example Polynomial Regression Analysis Example Introduction In God we trust, all others must bring data. (W. Edwards Deming) In Data we trust, all others must bring data.   Statistics Statistics is the science of uncertainty & variability Statistics turns data into information Data -> Information -> Knowledge -> Wisdom Data Driven Decisions (3Ds) Statistics is the interpretation of Science Statistics is the Art & Science of learning from data   Variable Characteristic that may vary from individual to individual Height, Weight, CGPA etc   Measurement Process of assigning numbers or labels to objects or states in accordance with logically accepted rules   Measurement Scales Nominal Scale: Obersvations may be classified into mutually exclusive & exhaustive classes or categories Ordinal Scale: Obersvations may be ranked Interval Scale: Difference between obersvations is meaningful Ratio Scale: Ratio between obersvations is meaningful & true zero point   Regression Analysis Quantifying dependency of a normal response on quantitative explanatory variable(s)   Figure 1: Population Regression Function   Simple Linear Regression Quantifying dependency of a normal response on a quantitative explanatory variable  Example Weekly Income (\$) Weekly Expenditures (\$) 80 70 100 65 120 90 140 95 160 110 180 115 200 120 220 140 240 155 260 150 Income = [80, 100, 120, 140, 160, 180, 200, 220, 240, 260] Expend = [70, 65, 90, 95, 110, 115, 120, 140, 155, 150] import pandas as pd df1 = pd.