CALIFORNIA STATE UNIVERSITY, HAYWARD

STATISTICS DEPARTMENT

Statistics 6011 Statistical Modeling for Management and Economics
 

Handout 2: More Minitab Examples.

How to start the command line: Go to Editor, then click on Enable Command Language.

 

  1. A Regression Example where we draw the fitted line though the data.

     The data presented in this example are of Age and Price of used Saturn automobiles.

    Enter the data:

    In c1 enter Age (x) 6, 5, 4, 3, 2, 2, 1, 1.

     

    In c2 enter Price (y) 6, 9, 8, 10, 11, 12, 11, 13.

    When performing linear regression analysis the first step is to plot the data in a scatterplot. To create a scatterplot click Graph, then Plot, for Y click on Price and for X click on Age, and finally click OK. The commands should look like this:

    MTB > Plot 'Price'*'Age';
    SUBC>   Symbol;
    SUBC>   ScFrame;
    SUBC>   ScAnnotation.
    

    Next we will calculate the descriptive statistics of the x and y data. First, click Stat, then Basic Statistics, then Display Descriptive Statistics, then click both Age and Price, and finally OK. The output should look as follows:

     

    MTB > Describe 'Age' 'Price'.
    
    Descriptive Statistics
    
    Variable             N       Mean     Median     TrMean      StDev    SE Mean
    Age                  8      3.000      2.500      3.000      1.852      0.655
    Price                8     10.000     10.500     10.000      2.268      0.802
    
    Variable       Minimum    Maximum         Q1         Q3
    Age              1.000      6.000      1.250      4.750
    Price            6.000     13.000      8.250     11.750
    

    Next we calculate the correlation coefficient. First click Stat, then Basic Statistics, then Correlation, then click both Age and Price, and finally OK. The output should look as follows:

    MTB > Correlation 'Age' 'Price'.
    
    Correlations (Pearson)
    
    Correlation of Age and Price = -0.919, P-Value = 0.001
    

    Note that the correlation coefficient is negative indicating a negative relationship!

    Next we will calculate the regression line and save the fitted values from the regression line so we can draw the regression line on a scatterplot with the data. To calculate the regression line click Stat, then click Regression, then Regression, enter Price for the Response and Age for the Predictor. The output should be as follows:

    MTB > Regress 'Price' 1 'Age';
    SUBC>   Constant;
    SUBC>   Brief 2.
    
    Regression Analysis
    
    The regression equation is
    Price = 13.4 - 1.12 Age
    
    Predictor        Coef       StDev          T        P
    Constant      13.3750      0.6847      19.54    0.000
    Age           -1.1250      0.1976      -5.69    0.001
    
    S = 0.9682      R-Sq = 84.4%     R-Sq(adj) = 81.8%
    
    Analysis of Variance
    
    Source            DF          SS          MS         F        P
    Regression         1      30.375      30.375     32.40    0.001
    Residual Error     6       5.625       0.938
    Total              7      36.000
    

    The last thing we will do is plot the data along with the fitted line on the same scatterplot. To do this click Stat, then Fitted Line Plot, then enter Price for Y and Age for X. Next click the OK button.

     

  2. Simulate rolling a fair die

    Minitab allows you to generate what are called ``random numbers.'' As an example of how to do this we will simulate rolling a fair die. Minitab has a command that simulates equally likely integer values in a range defined by the user. To do this click Calc, then Random Data, then click on Integer.

    We will run 3 simulations of increasing size. To start we will simulate 10 rolls of a fair die. Enter the number 10 in the Generate box, next enter c1 in the Store in column(s) box, then enter 1 in the Minimum value: box and 6 in the Maximum value box, then click OK. You should get 10 numbers in the first column.

    Next we will make a histogram of our random data. Click Graph, then Plot, then Histogram, then enter c1, and OK. Does the histogram appear as we would expect? Recall that each side of a die has a 1/6 probability of occurring.

    Redo the simulation with the number of 100 in the Generate box. Redo the histogram. What do you see now? Redo it again with 200. What do you see in the histogram?

     

  3. How to take a random sample from a list.

    We will now use Minitab to take a Simple Random Sample from a list of names. Minitab has a command that will randomly select a sample of a specific size n from a list given in a column.

    To do this we will take a sample of size n = 4 from a list of 10 names. First, enter 10 names down the fist column c1:

     

    Ed, John, Kim, Fred, Ted, Tom, Jim, Julie, Wes, Robert

    To select a random sample from this list of 10 people, click Calc, then Random Data, the Sample From Columns. Enter 4 in the Sample box, then enter c1 in the rows from column: box, then enter c2 in the Store samples in: box, and finally OK. This produces a random sample in Minitab.