Sie sind auf Seite 1von 25

APPLIED PROBABILITY & STATISTICS (MT-330)

PRACTICAL NO. 04
Introduction to Global Macro

Sohail Ahmed
Lecturer,
Department of Mathematics
NED university of Engineering & Technology, Karachi
APPLIED PROBABILITY & STATISTICS (MT-330)

Note the following link to download course materials

https://www.sites.google.com/site/mt330statistics
1. Write a Global macro for weekly sales ( in $) of four different
brands, Calculate following measures for each brand & determine
which brand gives more consistent sales.

Brand A Brand B Brand C Brand D


114 116 116 110
110 118 115 117
111 114 108 121
113 115 114 123
20 113 100 150

(a) Arithmetic mean (b) Geometric mean (c) Harmonic mean,


(d) Range (e) Variance (f) Standard deviation
(g) Mean Abs. Dev. (h) Coefficient of Variation
Minitab Macro

A Minitab macro is a set of Minitab commands stored in a text file


with extension ( .txt ) which can be executed all at once.

Application

Macros are used to repeat the same task several times without
typing session commands each time.

Types

1. Global Macros
2. Local Macros
Global Macro Structure

Global macro follow this specific structure:

Gmacro

Template

Body of the macro

Endmacro
Example

Write a global macro to calculate mean and variance of data in C1.


Save and Invoke Global Macro

If Text file saved in Macros subfolder of Minitab main folder

SAVE

C:\Program Files\MINITAB 14\Macros\Lab4.txt

INVOKE

MTB > %Lab4.txt


Save and Invoke Global Macro

If Text file saved in External Drive / Location

SAVE

C:\Users\Desktop\Sohail\Lab4.txt

INVOKE

MTB > %' C:\Users\Desktop\Sohail\Lab4.txt '


n

x i
A.M = x = i =1
n

n


logx i

G.M = Antilog i =1
n


n
H.M =
n
1

i =1

xi
Range = Maximum Minimum
n

( xi x )2
Variance= i =1
n 1

Standard Deviation= Square Root (Variance)

xi x
Mean AbsoluteDeviation= i =1
n

S. D
Coefficient of Variation = 100
A.M
Entering Data for Brand A

MTB > NAME C1 BRAND A

MTB > SET C1

DATA > 114

DATA > 110


.
.
.

DATA > END


Brand A

A.M= 93.6000
G.M= 79.3498
H.M= 58.3285
RANGE= 94.0000
VARIANCE= 1356.24
S.D= 36.8272
M.A.D= 29.4400
C.V= 39.3453
Brand A Brand C
A.M= 93.6000 A.M= 110.600
G.M= 79.3498 G.M= 110.432
H.M= 58.3285 H.M= 110.260
RANGE= 94.0000 RANGE= 16.0000
VARIANCE= 1356.24 VARIANCE= 35.8400
S.D= 36.8272 S.D= 5.98665
M.A.D= 29.4400 M.A.D= 5.28000
C.V= 39.3453 C.V= 5.41289
Brand B Brand D
A.M= 115.200 A.M= 124.200
G.M= 115.187 G.M= 123.501
H.M= 115.174 H.M= 122.853
RANGE= 5.00000 RANGE= 40.0000
VARIANCE= 2.96000 VARIANCE= 186.160
S.D= 1.72047 S.D= 13.6440
M.A.D= 1.44000 M.A.D= 10.3200
C.V= 1.49346 (Smallest) C.V= 10.9855
2. Write a global macro for the following frequency distribution
to calculate

First four moments about origin

First four moments about mean

1 ( measure of skewness ), 2 ( measure of kurtosis )

Comment on the shape of distribution.

C.I 07 09 10 12 13 15 16 18 19 21 Total
Freq 02 08 14 09 01 34
MTB > SET C1
DATA> 7:19/3
DATA> END

MTB > SET C2


DATA> 9:21/3
DATA> END

MTB > SET C3


DATA> 2 8 14 9 1
DATA> END

MTB > LET C4=(C1+C2)/2

MTB > NAME C1 LCL C2 UCL C3 FREQ C4 MP (X)


First Four Moments about Origin

1st Moment about Origin = 1 =


fi xi
fi
2nd Moment about Origin = 2 =
fi xi 2
fi
3rd Moment about Origin = 3 =
i if x 3

fi
4th Moment about Origin = 4 =
i i
f x 4

fi
where i = 1, 2 , 3 , ..., k
1ST MOMENT ABOUT ORIGIN= 13.9118

2ND MOMENT ABOUT ORIGIN= 201.206

3RD MOMENT ABOUT ORIGIN= 3008.97

4TH MOMENT ABOUT ORIGIN= 46318.6


First Four Moments about Mean

1st Moment about Mean = 1 = 0 ( Always)


2
2nd Moment about Mean = 2 = 2 1
3
3rd Moment about Mean = 3 = 3 3 2 1 + 21
2 4
4th Moment about Mean = 4 = 4 431 + 6 2 1 31

where 1 2 3 and 4 are first four momentsabout origin


1ST MOMENT ABOUT MEAN= 0

2ND MOMENT ABOUT MEAN= 7.66869

3RD MOMENT ABOUT MEAN= -3.5281

4TH MOMENT ABOUT MEAN= 153.249


Measures of Skewness and Kurtosis

3
Measure of Skewness = 1 = 3
2
2

4
Measure of Kurtosis = 2 = 2
2
SKEWNESS = SQRT BETA 1 = -0.166139

KURTOSIS = BETA 2 = 2.60590


Comment:

Since,

Square Root of Beta 1 shows a negative result therefore


frequency distribution is Left / Negatively Skewed

Beta 2 is less than 3 hence the curve is of Platy Kurtic type.

Das könnte Ihnen auch gefallen