7 views

Uploaded by Adang Prianto

Example of statistic problem solving with matlab

- A2 Math C3 done
- Calculating Adjusted Betas
- PPF notes
- cosman
- EXCEL Functions for Prob Dist
- Assignment 1 by Ricky
- Correlation Proof (1)
- Levine Smume6 Ppt06 Shortened
- 408 Variance Sol
- 011912-IntroSlidesW4150
- ListMF26
- Probability Distribution Function
- Semen 19
- Data Science Course Agenda
- Statistics and Probability
- Describing distributions with Numbers | Part 2 (www.ilearnmath.net)
- Central Limit
- Syllabus (22)
- Homework 1 335 KEY (2)
- 304-Hw9 CI and HT With Rv4(1)

You are on page 1of 7

SUBJECT

ACTIVITY

STUDENT

: TUTORIAL & LABORATORY WEEK 2

NAM

E

ID

: ADANG PRIANTO

: 26520338

Tutorial Question

1. X & y is Random Variable

Mean E[X] = mx

E[Y] = my

Covariance = E[(X-mx) (Y-my)

= E[X Y*] mx my

Covariance E [ X Y ] m x m y

CrossCorrelation=

=

Std Dev x , y

x y

2. Bernoulli Random Variable :Trial variable that give exact 2 possible outcome (success

or not success).

3. Probability Distribution Function, is a statistical function that describes all the

possible values and likelihoods that a random variable can take within a given range.

Probability density function (PDF), or density of a continuous random variable, is

a function that describes the relative likelihood for this random variable to take on a

given value.

4. Expectation random variable x = ak

Given P(x = ak)

E[ X ]= a k P ( x=a k )

k

Given fx()

E [ X ] = f x ( ) d

5. Importance of:

Mean Squared value: it measure average power of random variable.

Standard Deviation: it makes a difference whether the distribution is spread out over

a broad range or bunched up closely around the mean.

1

F( x , y)=P( X x , Y y )

Joint density function

p X , Y ( x , y)=P( X =x , Y = y )

p X , Y ( x , y )= p X ( x ) p y ( y )

Two Random variable X Y said to be orthogonal if the vectors are at perpendicular

to each other.

A set of two or more random variables is called uncorrelated if each pair of

them have no linear relationship. Covariance E(XY) - E(X)E(Y), is zero.

f ( x )=

1( x )

1

exp

2

2

Mean

Variance

= 2

___________________________________________________________________________

Exercise 1

Step 1 to 6

Syntax

Function Syntax

X=1.*randn(1,1000)+0;

%% Generate R.V. with variance=1, mean=0

plot(X);

title('Plot of Random Variable');

xlabel('x');

ylabel('y');

[Mean_Data,Variance_Data]=mean_var(X);

variance

function [m,v]=mean_var(x)

m = sum(x)/length(x)

v = sum((x-m).^2)/(length(x)-1)

end

Step 7

True Mean

=0

True variance = 1

= 0.0383

= 1.0110

Compared to true value of mean and variance, generated value have an error or difference

0.0383 and 0.0110 for mean and variance respectively.

Step 8

Increase sample e.g. up to 100000 sample

m

= -0.0012

0.9956

The difference is much smaller, calculated value of mean and variance is closer to the true

value. Larger sample will give more accurate estimation.

___________________________________________________________________________

Exercise 2

1. Random vector Y with mean = 2 and variance = 4

E[Y] = a E[X] + b

2 = a . (0) + b

b =2

Var (Y)= a2 Var (X) + 0

3

4 = a2 (1)

a =2

2. Matlab calculation of mean and variance

m

= 2.0188

v

= 3.9627

Random variable of Y tend to clustered at centre value 2, while Y at 0. The variance

has similar behaviour as mean, data of random variable Y is scattered from -5 to

-9, higher than X which is scattered within interval -3 to -3.

_____________________________________________________________________

Exercise 3

Syntax

function CDFVec=mycdffunc(X,x) %% Function

N=length(X);

for x_index=1:length(x)

CDFVec(x_index)=(1/N)*sum(X<=x(x_index));

end

end

CDFVec=mycdffunc(X,x);

plot(CDFVec)

hold on

title('Cumulative Distribution Function')

X=randn(1,20); %% Sample change for N=20,200,2000

CDFVec=mycdffunc(X,x);

4

plot(CDFVec)

hold on

legend('N=20','N=200','N=2000')

___________________________________________________________________________

Exercise 4

Syntax

Beta=3;

X=rand(1,1000);

Y=(-1/Beta)*log(X);

[Ng,n]=hist(Y,50);

Bin_width=n(3)-n(2);

Pvec=Ng/Bin_width/50;

Tpdf=3.*exp(-3*n);

plot(Pvec,n);

hold on

plot(Tpdf);

title('Transform Uniform to Exponential')

legend('Calculated Py(y)','True Value Py(y)')

Bin

1

2

3

4

5

5

Total

23

20

20

14

22

Bin

11

12

13

14

15

Total

24

18

17

23

28

Bin

21

22

23

24

25

Total

0

1

1

1

0

Bin

31

32

33

34

35

Total

1

0

0

0

1

Bin

41

42

43

44

45

Total

0

0

0

0

0

6

7

8

9

10

25

20

15

21

18

16

17

18

19

20

17

23

27

26

26

26

27

28

29

30

1

0

0

1

1

36

37

38

39

40

0

0

0

0

0

46

47

48

49

50

0

0

0

0

1

Bin_width = 0.0199

_____________________________________________________________________

Exercise 5

sigma_R = 3;

N = 10000;

U = rand(1,N);

R = sqrt(-2*sigma_R*log(U))

[Ng,n] = hist(R,20);

size(Ng)

p_hist=Ng/10000/(n(3)-n(2));

size(p_hist)

plot(n,p_hist);

Ray_pdf = (n/sigma_R).*exp(-n.^2/2/sigma_R);

hold on

plot(n,Ray_pdf,'r')

title('Uniform to Rayleigh Transform')

legend('Calculated PDF','True PDF')

- A2 Math C3 doneUploaded byWuileap
- Calculating Adjusted BetasUploaded byAhsan
- PPF notesUploaded byAlberto Carboni
- cosmanUploaded byJoyce Sangalang
- EXCEL Functions for Prob DistUploaded bygigito
- Assignment 1 by RickyUploaded byEhsan Karim
- Correlation Proof (1)Uploaded byAlan Zhong
- Levine Smume6 Ppt06 ShortenedUploaded byJoseph
- 408 Variance SolUploaded byLi Nguyen
- 011912-IntroSlidesW4150Uploaded byMiriam Melnick
- ListMF26Uploaded byMay Chee
- Probability Distribution FunctionUploaded byAnil Kumar
- Semen 19Uploaded byJoko Dewoto
- Data Science Course AgendaUploaded byDev Raj
- Statistics and ProbabilityUploaded byBrillantes JY
- Describing distributions with Numbers | Part 2 (www.ilearnmath.net)Uploaded byteachopensource
- Central LimitUploaded byAmritMohanty
- Syllabus (22)Uploaded byGuzmán Noya Nardo
- Homework 1 335 KEY (2)Uploaded byDaniel Lee Eisenberg Jacobs
- 304-Hw9 CI and HT With Rv4(1)Uploaded bySomrita Banerjee
- _24_._09_._2018_Economic DUploaded byMarius Ndong
- Chapter 7 NotesUploaded byTasleem Khâñ
- Lecture PolyglotUploaded byMuhammad Salim Ullah Khan
- ps1Uploaded byMatt Staple
- Chapter_2.pdfUploaded byMoein Razavi
- chapter6projectaustinandlaurenUploaded byapi-346025436
- STA220_TT2_2011F.pdfUploaded byexamkiller
- confidence interval mini-project pdfUploaded byapi-268986158
- Report on Household Expenditure Survey 2014Uploaded byhanafiezsqi
- VariationUploaded byVirojana Tantibadaro

- Chon mau va phan phoi chon mauUploaded byapi-19919301
- Probability and Stochastic Processes 3rd Edition Quiz SolutionsUploaded byEdward Li
- Homework 2 SolutionsUploaded byislayer
- UntitledUploaded byfmkfmk
- Maxwell Distribution Rev3Uploaded bydoug_hollings
- Tutorial 2.pdfUploaded byUddeshya Gupta
- Edu 2008 Spring c QuestionsUploaded bywillhslade
- Estadistica SolucionUploaded byFrangel Hernández Martinez
- Distribution-function.pptUploaded byherayatiesmi
- _expectation_and_Fubini_s_theorem.pdfUploaded byTing-Hui Kuo
- f5 c8 Probability Distribution NewUploaded byYoga Nathan
- Statistics QuizUploaded byMr Nerd
- Jawaban UTSUploaded byAndriyanto
- hw1Uploaded bythewodros
- Insurance RiskUploaded byAtul Yadav
- Wiley Chapter 4.docxUploaded byMarah Elaine Teves
- Probability And QUeuing Theory formulaUploaded byRavichandran Damodaran
- ProbabilityUploaded bysudersanaviswanathan
- CHAPTER 4 Normal Distribution Z-ScoresUploaded byapi-3729261
- Discrete and Continuous Probability DistributionsUploaded byjawad
- Lec 03 - Oct25Uploaded byMohamed Abdou
- ZtableUploaded bybatmanbittu
- Stats NotesUploaded byOliver Wei
- GLM Models in the Insurance BusinessUploaded byOrsi Rétallér
- Lesson 5Uploaded byTaimur Usman
- f DistributionUploaded byTeena Thapar
- z t and Chi-square TablesUploaded byFrancisco Hernandez
- Log Normal DistUploaded byEuving Au
- CHAPTER3 Continuous Probability DistributionUploaded byMari Parian Ü
- Random Variables and Probability DistributionsUploaded bybiga