Ial Record
Ial Record
Ial Record
EX NO: 1
DATE
AIM:
The aim of this introduction is to familiarize with MATLAB (Matrix Laboratory), a
high-performance language for technical computing. MATLAB integrates
computation, visualization, and programming in an easy-to-use environment where
problems and solutions are expressed in familiar mathematical notation.
TOOL USED:
PROCEDURE:
RESULT:
This foundational knowledge will enable users to effectively use MATLAB for a variety
of technical computing tasks, paving the way for further learning and application in their
respective fields.
EX NO: 2 INTRODUCTION – MINITAB SOFTWARE
DATE:
For instance
127.5 1.257E2 1.257E+2 is all acceptable in MINITAB.
And have the same value.
The MINITAB worksheet contains columns, rows, and constants. The rows are
designated by numbers. The columns are designated by the letter C followed by
a number. C1, C2, and C3 designate columns 1, 2, and 3. Constants require the
letter K, and may be followed by a number if there are several constants. K1 and
K2 designate constant 1 and constant 2, respectively.
PROCEDURE
Starting and Ending MINITAB
The steps you use to start MINITAB will differ according to the computer
equipment you are using. You will need to get specific instructions for your
installation from your professor or computer lab manager. Use this space to
record the details of logging onto your system and accessing MINITAB. For
Windows versions, you generally click on the MINITAB icon to begin the program.
The first screen will look like the image displayed below:
The screen is divided into two windows. These windows can be resized, minimized,
or maximized. The Session window is used to type commands and view statistical
output. Commands can also be executed using the menu options and dialog boxes.
The Data Window, or Worksheet, is used to enter data values. From here on, we will
refer to this window as the Worksheet. Notice the main menu items:
File Edit Data Calc Stat Graph Editor Tools Window Help
The Toolbar contains icons for frequently used operations.
Problem Statement:
Create a new worksheet that has data regarding ads on TV. A random sample of 15
hours of prime time viewing on TV gave information about the number of
commercials and the total time consumed in the hour by the commercials. We will
enter the data into two columns. One column representing the number of
commercials and the other the total minutes of commercial time. Here are the data.
OUTPUT:
RESULT:
The basic of Minitab Software is studied.
EX NO: 3 MINITAB – BASIC FUNCTIONS
DATE:
AIM:
To study the various basic functions that would facilitate the use of Minitab Software.
PROCEDURE:
Prerequisite: Create an Excel workbook for the below problem.
A collector of antique grandfather clocks believes that the winning price of a clock at an
auction is a positive function of the age of the clock. In addition, the collector also believes
that the auction price is a positive function of the number of bidders. To test this theory, the
collector collected a sample of data on the auction prices, ages, and number of bidders at
the auction at which the grandfather clocks were sold.
List of Functions:
1. Entering/Transferring Data
2. Specifying Data Type
3. Changing Data Type
4. Sorting Data
5. Ranking Data
6. Deleting Rows
7. Erasing Variables
8. Using Codes
9. Calculator
10. Subset Worksheet
11. Split Worksheet
12. Merge Worksheet
13. Deleting Observations with Missing Data
1) Entering/Transferring Data
To start a project in Minitab, data can be entered into the worksheet directly or transferred
from an Excel file using copy and paste. Many actions in the worksheet are similar to Excel
(e.g., Inserting/deleting rows/columns, copy and paste, etc.), however, Minitab worksheets do
not accept formulas. You can also transfer data directly from Excel by going to file /Open
Worksheet
Before clicking Open, you will need to specify: (1) where the file is located using the „Look
in: ‟ drop down menu and (2) the type of file using the „Files of type: ‟ drop down window.
STEP ONE:
STEP TWO:
2) Specifying Data Type
Minitab handles numeric data, text data, and date/time data. When transferring data into
Minitab, it is assumed that the first row of the file contains the column names. When data is
typed or transferred, Minitab decides which type of column it is, depending on the data. In
the Data windows and Columns folder, Minitab labels text columns with T and date/time
columns with D; numeric columns are not labelled. Sometimes Minitab sets a column as text
when you want it to be numeric, and vice versa. If columns are incorrectly labelled as text,
you will need to change the column to numeric in order to perform many of the functions.
In this example, we want to import the Auction Data, but let’s say the top of the
excel spreadsheet looked like this:
To transfer the file to Minitab, you would go to File /Open Worksheet (find your file under
„Look in‟) Open. In Minitab, your screen would look like this: STEP ONE:
STEP TWO:
Saving:
To save your work in Minitab, you can choose from three options: Saving the worksheet,
saving the graph, and saving the project. Saving the project is recommended because it saves
everything associated with the project: the worksheet (data), graphs, and the session window
(displays history). To do this, go to File Save Project As
STEP ONE:
STEP TWO:
4) Sorting Data
You can sort one or more columns of data according to values in the associated column(s)
you select. Sorting alphabetizes or numerically orders the data and carries along the
associated columns. You can sort in ascending or descending order, and you can specify
whether the sorted data should be stored in the original columns, other columns you specify,
or in a new worksheet.
Data Sort Double-click on appropriate variables for Sort columns and by column Click on
appropriate selection under Store sorted data in OK.
STEP ONE:
STEP TWO:
STEP THREE:
OUTPUT:
5) Ranking Data
You can assign rank scores to values in a column: 1 to the smallest value in the column, 2 to
the next smallest, and so on. Ties are assigned the average rank for that value. Missing values
are left as missing.
Data Rank Double-click on appropriate variable in Rank data in (For Auction data, double-
click on No of Bidders) Type in name of column heading in Store ranks in (Type in Rank)
OK.
STEP ONE:
STEP TWO:
OUTPUT:
6) Deleting Rows
You can delete specified rows from columns in the worksheet and move the remaining rows
up.
Data Delete Rows Enter which rows you want deleted under Delete rows (For Auction Data,
type in 1:3 8 10 to delete rows 1,2,3,8,10) Double-click on appropriate column names under
From columns (Double-click on Date, Rates of Return, and Rank to delete rows from all
three columns) OK.
STEP ONE:
STEP TWO:
OUTPUT:
7) Erasing Variables
You can erase any combination of columns, constants, and matrices (including their names).
Data Erase Variables Double-click on what you want to erase (For Auction Data, double-
click on Rank column that was added previously) OK.
STEP ONE:
STEP TWO:
OUTPUT::
8) Using Codes
Use Code to change a value or set of values to new values.
Here are some examples of when you might use the various code commands.
Use To Code
Numeric to Numeric Test scores from 91 through 100 to a 4 (grade of A), from 81
through 90 to a 3 (grade of B), from 71 through 80 to a 2 (grade of
C), from 61 through 70 to a 1 (grade of D), and 60 or below to a 0
(grade of F)
STEP ONE:
STEP TWO:
FINAL OUTPUT:
STEP THREE:
9) Calculator
Use the Calculator to do arithmetic operations, comparison operations, logical operations,
functions, and column operations. Expressions may include columns, stored constants,
numbers, and text, but not matrices.
Note: You cannot type formulas in the cells as you would in Excel.
Calc Calculator Type in name of column heading (For Auction Data, type in Mean)
Enter the mathematical operation you want Minitab to perform, selecting variables, buttons,
and functions to build your expression (For this example, double-click on mean under the
Functions dropdown box, then double-click on Age) OK.
STEP ONE:
STEP TWO:
STEP THREE:
FINAL OUTPUT:
STEP FOUR:
10) Subset Worksheet
Use this to copy specified rows from the active worksheet to a new worksheet.
STEP ONE:
STEP TWO:
FINAL OUTPUT:
STEP THREE:
STEP ONE:
STEP TWO:
STEP THREE:
STEP FOUR:
STEP FIVE:
Use to combine two open worksheets into one new worksheet. For this example, we’ll undo
what was just shown above (i.e., the gender split example) and merge the two new
worksheets we just created.
Click the appropriate worksheet to merge OK. The new merged worksheet will appear:
If you click on the By Columns… button, you can customize how the worksheets merge. By
Columns options allow you to match observations from the two worksheets to be merged.
Let’s say you would like to combine the results into one worksheet so that all the information
for each group is in the same row.
Move appropriate variables from the left to the right by clicking on them and then hitting >
(Here we clicked on Group and moved it over to the By columns: box) OK OK. The new
merged worksheet will appear.
STEP ONE:
STEP TWO:
STEP THREE:
STEP FOUR:
STEP FIVE:
STEP SIX:
13) Deleting Observations with Missing Data
Minitab replaces a missing data point with an asterisk (*). If you want to eliminate all
observations with missing data points, here is one way to do it – there may be other ways.
It is easy to see which observations have missing data, but it would be more difficult if the
sample size was larger. So, we are going to Sort each column so that the asterisks are at the
top of the columns, and then delete those rows.
Data Sort Double-click on all variables for Sort columns Double-click on the first variable for
By column (Auc Price in this example) Click on box next to Descending.
Click on appropriate selection under Store sorted data in OK.
Highlight the rows with the asterisks Right-click and a list will appear so that you can click
on Delete Cells (Or you can go to Edit Delete Cells). Then those rows will disappear. Now
we will follow the same procedure the rest of the columns.
Data Sort Double-click on all variables for Sort columns Double-click on the second variable
for By column (Age in this example) Click on box next to Descending Click on appropriate
selection under Store sorted data in OK.
STEP ONE:
STEP TWO:
STEP THREE:
PROBLEM STATEMENT:
Perform all the Functions detailed in Exercise 2 on the data set given below.
AUCTION AGE NO OF
PRICE BIDDERS
1235 127 13
1080 115 12
845 127 7
1522 150 9
1047 156 6
1979 182 11
1822 156 12
1253 132 10
1297 137 9
946 113 9
1713 137 15
1024 117 11
1147 137 8
1092 153 6
1152 117 13
1336 126 10
2131 170 14
1550 182 8
1884 162 11
2041 184 10
845 143 6
1483 159 9
1055 108 14
1545 175 8
729 108 6
1792 179 9
1175 111 15
1593 187 8
785 111 7
744 115 7
1356 194 5
1262 168 7
RESULT:
The various basic functions that would facilitate the use of Minitab Software have been learnt.
EX NO: 4 DESCRIPTIVE STATISTICS
DATE:
PROCEDURE:
1. Descriptive Statistics for one variable
Stat Basic Statistics Display Descriptive Statistics Double-click
on appropriate Variable.
2. Descriptive statistics for one variable, grouped by a second variable.
Note: If you see a * in the output, that indicates that the value could not be
calculated. In this example, the numerous * appear because N is not large
enough in each group to calculate all the descriptive statistics. (e.g., there is
only one instance where the number of bidders equals 5, and thus SE Mean,
StDev, Q1, and Q3 could not be calculated with only one data point)
3. Store Descriptive Statistics
This feature adds the descriptive statistics to the data worksheet instead of
displaying the output in the session window:
Stat Basic Statistics Store Descriptive Statistics Double-click on appropriate
variable (For Dell Data, double-click on Rates of Return so that it is displayed
under Variables)
4. Column Statistics
Calc Column Statistics Click by the Statistic you want calculated (For Auction
Data, click by Standard Deviation) Double-click on appropriate column in
Input variable box (Double- click on No. of Bidders) OK.
5. Row Statistics
You can compute one value for each row in a set of columns. The statistics are
calculated across the rows of the column(s) specified and the answers are
stored in the corresponding rows of a new column.
Calc Row Statistics Click by the Statistic you want calculated Double-click
on appropriate variable(s) in Input variables box Type the name of the new
column that will be created OK
PROBLEM STATEMENT:
Perform all the functions on DELL data used for Exercise 2
QUESTION 1:
STEP TWO
STEP THREE:
STEP FOUR:
FINAL OUTPUT:
QUESTION 2:
STEP TWO:
STEP THREE:
FINAL OUTPUT:
RESULT:
The above problem is solved using Descriptive statistics.
INFERENCE:
Descriptive statistics analysis in Minitab provides key insights into data characteristics. It
summarizes and organizes data through measures like mean, median, standard deviation,
and quartiles. Minitab's robust capabilities allow for efficient calculation and visualization
of descriptive statistics, enabling users to understand data distributions, central tendencies,
and variability. These statistics assist in identifying patterns, outliers, and making data-
driven decisions, providing a comprehensive understanding of the dataset's key features.
EX.NO.5 CONTROL CHARTS X BAR-R CHART
DATE:
AIM:
THEORY:
X Bar R charts are the widely used control chart for variable data to examine the process
stability in many industries (like Hospital patients’ blood pressure over time, customer call
handle time, length of the part in production process etc.,). Selection of appropriate control
chart is very important in control charts mapping, otherwise ended up with inaccurate control
limits for the data .X bar R chart is used to monitor the process performance of a continuous
data. You can also use them to collect data from subgroups at a set time periods. It is two
plots to monitor the process mean and the process variation over the time and is an example
of statistical process control. These combination charts help to understand the stability of
processes and detects the presence of special cause variation.
X- bar chart: The mean or average change in process over time from subgroup values. The
control limits on the X-Bar brings the sample’s mean and centre into consideration.
R-chart: The range of the process over the time from subgroups values. This monitors the
spread of the process over the time.
PROCEDURE:
1. Choose Stat > Control Charts > Variables Charts for Subgroups > X bar-R.
2. Enter the given values in the excel sheet. Where C1, C2, C3
and C4 are considered as lots. And their respective values are written.
3. From the drop-down list, select All observations for a subgroup are
4. Click OK. And X-bar and R chart for the given data will appear in the screen.
QUESTION 1:
SAMPLE X1 X2 X3 X4 X-BAR R
NUMBER
1. 6.35 6.4 6.32 6.37 6.36 0.08
2. 6.46 6.37 6.36 6.41 6.4 0.1
3. 6.34 6.4 6.34 6.36 6.36 0.06
4. 6.69 6.64 6.68 6.59 6.65 0.1
5. 6.38 6.34 6.44 6.4 6.39 0.1
6. 6.41 6.4 6.29 6.34 6.36 0.12
7. 6.38 6.44 6.28 6.58 6.42 0.3
8. 6.35 6.41 6.37 6.38 6.37 0.06
9. 6.56 6.55 6.45 6.48 6.51 0.11
10. 6.38 6.4 6.45 6.37 6.4 0.08
OUTPUT:
QUESTION 2:
LOT X1 X2 X3 X4 X-BAR R
NO.
1. 492 460 470 482 476 32
2. 472 478 460 454 466 24
3. 468 500 490 478 484 32
4. 460 453 472 479 466 26
5. 482 458 464 476 470 24
6. 500 506 488 482 494 24
7. 472 500 492 480 486 28
8. 490 485 502 507 496 22
9. 500 476 482 494 488 24
10. 488 495 476 469 482 26
11. 486 510 504 492 498 24
12. 458 452 470 476 464 24
13. 496 472 478 490 484 24
14. 488 493 416 471 482 22
15. 495 517 512 500 506 22
16. 409 485 502 507 496 22
17. 490 466 472 484 478 24
18. 490 496 478 472 484 24
19. 495 517 512 500 506 22
20. 470 464 482 488 476 24
21. 499 471 479 491 485 28
22. 496 502 484 478 490 24
23. 452 474 469 457 463 22
24. 463 456 475 482 469 26
25. 485 463 468 480 474 22
STEP ONE:
STEP TWO:
STEP THREE:
FINAL OUTPUT:
RESULT:
The quality control test for the given data was done using the x bar and r chart.
EX.NO.6 P CHART
DATE:
AIM:
THEORY:
An np-chart is an attributes control chart used with data collected in subgroups that are the
same size. Np-charts show how the process, measured by the number of nonconforming
items it produces, changes over time. The process attribute (or characteristic) is always
described in a yes/no, pass/fail, go/no go form. For example, the number of incomplete
accident reports in a constant daily sample of five would be plotted on an np-chart. Np-
charts are used to determine if the process is stable and predictable, as well as to monitor
the effects of process improvement theories. Np-charts can be created using software
programs like MINITAB.
PROCEDURE:
1). Open the sample data.
2). Choose Stat > Control Charts > Attributes Charts > NP.
6). On the Tests tab, select 1 point > K standard deviations from centre line (Test 1) and K
points in a row on same side of centre line (Test 2). If you are not sure which tests apply in
your specific situation, use Tests 1 and 2 when you first establish the control limits based
on your data. Click OK in each dialog box.
QUESTION 1:
PROBLEM STATEMENT:
In a factory producing spark plugs the number of defectives found in inspection of 20 lots of
100 each is given below.
STEP ONE:
STEP TWO:
FINAL OUTPUT:
RESULT:
The statistics has been analysed and checked whether the process is under the control
limits or not. The graphs have also been plotted to determine the process control limits.
EX.NO. 7 SIMPLE LINEAR REGRESSION
DATE:
1. The relationship between the independent and dependent variable is linear: the line
of best fit through the data points is a straight line.
PROCEDURE:
1. Enter the data in Minitab.
2. Go to Stat -> Regression -> Fitted Line Plot and select Linear.
3. Select the column with Y values as “Response” and column with X values as “Predictor”.
4. Click on OK and the Fitted Line Plot is generated.
PROBLEM SOLVING:
Merchandise loss due to shoplifting, damage, and other causes is called shrinkage. Shrinkage is a
major concern to retailers. The managers of H.R. Merchandise think there is a relationship
between shrinkage and number of clerks on duty. To explore this relationship, a random sample
of 7 weeks was selected. During each week the staffing level of salesclerks was kept constant
and the dollar value (in hundreds of dollars) of the shrinkage was recorded.
Store the value of X = Clerks in C1 and name C1 as Clerks. Store the values of Y =
Shrinkage in C2 and name C2 as Shrinkage. Use menu choices to give descriptive statistics
regarding the variables Clerks and Shrinkage. Use commands to draw an (X, Y) scatter
plot and then to find the equation of the regression line. Find the value of the correlation
coefficient, and test to see if it is significant.
We use STAT REGRESSION FITTED LINE PLOT to graph the scatter plot and to
show the less square line on the graph. We will not use prediction bands.
QUESTION 1:
X Y
1 2
2 4
3 7
4 9
5 12
6 14
OUTPUT:
STEP ONE:
STEP TWO:
STEP THREE:
FINAL OUTPUT:
QUESTION 2:
PROBLEM STATEMENT:
Study the relationship between the monthly e- commerce sales and the online advertising
cost with the available survey results of 7 online stores for the last year.
PROBLEM STATEMENT:
Examine the relationship between the age and price for used cars sold in the last year by
a car dealership company.
FINAL OUTPUT:
RESULT:
The linear relationship between the two variables is obtained in the form of an equation
as well as a fitted line plot.
INFERENCE:
From the obtained plot, the value of Y at a certain value of X can be predicted. Here, Y is
the dependent variable that depends on independent variable X.
EX.NO. 8 ONE WAY ANOVA
DATE:
AIM:
To study the analysis of variance.
TOOLS/SOFTWARE USED:
MINITAB16 THEORY
Analysis of variance (ANOVA) is similar to regression in that it is used to investigate and model the
relationship between a response variable and one or more independent variables. However, analysis of
variance differs from regression in two ways: the independent variables are qualitative (categorical),
and no assumption is made about the nature of the relationship (that is, the model does not include
coefficients for variables). In effect, analysis of variance extends the two-sample t-test for testing the
equality of two population means to a more general null hypothesis of comparing the equality of more
than two means, versus them not all being equal. Several of MINITAB‟s ANOVA procedures,
however, allow models with both qualitative and quantitative variables. MINITAB‟s ANOVA
capabilities include procedures for fitting ANOVA models to data collected from several different
designs, for fitting MANOVA models to designs with multiple responses, for fitting ANOM (analysis
of means) models, and specialty graphs for testing equal variances, for error bar or confidence interval
plots, and graphs of main effects and interactions.
One-way and two-way ANOVA models
■ One-way analysis of variance tests the equality of population means when classification is by one
variable. The classification variable, or factor, usually has three or more levels (one-way ANOVA
with two levels is equivalent to a t-test), where the level represents the treatment applied. For
example, if you conduct an experiment where you measure durability of a product made by one of
three methods, these methods constitute the levels. The one-way procedure also allows you to
examine differences among means using multiple comparisons.
■ Two-way analysis of variance performs an analysis of variance for testing the equality of population
means when classification of treatments is by two variables or factors. In two-way ANOVA, the data
must be balanced (all cells must have the same number of observations) and factors must be fixed. If
you wish to specify certain factors to be random, use Balanced ANOVA if your data are balanced; use
General Linear Models if your data are unbalanced or if you wish to compare means using multiple
comparisons.
PROCEDURE:
1.) Create a worksheet for the data.
2.) Choose Stat > ANOVA > One-Way.
3.) In Response, enter Durability. In Factor, enter Carpet.
4.) Click Comparisons.
PROBLEM STATEMENT:
Using the following data, perform a one-way Anova analysis using variance, α=0.05.
45 43 76
33 23 74
45 43 87
67 45 56
OUTPUT:
STEP ONE:
STEP TWO:
STEP THREE:
QUESTION 2:
PROBLEM STATEMENT:
To know whether, three different exam preparation programmes led to different mean score
on a certain exam we recruit 30 students to participate in a study and split them into 3
groups. The students in each group are randomly assigned to use one of the three preparation
programme for the next three weeks to prepare for an exam. At the end of the three weeks all
the students take up the same exam. Exam scores for each group are shown below. Perform a
one-way Anova test to determine the mean exam score is different from the three groups.
OUTPUT:
STEP ONE:
STEP TWO:
FINAL OUTPUT:
RESULT:
A worksheet for the given data is created using One-way ANOVA. The analysis of variance
has been studied.
EX.NO. 9 MEASUREMENT SYSTEM ANALYSIS
DATE:
THEORY:
Gauge R & R is a means of assessing the repeatability and reproducibility of our
measurement systems. Gauge R & R studies are carried out in order to discover how much of
the process variation is due to the measurement device and measurement methods. Gage
R&R is an estimate of the combined variation of repeatability and Reproducibility. Stated
another way, the variance equal to the sum of within-system and between-system variances.
It is very important to know the type of Data being handled in order to determine the method
to be chosen in order to perform Measurement System Analysis. The below details will guide
you in the better understanding of Measurement Analysis Process
Continuous Data
Example
A food manufacturer wants to evaluate a scale that weighs cereal boxes to the nearest tenth
of a gram.
Attribute Data
Classifies people, things, or events into categories. Attribute data are often subjective ratings
by appraisers.
Attribute data can be in the following forms and classifies data into:
• Binary – Two categories, such as pass-fail or yes-no
• Nominal – Three or more categories with no natural ordering, such as red, blue, or black •
Ordinal – Three or more categories with ordering, such as a rating scale of 1 to 10, or with
ranked values, such as excellent, good, fair, poor
Example
A quality analyst wants to evaluate the rating system that is used to assess the flavour of olive oil.
Professional taste testers rate the fruitiness of each olive oil sample on a scale from 1 to 10.
ACCURACY:
Evaluates how close the measurements are on average to a known reference value or standard.
Determines whether the measurement system tends to measure too high or too low.
Example
A food processing company packs products in different sized jars. An engineer wants to
make certain that the scales can accurately weigh standard reference weights for all the jar
sizes: 50 g, 100 g, 250 g, 500 g, and 1000 g
PRECISION:
Assess the variation in the measurements that is caused by the operators and the measuring
device. Determines whether the measurement system is precise enough to distinguish
between different parts.
Example: An engineer at a pen company wants to evaluate the variation in the measurements
of pen barrels. Three operators use the same calliper to measure the length of pen barrels.
To evaluate accuracy, you must have reference values for each part, and the parts should
cover the operating range of the measurement system. The Automotive Industry Action
Group (AIAG) recommends using at least five parts.
To evaluate precision, have operators measure the same parts in random order under the same
conditions. Then, you can assess two sources of variation:
• Reproducibility – The variation observed when different operators measure the same
part under the same conditions (same environment, same machine, and so on).
• Repeatability – The variation observed when the same operator measures the same
part repeatedly under the same conditions.
Each part is measured by more than one Operator because the method of testing does not
destroy the part.
Example
A pen company wants to determine whether its measurement system is consistent and precise
enough to assess the length of pen barrels. Three operators use the same calliper to measure
the same 10 pen barrels in random order under the same conditions.
DESTRUCTIVE TEST:
Each part is measured by only one operator because the part is destroyed by the test or
because a process produces a small batch which cannot be measured by all operators.
Example
A manufacturer wants to make sure it can consistently and precisely measure the crush
strength of boxes. Operators assess crush strength by measuring the force needed to break
each box. Each box is destroyed by testing, so each operator must measure the crush strength
of different boxes.
Note: When possible, have operators measure the same parts. You may be able to treat
different parts as the same in these cases:
• If parts are produced in large homogeneous batches, such as a cough syrup or a food
additive, you may be able to treat distinct samples from the same batch as the same part.
• If you can provide enough comparable parts for different operators to measure in a destructive
test, you may be able to treat those parts as the same part and consider the test non- destructive.
When you treat distinct parts as the same part, any differences between the parts are
attributed to variation in the measurement system. If the distinct parts are not actually the
same, you may overestimate the amount of variation that exists in your measurement system.
According to the Automobile Industry Action Group, you can determine whether your
measurement system is acceptable using the following guidelines.
If the Total Gage R&R percentage in the %Study Var column (% Tolerance, %Process) is:
• Between 10% and 30% - the measurement system is acceptable depending on the application,
the cost of the measuring device, cost of repair, or other factors.
• Greater than 30% - the measurement system is unacceptable and should be improved. If
you are looking at the %Contribution column, the corresponding standards are:
• Less than 1% - the measurement system is acceptable.
In this example, three operators each measured five different parts twice, for a total of 30
measurements. Each part is unique to operator; no two operators measured the same part.
You decide to conduct a gage R&R study (nested) to determine how much of your
observed process variation is due to measurement system variation.
4 3 121.55
7 3 121.33
7 3 121.99
2 3 118.14
3 3 119.35
6 3 122.87
10 3 121.00
1 3 118.03
1 3 117.92
10 3 121.11
6 3 122.87
8 3 119.68
2 3 117.70
8 3 119.90
3 3 119.57
9 3 120.12
9 3 119.68
5 3 120.67
4 3 121.00
16 2 121.33
13 2 119.68
20 2 120.12
20 2 119.68
13 2 119.24
15 2 115.94
11 2 122.21
14 2 119.90
12 2 119.24
19 2 118.58
11 2 121.88
16 2 121.33
19 2 118.69
12 2 119.46
18 2 119.13
18 2 119.02
17 2 121.33
14 2 120.89
17 2 121.00
15 2 116.49
21 1 117.92
23 1 121.11
22 1 122.87
26 1 119.68
21 1 117.70
23 1 119.90
30 1 119.57
24 1 120.12
25 1 119.68
28 1 120.67
26 1 121.00
22 1 122.43
24 1 119.68
27 1 117.37
29 1 121.55
28 1 120.56
25 1 119.24
29 1 121.33
27 1 118.03
30 1 118.47
OUTPUT:
QUESTION 1:
OPEAR 1 2 3 4 5 6 7 8 9 10 AVG
TOR
A 15.02 15.13 14.93 15.12 15.16 14.96 15.09 15.1 15.1 15.15
A 15.03 15.14 14.92 15.12 15.17 14.96 15.07 15.12 15.12 15.15
A 15.03 15.13 14.93 15.14 15.15 14.96 15.08 15.11 15.11 15.15
AVG
RANGE
B 15.03 15.13 14.93 15.14 15.16 14.89 14.95 15.09 15.12 15.14
B 15.03 15.12 14.91 15.15 15.15 14.89 14.95 15.08 15.1 15.13
B 15.04 15.12 14.9 15.13 15.16 14.9 14.95 15.08 15.12 15.14
AVG
RANGE
C 15.02 15.15 14.9 15.15 15.16 14.91 14.97 15.09 15.12 15.14
C 15.02 15.13 14.91 15.16 15.16 14.9 14.96 15.08 15.12 15.15
C 15.03 15.15 14.91 15.14 15.17 14.9 14.97 15.09 15.12 15.14
AVG
RANGE
PART
AVG
OUTPUT:
STEP ONE:
STEP TWO:
STEP THREE:
FINAL OUTPUT:
QUESTION 2:
STEP TWO:
STEP THREE:
FINAL OUTPUT:
RESULT:
INFERENCE:
Measurement System Analysis (MSA) conducted in Minitab allows for effective evaluation
of measurement system reliability and accuracy. It helps identify sources of variability,
estimate measurement error, assess repeatability and reproducibility, and determine the
capability of the system. Minitab's MSA capabilities enable users to make informed
decisions based on reliable data and take appropriate actions to improve the measurement
process, ensuring higher quality and accuracy in the overall analysis.
EX.NO. 10 HYPOTHESIS PARAMETER TESTING
DATE:
AIM:
To perform hypothesis parameter testing on given data using Minitab software.
TOOLS/SOFTWARE REQUIRED:
MINITAB 21.
THEORY:
One theory related to hypothesis parameter testing in statistics is the Neyman-Pearson
theory. The Neyman-Pearson theory provides a framework for making optimal decisions in
hypothesis testing when faced with two competing hypotheses: the null hypothesis (H0) and
the alternative hypothesis (H1).
According to the Neyman-Pearson theory, the goal of hypothesis testing is to control the error
rates associated with making incorrect decisions. Two types of errors can occur in hypothesis
testing:
The Neyman-Pearson theory emphasizes the control of the Type I error rate, also known as
the significance level or alpha (α). Researchers pre-determine the desired significance
level before conducting the test, often set at 0.05 or 0.01.
The theory introduces the concept of the likelihood ratio, which is the ratio of the
probability of observing the data under the null hypothesis to the probability of observing
the data under the alternative hypothesis. The likelihood ratio is used to construct a test
statistic that measures the strength of evidence against the null hypothesis.
To make a decision in hypothesis testing based on the Neyman-Pearson theory, a critical region
or rejection region is defined. If the test statistic falls within the critical region, the null
hypothesis is rejected in favour of the alternative hypothesis. The critical region is determined by
considering the desired significance level and the distribution of the test statistic.
The Neyman-Pearson theory further introduces the concept of power, which is the
probability of correctly rejecting the null hypothesis when it is false (1 - Type II error rate or
beta, β). Power is influenced by factors such as the sample size, effect size, and significance
level. The theory emphasizes the importance of choosing an appropriate test statistic and
determining the critical region based on the desired Type I error rate and the desired power.
It provides a principled approach to hypothesis testing by optimizing the decision-making
process under specific constraints.
It is worth noting that the Neyman-Pearson theory focuses on hypothesis testing from a
frequentist perspective, which treats probabilities as long-run frequencies of events.
Alternative approaches, such as Bayesian hypothesis testing, offer different perspectives
on hypothesis testing by incorporating prior knowledge and assigning probabilities to
hypotheses.
Overall, the Neyman-Pearson theory has greatly influenced the field of statistics and
provides a solid theoretical foundation for hypothesis testing, aiding researchers in making
informed decisions and drawing valid conclusions based on observed data.
PROCEDURE:
1. enter the given data in Minitab.
2. go to stat and click basic statistics.
3. click an option 2 sample t…
4. after that select an option called each sample is in its own column.
5. click ok.
QUESTION 1:
PROBLEM STATEMENT:
Marks obtained in 11 subjects in 2 exams are given below. Perform a t test to find whether the
mean of 2 exams is same or not. The standard t value for the given data is 2.228.
SUBJECT X1 X2
11 3 20
2 3 13
3 3 13
4 12 20
5 15 29
6 16 32
7 17 23
8 19 20
9 23 25
10 24 15
11 32 30
OUTPUT:
STEP ONE:
STEP TWO:
STEP THREE:
STEP FOUR:
FINAL OUTPUT:
RESULT:
Thus, hypothesis parameter testing on given data is performed using Minitab software.
INFERENCE:
Hypothesis Testing is a type of statistical analysis in which you put your assumptions about
a population parameter to the test. It is used to estimate the relationship between 2 statistical
variables.
EX.NO.11 FORECASTING TECHNIQUES
DATE:
AIM:
To perform forecasting techniques on given data in Minitab software.
TOOLS/SOFTWARE REQUIRED:
MINITAB 21
THEORY:
Forecasting techniques are based on several theories and methodologies, each with
its underlying assumptions and principles. Here are some key theories that form the
foundation of forecasting techniques:
1. Time Series Analysis: This theory assumes that future values of a variable can be
predicted based on its past values. Time series analysis focuses on patterns and
trends in the historical data, such as seasonality (repeating patterns) and trend (long-
term direction). Techniques like moving averages, exponential smoothing, and
ARIMA (Autoregressive Integrated Moving Average) models are commonly used
in time series analysis.
2. Regression Analysis: Regression theory assumes that there is a relationship between a
dependent variable and one or more independent variables. It aims to estimate the
parameters of this relationship to make predictions. Simple linear regression and
multiple regression are widely used techniques for forecasting when there is a causal
relationship between variables.
3. Judgmental Forecasting: This theory recognizes the importance of expert judgment
and subjective opinions in making forecasts. It acknowledges that historical data
might not capture all relevant information or account for future changes. Techniques
like Delphi method, scenario analysis, and expert opinion polls are used to gather and
incorporate qualitative inputs into the forecasting process.
4. Econometric Modelling: Econometric models are based on economic theory and
statistical techniques. They aim to capture the relationships among economic
variables and make forecasts based on those relationships. Econometric models can
be complex, incorporating simultaneous equations, lagged variables, and
exogenous variables.
5. Machine Learning and Artificial Intelligence: These theories leverage
computational power and algorithms to learn from data and make predictions.
Machine learning techniques, such as neural networks, decision trees, and support
vector machines, are applied to analyse historical data patterns and make forecasts.
Artificial intelligence approaches like deep learning and natural language
processing are also increasingly used in forecasting.
PROCEDURE:
1. Enter the given data in Minitab.
2. Go to stat and click on time series.
3. Go to moving average and enter the MA length.
4. Select an option called center the moving averages.
QUESTION 1:
PROBLEM STATEMENT:
1. The table below shows the demand for a particular brand of razor in a shop for each
of the last 9 months.
Calculate a 3-month moving average for months 3 to 9. what would be your forecast for
the demand in month 10?
MONTH 1 2 3 4 5 6 7 8 9
DEMAND 10 12 13 17 15 19 20 21 20
OUTPUT:
STEP ONE:
STEP TWO:
STEP THREE:
STEP FOUR:
FINAL OUTPUT:
QUESTION 2:
2. The table below shows the demand for a particular brand of fax machine in
a department store in each of the last 12 months.
Calculate the four-month moving average for the months 4 to 12. What would
be your forecast for the demand in the month 13
MONTH 1 2 3 4 5 6 7 8 9 10 11 12
DEMAND 12 15 19 23 27 30 32 23 37 41 49 58
OUTPUT:
STEP ONE:
STEP TWO:
STEP THREE:
FINAL OUTPUT:
RESULT:
Thus, forecasting techniques on given data is performed in Minitab software.
INFERNCE:
A moving average is a technique that calculates the overall trend in a data set. In operations
management, the data set is sales volume from historical data of the company. This
technique is very useful for forecasting short-term trends. It is simply the average of a select
set of time periods.
EX.NO. 12 Process capability
DATE:
AIM:
To perform process capability on given data in Minitab software.
Tools/software required:
Minitab16
THEORY:
Process capability is a statistical measure that quantifies the ability of a process to
consistently produce output within specified limits. It provides information about the inherent
variability of a process and its ability to meet customer requirements.
The theory of process capability is based on two key concepts: specification limits
and process variability.
1. Specification Limits: Specification limits are the acceptable range of values for a
particular product or process parameter. There are two types of specification limits:
a. Upper Specification Limit (USL): The maximum allowable value for a parameter.
b. Lower Specification Limit (LSL): The minimum allowable value for a parameter.
2. Process Variability: Process variability refers to the natural variation that occurs in a
process. It is typically measured using statistical methods such as standard deviation
or range.
Variability can arise from various sources, including equipment, materials,
operators, and environmental factors.
The process capability is commonly assessed using two indices: Cp and Cpk.
1. Cp (Process Capability Index): Cp measures the potential capability of a process to meet the
specification limits. It compares the width of the process spread (6σ, where σ is the process
standard deviation) to the width of the specification range (USL - LSL). A Cp value greater
than 1 indicates that the process has the potential to meet the specifications.
2. Cpk (Process Capability Index with Centring): Cpk measures the actual capability of a process
to meet the specification limits, considering both process spread and centring. It considers the
deviation of the process mean from the target value. A Cpk value greater than 1 indicates that
the process is centred and capable of meeting the specifications.
PROBLEM STATEMENT:
Perform process capability for the given data.
OUTPUT:
STEP1:
STEP2:
STEP3:
FINAL OUTPUT:
STEP4:
RESULT:
Thus, process capability on given data is performed in Minitab software.
INFERENCE:
process capability analysis helps organizations assess the ability of their processes to
consistently meet customer requirements. By understanding the inherent variability and
the relationship between process spread and specification limits, organizations can make
informed decisions to improve and control their processes.
EX.NO. 13 PARETO CHART
DATE:
AIM:
To perform pareto chart using MINITAB.
TOOLS/SOFTWARE REQUIRED:
MINITAB 21.
THEORY:
1. The Pareto Principle: The theory behind the Pareto chart is based on the Pareto
principle, also known as the 80/20 rule. This principle suggests that a significant
majority (around 80%) of the effects or outcomes are typically caused by a
minority (around 20%) of the causes. The Pareto chart helps visualize and prioritize
these influential factors.
2. Prioritization and Focus: The main purpose of the Pareto chart is to prioritize and
focus on the most critical issues or categories that contribute to a particular
outcome. By organizing data in descending order of frequency or impact, the chart
enables decision-makers to identify the few factors that have the greatest influence
on the overall result.
3. Visual Representation: The Pareto chart provides a visual representation of data,
making it easier to comprehend and analyse. The chart typically consists of a bar
graph displaying the frequencies or occurrences of different categories on the primary
vertical axis, with a cumulative percentage line plotted on the secondary vertical axis.
This graphical representation allows for quick identification of the vital few versus
the trivial many.
4. Decision-Making Support: The Pareto chart serves as a decision-making tool by
highlighting the areas where resources and efforts should be focused to achieve
maximum impact. By identifying the categories that contribute significantly to the
problem or desired outcome, decision-makers can allocate resources effectively,
implement targeted interventions, and develop strategies for improvement.
5. Continuous Improvement: The Pareto chart supports the concept of continuous
improvement by enabling organizations to monitor progress and measure the
effectiveness of their actions. By regularly updating the chart and comparing it to
previous versions, organizations can assess the impact of their interventions, track
trends, and identify emerging issues that require attention. This iterative process helps
drive ongoing improvement efforts and ensures a data-driven approach to problem-
solving.
PROCEDURE:
1. Download and open the pareto chart. MTW data file.
2. Click on stat go to quality tools and click pareto chart.
3. A new window with title “Pareto Chart” pops up.
4. Select “category “into the “defects or attribute data in box.
PROBLEM STATEMENT:
To calculate the distribution of errors of the organization category wise.
OUTPUT:
PARETO CHART IN EXCEL
Step1:
STEP2:
STEP TWO:
STEP3:
RESULT:
Thus, pareto chart experiment is performed using Minitab software.
INFERENCE:
The Pareto chart is a powerful tool used to analyse and visualize data to prioritize issues or
AIM:
To study chi-square valuation using MINITAB
The test statistic has a chi-square distribution when the following assumptions are met.
• The data are obtained from a random sample.
• The expected frequency of each category must be at least 5. This goes back to the
requirement that the data be normally distributed. You're simulating a multinomial
experiment (using a discrete distribution) with the goodness-of-fit test (and a continuous
distribution), and if each expected frequency is at least five then you can use the normal
distribution to approximate (much like the binomial).
The following are properties of the goodness-of-fit test:
• The data are the observed frequencies. This means that there is only one data value for
each category.
• The degrees of freedom are one less than the number of categories, not one less than the
sample size.
• It is always a right tail test.
• It has a chi-square distribution.
• The value of the test statistic doesn't change if the order of the categories is switched.
PROCEDURE
Problem Statement:
A group of 420 people’s political party preferences were recorded as below. Can it be said
that their preferences are not dependent on their gender? Using Minitab, perform a Chi-
Square test on the given data.
Solution:
1. Enter the given data in Minitab.
2. Click on Stat -> Tables -> Cross Tabulation and Square and select “Summarized data in
a two-way table” from the drop-down menu.
3. Select the “Columns containing the table” which are R, D and I.
4. The column containing categories Male and Female, i.e., Gender, can be selected for
“Rows”.
5. Click on “Chi-Square”, select “Chi-square test” and click OK.
6. Click on OK again in the previous dialog box to obtain the output.
OUTPUT:
STEP ONE:
STEP TWO:
STEP THREE:
FINAL OUTPUT:
QUESTION 2:
TEST FOR GOODNESS OF FIT
FLAVOR NO. OF EXPECTED OBSERVED- SQUARED SQUARED
PIECES NO.OF EXPECTED DIFFERECE DIFFERENCE/
OF PIECES OF EXPECTED
CANDY CANDY NUMBER
(100
BAGS)
APPLE 180 200
STEP TWO
FINAL OUTPUT:
RESULT:
The chi square test has been done and was analyzed for the given problem stateme
EX. NO.:15 Basics of Python and Data Visualization
DATE:
AIM:
Write a python program to accept data from a comma-separated value (.csv) file and visualize
the same using the Matplotlib module in Python through the following graphs:
1. Scatter Plot
2. Bar Plot
3. Box Plot
4. Histograph.
SOFTWARE REQUIRED:
1. Python Interpreter (Version 3.x)
2.Integrated Development Environment (IDE)
3.Matplotlib module
THEORY:
Scatter plots, bar plots, box plots, and histogram plots are commonly used visualizations in
data analysis and exploration. These plots provide valuable insights into the distribution,
relationships, and summary statistics of datasets. The Python matplotlib module is a powerful
tool for creating these plots. It offers a wide range of functionalities and customization
options to create visually appealing and informative visualizations. Scatter plots are useful for
displaying the relationship between two variables, showing how they change together. Bar
plots are ideal for comparing different categories or groups, allowing easy identification of
patterns or differences. Box plots provide a concise summary of the distribution of a dataset,
including information on the median, quartiles, and potential outliers. Histogram plots, on the
other hand, offer a visual representation of the frequency distribution of a continuous
variable, providing insights into its central tendency and variability. With the matplotlib
module in Python, data analysts and scientists have a powerful tool at their disposal to create
these essential visualizations and explore their data effectively.
PROCEDURE:
1) Copying a Dataset into a .csv File Using Microsoft Excel:
a) Open Microsoft Excel.
b) Create a new workbook or open an existing one.
c) Prepare the dataset you want to copy into the .csv file. Make sure it is
properly formatted with headers and rows of data.
d) Select the data you want to copy.
e) Right-click on the selected data and choose "Copy" from the context menu.
f) Open a text editor or a new blank Excel workbook.
g) Right-click on a cell and choose "Paste Special" from the context menu.
h) In the "Paste Special" dialog box, select "Values" or "Text" as the paste option.
i) Save the file with a .csv extension. Choose a suitable name and location for the file.
a) In the same Python script file, define a function for each type of plot you want to
create. For example:
• Histogram:
• Scatter Plot:
• Bar Plot
b) Call the respective functions, passing the data extracted from the .csv file.
MODEL GRAPHS:
RESULT:
The experiment successfully created a Python program that accepts a .csv file and utilizes the
matplotlib module to plot a histogram, scatter, bar, and box plot.
INFERENCE:
The program utilizes the csv module to extract data from a .csv file and the matplotlib
module to create scatter plots, histogram plots, box plots, and bar plots. These modules
enhance data analysis by facilitating data extraction and visualization for effective
exploration and communication of insights.
EX. NO.:16 Exploring Data Analytics using Python.
DATE:
AIM: To write a python program that utilizes the statistics module to calculate the
following characteristics of a given dataset:
1. Mean
2. Median
3. Mode
4. Variance
5. Standard Deviation
6. Maximum Value
7. Minimum Value
8. Range
9. Coefficient of Variation
SOFTWARE REQUIRED:
1. Python Interpreter (Version 3. x)
2. Integrated Development Environment (IDE)
3. Statistics module
PROCEDURE:
1. Import the required modules: csv and statistics.
2. Read the dataset from the .csv file and store it in a list.
3. Use the functions provided by the statistics module to calculate the following
statistics:
o Calculate the mean.
o Find the median.
o Determine the mode. o
Calculate the variance.
o Calculate the standard deviation.
o Find the maximum value.
o Find the minimum value.
o Calculate the range.
o Calculate the coefficient of variation.
4. Print the calculated statistics.
THEORY:
The statistics module in Python provides a powerful set of functions to calculate various
descriptive statistics for datasets. These statistics offer insights into the central tendency,
variability, and distribution of the data.
1. Mean: The mean represents the average value of a dataset and is calculated
by summing all the values and dividing by the number of data points.
2. Median: The median is the middle value of a sorted dataset. It divides the data
into two equal halves, indicating the central value.
3. Mode: The mode represents the most frequently occurring value in a dataset. It
helps identify the value(s) that appear with the highest frequency.
4. Variance: Variance measures the spread of the dataset around the mean. It
quantifies the average squared deviation from the mean.
5. Standard Deviation: The standard deviation is the square root of the variance and
provides a measure of the average deviation from the mean. It helps understand
the dispersion of the data.
6. Maximum Value: The maximum value is the largest value in the dataset,
indicating the upper limit of the range.
7. Minimum Value: The minimum value is the smallest value in the dataset,
indicating the lower limit of the range.
8. Range: The range is the difference between the maximum and minimum
values, representing the spread of the dataset.
9. Coefficient of Variation: The coefficient of variation (CV) is a relative measure of
variability, calculated as the ratio of the standard deviation to the mean. It provides
a standardized measure of dispersion, allowing comparison across different datasets
with varying means.
The Python statistics module provides functions to compute these statistics efficiently. By
utilizing this module, data analysts and scientists can easily calculate and analyse these
descriptive statistics to gain valuable insights into their datasets.
MODEL PROGRAM:
import csv
import statistics
# STEP ONE: Import the required modules: csv and statistics.
# STEP TWO: Read the dataset from the .csv file and store it in a
list. dataset = []
with open('dataset.csv', 'r') as file:
csv_reader = csv.reader(file)
next(csv_reader) # Skip header if present for
row in csv_reader:
dataset.append(float(row[0])) # Adjust the index if necessary
# STEP THREE: Calculate the statistics using the functions provided by
the statistics module.
mean = statistics.mean(dataset) median =
statistics.median(dataset) mode =
statistics.mode(dataset) variance =
statistics.variance(dataset) std_deviation =
statistics.stdev(dataset) max_value =
max(dataset) min_value = min(dataset)
data_range = max_value - min_value
RESULT:
The experiment successfully created a Python program that accepts a .csv file and utilizes the
matplotlib statistics to compute the Mean, Median, Mode, Variance, Standard Deviation,
Maximum Value, Minimum Value, Range, and Coefficient of Variation of the given dataset.
INFERENCE:
The Python program efficiently calculates various descriptive statistics such as mean,
median, mode, variance, standard deviation, maximum value, minimum value, range, and
coefficient of variation. These statistics provide valuable insights into the central tendency,
variability, and overall distribution of the dataset, aiding in data analysis and decision-making
process.
LINE CHART,BOX PLOT AND PIE CHART IN PYTHON
EX NO:17
DATE:
AIM:
To plot a line chart, box plot, and pie chart using Python.
TOOLS USED:
Python with Matplotlib and Pandas libraries
PROCEDURE:
1. Install Matplotlib and Pandas libraries using pip if not already installed.
2. Create a Python script for each type of chart.
3. Write the Python code for the line chart, box plot, and pie chart.
4. Run each script and observe the output graphs.
BOXPLOT PROGRAM:
OUTPUT:
PIE CHART CODE:
OUTPUT:
RESULT:
The output of line chart, box plot and pie chart from the python are attached and verified
BASICS OF MATLAB PLOTTINGS
EX. NO.:18
DATE :
AIM:
To understand and implement the basics of MATLAB programming and plotting various
types of charts and graphs.
TOOLS USED:
- MATLAB software
PROCEDURE:
1. Open MATLAB software.
2. Create a new script for each type of chart.
3. Write the MATLAB code for the line chart, box plot, pie chart, bar chart, histogram, and
scatter plot.
4. Run each script and observe the output graphs.
CODE:
% Load data from csv file
data = readmatrix('sample_data.csv');
% Boxplot figure;
boxplot(data);
title('Boxplot');
% Histogram
figure;
histogram(data(:,1), 'FaceColor', 'blue', 'EdgeColor', 'black'); title('Histogram');
xlabel('years of exp'); ylabel('salary');
OUTPUT:
RESULT:
The output of line chart, box plot, pie chart, histogram, bar chart and scatter plot
from MATLAB are attached and verified
X Bar and R Chart in MATLAB
EX. NO.:19
DATE :
AIM:
To plot X Bar and R Chart in MATLAB.
TOOLS USED:
- MATLAB software
PROCEDURE:
1. Open MATLAB software.
2. Create a new script for sX Bar and R Chart.
3. Write the MATLAB code for the sX Bar and R Chart.
4. Run the script and observe the output graphs.
CODE:
data = readmatrix('defectdates.xlsx'); % Change 'data.xlsx' to your actual file name
% Assume the data is arranged in columns, with each column representing a subgroup [m, n] = size(data); % m:
number of samples per subgroup, n: number of subgroups
% Calculate X-bar and R for each subgroup xbar =
mean(data); % Mean of each column
R = max(data) - min(data); % Range of each column
% Constants for X-bar and R charts (for a sample size of 5)
% These constants depend on the sample size and can be found in SPC tables A2 = 0.577; % For
sample size of 5
D3 = 0; % For sample size of 5
D4 = 2.114; % For sample size of 5
% Calculate control limits for X-bar chart
xbar_bar = mean(xbar); % Overall mean of xbar
R_bar = mean(R); % Overall mean of R
UCL_xbar = xbar_bar + A2 * R_bar; % Upper Control Limit for X-bar chart
LCL_xbar = xbar_bar - A2 * R_bar; % Lower Control Limit for X-bar chart
% Calculate control limits for R chart
UCL_R = D4 * R_bar; % Upper Control Limit for R chart
LCL_R = D3 * R_bar; % Lower Control Limit for R chart
% Plot X-bar chart subplot(2,1,1);
plot(xbar, '-o'); hold on;
yline(xbar_bar, 'g-', 'LineWidth', 1.5); % Center Line yline(UCL_xbar, 'r--',
'LineWidth', 1.5); % Upper Control Limit yline(LCL_xbar, 'r--', 'LineWidth', 1.5); %
Lower Control Limit title('X-bar Chart');
xlabel('Subgroup'); ylabel('Mean
(\bar{X})');
legend('Sample Means', 'Center Line', 'UCL', 'LCL', 'Location', 'best');
grid on; hold
off;
% Plot R chart
subplot(2,1,2);
plot(R, '-o'); hold on;
yline(R_bar, 'g-', 'LineWidth', 1.5); % Center Line yline(UCL_R, 'r--', 'LineWidth',
1.5); % Upper Control Limit yline(LCL_R, 'r--', 'LineWidth', 1.5); % Lower Control
Limit title('R Chart');
xlabel('Subgroup');
ylabel('Range (R)');
legend('Ranges', 'Center Line', 'UCL', 'LCL', 'Location', 'best'); grid on;
hold off;
OUTPUT:
RESULT:
The output of x bar r chart is attached and the output is verified
P Chart in MATLAB
EX. NO.:20
DATE :
AIM:
To plot a P Chart in MATLAB.
TOOLS USED:
- MATLAB software
PROCEDURE:
1. Open MATLAB software.
2. Create a new script for P Chart.
3. Write the MATLAB code for the P Chart.
4. Run the script and observe the output graph
CODE:
%Read data from Excel file with original column names preserved filename =
'defectives_data.xlsx'; opts = detectImportOptions(filename);
opts.VariableNamingRule = 'preserve'; data =
readtable(filename, opts);
% Display the first few rows of data to ensure it's read correctly disp(data);
% Extract the number of defectives from the table
num_defectives = data.('Number of Defective Widgets'); % Using original column name
sample_size = 100; % Size of each sample (assumed constant)
% Calculate the proportion of defectives for each sample p =
num_defectives / sample_size;
% Display the calculated proportions disp('Proportions of defectives
for each sample:'); disp(p);
% Number of samples
num_samples = length(p);
% Calculate the average proportion defective (center line) p_bar = mean(p);
% Calculate the standard deviation of the proportion defective sigma_p = sqrt(p_bar *
(1 - p_bar) / sample_size);
% Control limits
RESULT:
The output of pchart from MATLAB is attached and the output is verified that whether
the data lies in the limit or not
One-Way ANOVA in MATLAB
EX. NO.:21
DATE :
AIM:
To perform a one-way ANOVA test in MATLAB.
TOOLS USED:
- MATLAB software
PROCEDURE:
1. Open MATLAB software.
2. Create a new script for one-way ANOVA.
3. Write the MATLAB code for one-way ANOVA.
4. Run the script and observe the output results.
CODE:
% Load the dataset from Excel
filename = 'anova_data.xlsx'; data =
readmatrix(filename);
% Display the dataset
disp('Dataset:'); disp(data);
% Constants
alpha = 0.05; % Significance level k = 3; %
Number of groups
% Perform one-way ANOVA
[p, tbl, stats] = anova1(data, [], 'off');
% Display ANOVA results
disp('ANOVA Table:');
disp(tbl);
disp(['F-statistic: ', num2str(tbl{2, 5})]);
disp(['p-value: ', num2str(p)]);
% Interpret ANOVA results if p <
alpha
disp('Reject the null hypothesis (H0: Means of all groups are equal)'); else
disp('Fail to reject the null hypothesis (H0: Means of all groups are equal)'); end
OUTPUT:
RESULT:
- The output of the ANOVA test will be displayed in the MATLAB command window and
a figure showing the ANOVA results will be plotted.
T Test and Regression in MATLAB
EX. NO.:22
DATE :
AIM:
To perform a t-test and regression analysis in MATLAB.
TOOLS USED:
- MATLAB software
PROCEDURE:
1. Open MATLAB software.
2. Create a new script for t-test and regression analysis.
3. Write the MATLAB code for t-test and regression.
4. Run the script and observe the output results.
% Display the first few rows to ensure the data is loaded correctly disp(head(data));
% Assuming you want to compare defect counts before and after day 15 cutoff_day = 15;
OUTPUT:
REGRESSION MATLAB CODE:
% Load the data from the csv file data =
readtable('Salary_Data.csv');
% Display the first few rows to ensure the data is loaded correctly disp(head(data));