## Simple Or Linear Regression Line Tutorial

### Regression Definition:

A regression is a statistical analysis assessing the association between two variables. It is used to find the relationship between two variables.

#### Regression Formula:

Regression Equation(y) = a + bx Slope(b) = (NΣXY - (ΣX)(ΣY)) / (NΣX2 - (ΣX)2) Intercept(a) = (ΣY - b(ΣX)) / N Where,
x and y are the variables. b = The slope of the regression line a = The intercept point of the regression line and the y axis. N = Number of values or elements X = First Score Y = Second Score ΣXY = Sum of the product of first and Second Scores ΣX = Sum of First Scores ΣY = Sum of Second Scores ΣX2 = Sum of square First Scores

### Regression Example:

To find the Simple/Linear Regression of
X ValuesY Values
603.1
613.6
623.8
634
654.1
To find regression equation, we will first find slope, intercept and use it to form regression equation.
###### Step 1:
Count the number of values. N = 5
###### Step 2:
Find XY, X2 See the below table
X ValueY ValueX*YX*X
603.160 * 3.1 = 18660 * 60 = 3600
613.661 * 3.6 = 219.661 * 61 = 3721
623.862 * 3.8 = 235.662 * 62 = 3844
63463 * 4 = 25263 * 63 = 3969
654.165 * 4.1 = 266.565 * 65 = 4225
###### Step 3:
Find ΣX, ΣY, ΣXY, ΣX2. ΣX = 311 ΣY = 18.6 ΣXY = 1159.7 ΣX2 = 19359
###### Step 4:
Substitute in the above slope formula given. Slope(b) = (NΣXY - (ΣX)(ΣY)) / (NΣX2 - (ΣX)2) = ((5)*(1159.7)-(311)*(18.6))/((5)*(19359)-(311)2) = (5798.5 - 5784.6)/(96795 - 96721) = 13.9/74 = 0.19
###### Step 5:
Now, again substitute in the above intercept formula given. Intercept(a) = (ΣY - b(ΣX)) / N = (18.6 - 0.19(311))/5 = (18.6 - 59.09)/5 = -40.49/5 = -8.098
###### Step 6:
Then substitute these values in regression equation formula Regression Equation(y) = a + bx = -8.098 + 0.19x. Suppose if we want to know the approximate y value for the variable x = 64. Then we can substitute the value in the above equation. Regression Equation(y) = a + bx = -8.098 + 0.19(64). = -8.098 + 12.16 = 4.06 This example will guide you to find the relationship between two variables by calculating the Regression from the above steps.

## How To Fix : Error : 40 – could not open a connection to SQL server

An error has occurred while establishing a connection to the server when connecting to SQL server 2005, this failure may be caused by the fact that under default settings SQL server does not allow remote connection. ( provider: Named Pipes Provider, error: 40 – could not open a connection to SQL server. )

Suggestion 1: From Dhaval
Go to Control Panel -> Administrative Tools -> Computer Management : Open It
Expand Services And Application-> SQL Server Configuration Manager->SQL Native Client Configuration
Check Aliases Option Under.
If you find any aliases for the SQL Server that you are getting problem. Delete it for time being and test it.
Suggestion 2: From Imran
Try checking these things,
1. Check SQL Server Browser service is running and is kept in automatic Start mode.
This can be checked by.
Start -> run- > type services.msc -> enter -> check for SQL Server browser service, and start if it is not running.
2. Under SQL Server Surface Area Configuration check if SQL Server allows remote connections, by default it will allow only local connections.
This can be checked by,
Login to Server ( Where SQL Server is installed )
Start-> allprograms -> Microsoft SQL Server 2005->Configuration Tools -> SQL Server Surface Area configuration -> Click Server Area configuration for Services and connections ->choose your sql server – remote connections -> on the right side, choose allow remote connections to this server and choose both TCP/IP and NamedPipes.
3. Or Check your Windows Firewall, if SQL Server is being blocked, try to disable Firewall and then connect if it works then problem could be WIndows firewall.
Suggestion 3: From Emeka
There are couple of ways to troubleshoot this problem. The one you should use depends on how your databse server was configured and some other factors as well.
For example, if you configure the database engine to use dynamic port allocation, make sure that sql browser is runnning. SQL browser provides the connection information about the database engine to the the client.
If the sql browser is not running and you have restarted sql server and port 1433 is being used by other applications, database engine will be allocated a different port number. Imagine that the client has been configured to use port 1433 to connect and the database engine is using a different port number. The client wont be get the connections properties to the database engine from sql browser because sql browser is not running.
To avoid this type of problems, when the database engine has been configured to use dynamic ports, make sure that your sql browser is always running.
If you have found any other solution to this problem, please let me know and I will add it here.

## What is a  Tick Size

A tick size is the minimum price movement of a trading instrument. The price movements of different trading instruments varies. For example, if the minimum price movement of a stock is 0.01; the stock has a tick value of one cent (each tick is worth one cent for one stock). Futures markets typically have a tick size that is specific to the instrument. For example, the Russell 2000 e-mini futures contract (TF) has a tick size of .10; the value of each tick is \$10.00 (each contract is worth \$100 multiplied by the index).

## How To Transfer Chart To Another Chart In VB.NET Chart

### Example:

Dim myStream As New System.IO.MemoryStream()
Chart1.Serializer.Save(myStream)

# SQL Joins

SQL joins are used to combine rows from two or more tables.

## SQL JOIN

An SQL JOIN clause is used to combine rows from two or more tables, based on a common field between them.
The most common type of join is: SQL INNER JOIN (simple join). An SQL INNER JOIN returns all rows from multiple tables where the join condition is met.
Let's look at a selection from the "Orders" table:
OrderIDCustomerIDOrderDate
1030821996-09-18
10309371996-09-19
10310771996-09-20
Then, have a look at a selection from the "Customers" table:
CustomerIDCustomerNameContactNameCountry
1Alfreds FutterkisteMaria AndersGermany
3Antonio Moreno TaqueríaAntonio MorenoMexico
Notice that the "CustomerID" column in the "Orders" table refers to the "CustomerID" in the "Customers" table. The relationship between the two tables above is the "CustomerID" column.
Then, if we run the following SQL statement (that contains an INNER JOIN):

### Example

SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders
INNER JOIN Customers
ON Orders.CustomerID=Customers.CustomerID;
it will produce something like this:
OrderIDCustomerNameOrderDate
10365Antonio Moreno Taquería11/27/1996
10383Around the Horn12/16/1996
10355Around the Horn11/15/1996
10278Berglunds snabbköp8/12/1996

## Different SQL JOINs

Before we continue with examples, we will list the types of the different SQL JOINs you can use:
• INNER JOIN: Returns all rows when there is at least one match in BOTH tables
• LEFT JOIN: Return all rows from the left table, and the matched rows from the right table
• RIGHT JOIN: Return all rows from the right table, and the matched rows from the left table
• FULL JOIN: Return all rows when there is a match in ONE of the tables