22
RANDOM NUMBER GENERATION Excel has two useful functions when it comes to creating random numbers. The RAND and RANDBETWEEN function. A. RAND The RAND function creates a random decimal number between 0 and 1. 1. Select cell A1. 2. Type RAND() and press Enter. The RAND function takes no arguments. 3. To create a list of random numbers, simply click on the lower right corner of cell A1 and drag it down. Note that cell A1 has changed. That is because random numbers change every time a cell on the sheet is calculated. 4. If you don't want this, simply copy the random numbers and paste them as values.

Computer Handout (Basic Excel)

Embed Size (px)

DESCRIPTION

Tutorial for Basic Excel

Citation preview

Page 1: Computer Handout (Basic Excel)

RANDOM NUMBER GENERATION

Excel has two useful functions when it comes to creating random numbers. The RAND and RANDBETWEEN function.

A. RAND

The RAND function creates a random decimal number between 0 and 1.

1. Select cell A1.

2. Type RAND() and press Enter. The RAND function takes no arguments.

3. To create a list of random numbers, simply click on the lower right corner of cell A1 and drag it down.

Note that cell A1 has changed. That is because random numbers change every time a cell on the sheet is calculated.

4. If you don't want this, simply copy the random numbers and paste them as values.

Page 2: Computer Handout (Basic Excel)

5. Select cell C1 and look at the formula bar. This cell holds a value now and not the RAND function.

Page 3: Computer Handout (Basic Excel)

B. RANDBETWEEN

The RANDBETWEEN function returns a random whole number between two boundaries.

1. Select cell A1.

2. Type RANDBETWEEN(50,75) and press Enter.

3. If you want to create random decimal numbers between 50 and 75, modify the RAND function as follows:

Reference:

http://www.excel-easy.com/examples/random-numbers.html

REGRESSION This example teaches you how to perform a regression analysis in Excel and how to interpret the Summary Output.

Below you can find our data. The big question is: is there a relation between Quantity Sold (Output) and Price and Advertising (Input). In other words: can we predict Quantity Sold if we know Price and Advertising?

Page 4: Computer Handout (Basic Excel)

1. On the Data tab, click Data Analysis.

2. Select Regression and click OK.

3. Select the Y Range (A1:A8). This is the predictor variable (also called dependent variable).

4. Select the X Range(B1:C8). These are the explanatory variables (also called independent variables). These columns must be adjacent to each other.

5. Check Labels.

Page 5: Computer Handout (Basic Excel)

6. Select an Output Range.

7. Check Residuals.

8. Click OK.

Excel produces the following Summary Output (rounded to 3 decimal places).

R SquareR Square equals 0.962, which is a very good fit. 96% of the variation in Quantity Sold is explained by the independent variables Price and Advertising. The closer to 1, the better the regression line (read on) fits the data.

Page 6: Computer Handout (Basic Excel)

Significance F and P-valuesTo check if your results are reliable (statistically significant), look at Significance F (0.001). If this value is less than 0.05, you're OK. If Significance F is greater than 0.05, it's probably better to stop using this set of independent variables. Delete a variable with a high P-value (greater than 0.05) and rerun the regression until Significance F drops below 0.05.

Most or all P-values should be below below 0.05. In our example this is the case. (0.000, 0.001 and 0.005).

CoefficientsThe regression line is: y = Quantity Sold = 8536.214 -835.722 * Price + 0.592 * Advertising. In other words, for each unit increase in price, Quantity Sold decreases with 835.722 units. For each unit increase in Advertising, Quantity Sold increases with 0.592 units. This is valuable information.

ResidualsThe residuals show you how far away the actual data points are from the predicted data points (using the equation).

Page 7: Computer Handout (Basic Excel)

You can also create a scatter plot of these residuals.

SAMPLINGExcel provides a Sampling data analysis tool which can be used to create samples. The tool works by defining the population as an array in an Excel worksheet and then using the following input parameters to determine how you would like to carry out the sampling.Input Range – Specify the range of data that contains the population of values you want to sample. Excel draws samples from the first column, then the second column, and so on.

Sampling Method – Select one of the following two sampling intervals:

Page 8: Computer Handout (Basic Excel)

Periodic – In this case, you specify the Period n at which you want sampling to take place. The  nth value in the input range and every nth value thereafter is copied to the output column. Sampling stops when the end of the input range is reached.

Random – In this case, you specify the Random Number of Samples.  This number of values is drawn from random positions in the input range. A value can be selected more than once. (i.e. sampling is with replacement).

Example 1: From a population of 10 women and 10 men as given in the table in Figure 1 on the left below, create a random sample of 6 people for Group 1 and a periodic sample consisting of every 3rd woman for Group 2.

Figure 1 – Creating random and periodic samples in Excel

Figure 1 – Creating random and periodic samplesYou need to run the sampling data analysis tool twice, once to create Group 1 and again to create Group 2. For Group 1 you select all 20 population cells as the Input Range and Random as the Sampling Method with 6 for the Random Number of Samples.  For Group 2 you select the 10 cells in the Women column as Input Range and Periodic with Period 3.

Observation: The Sampling data analysis tool has a number of limitations which unfortunately reduces its usefulness. These include: Only numeric data (including blank) can be used. If in the example above the number of women is not equal to the number of men

any blank cells will simply be treated as data and can be chosen for inclusion in a sample.

The Label option does not function properly and so should not be used Random sampling is with replacement. As you can see from the example, the

number 2 is chosen twice in the Group 1 sample.

Page 9: Computer Handout (Basic Excel)

As a result it often better to use other approaches to create a sample. We now show how to create the Group 1 sample above without duplicates.

PERCENTILE AND GRAPH

PERCENTILE

Step 1: Go to DATA then click DATA ANALYSIS. Click Rank and Percentile

Page 10: Computer Handout (Basic Excel)

Step 2: Click the array that you wanted to analyze in the input range. Drag your data, then click OK.

This would be the result.

Page 11: Computer Handout (Basic Excel)

How to Use Excel to Find Percentiles (exc and inc)by Shawn McClain, Demand Media

As your business grows, you'll find that you need Microsoft Excel 2010 more and more to compute important numbers for your business. One Excel function that can come in extremely handy is the PERCENTILE.EXC function, which will look through a given set of numbers and find the exact number that breaks the data set into your chosen percentiles. Excel also includes the PERCENTILE.INC function, which is slightly less accurate but needed in certain situations.Step 1Open a new Microsoft Excel 2010 worksheet.Step 2Click on cell "A1" and enter the values in your data set into the cells in column A.Step 3Click on cell "B1."Step 4Enter the following formula into the cell, excluding quotes: "=PERCENTILE.EXC(A1:AX,k)" where "X" is the last row in column "A" where you have entered data, and "k" is the percentile value you are looking for. The percentile value must be between zero and one, so if you wanted to find the value for the 70th percentile, you would use "0.7" as your percentile value.Step 5Press "Enter" to complete your formula. The value you are looking for will appear in cell "B1."

HOW TO INPUT YOUR DATA IN A GRAPHStep 1: Go to INSERT then click your preferred style for your graph. (Going with columns)

Page 12: Computer Handout (Basic Excel)

Step 2: A white box will appear in your screen. Right click on your mouse and go to SELECT DATA to input your data.

Page 13: Computer Handout (Basic Excel)

Step 3: Click ADD in the legend series and for your Y axis (or the vertical line)

There would be a box to edit the vertical part of your graph. Series name (above) will be named SALARY. Then on the series, drag your data under Salary, then press OK.

Page 14: Computer Handout (Basic Excel)

Step 3: To edit the labels on your x axis, click EDIT on the right side of the SELECT DATA SOURCE.

Then drag the data (labels) under Name in your table. Click OK.

Page 15: Computer Handout (Basic Excel)

And there you go.

F-TEST

An F-test is used to see if the variances of two populations are equal. The samples can be any size, however one must assume that they are normally distributed.

Note: The variance is simply the average of the squared differences of the mean

For example you want to test if Lena’s sabaw hours are more than Anica’s, we’ll use the F-test to see if they’re statistically they’re just equal or not.

STEP 1: Input the samples/population

Page 16: Computer Handout (Basic Excel)

STEP 2: Go to the Data tab and click Data Analysis

STEP 3: Choose F-test Two-Sample for Variances

STEP 4: Input the variables!!! The numbers from Column A and rows 2-7 should be put under Variable 1 Range, while the numbers from Column B and rows 2-6 should be placed under Variable 2 Range.

Page 17: Computer Handout (Basic Excel)

STEP 5: For the Output options, you can either choose to have a New Worksheet Ply, or you can select an Output Range from your current sheet to get the results.

STEP 6: To know whether your hypothesis as to whether or not Lena has more sabaw hours than Anica is true or not can be seen through the results. If F > F Critical, then we reject the null hypothesis and the variances for these two are unequal.

T-TEST

The t-Test is used to test the null hypothesis that the means of two populations are equal.

To perform a t-Test, execute the following steps.

Page 18: Computer Handout (Basic Excel)

1. First, perform an F-Test to determine if the variances of the two populations are equal.

If the variances are equal use the t-test two-sample assuming equal variances. If not, then use the t-test two sample assuming unequal variances. (in this case, we use the unequal variances)

2. On the Data tab, click Data Analysis.

3. Select t-Test: Two-Sample Assuming Unequal Variances and click OK.

Page 19: Computer Handout (Basic Excel)

4. Click in the Variable 1 Range box and select the range A2:A7.

5. Click in the Variable 2 Range box and select the range B2:B6.

6. Click in the Hypothesized Mean Difference box and type 0

7. Click in the Output Range box and select cell E1.

8. Click OK

Result:

USE THE SAME PROCEDURE FOR THE T-TEST TWO-SAMPLE ASSUMING EQUAL VARIANCES ONLY IF THE RESULTS OF THE F-TEST SUGGESTS THAT THE VARIANCES ARE EQUAL.

Page 20: Computer Handout (Basic Excel)

Compare p value to level of significance (0.05).If p value is less than the level of significance which is 0.05 then the null hypothesis is rejected and the alternate hypothesis is accepted