Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
c35ec4b5
Commit
c35ec4b5
authored
Apr 07, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
StatRed: completed question 21.
parent
183196e1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
statred/ass1/q21-multivariate.py
statred/ass1/q21-multivariate.py
+44
-0
No files found.
statred/ass1/q21-multivariate.py
0 → 100644
View file @
c35ec4b5
from
pylab
import
array
,
eig
,
diagflat
,
dot
,
sqrt
,
randn
,
tile
from
pylab
import
plot
,
axis
,
show
,
figure
,
clf
mean
=
array
([[
3
],
[
4
],
[
5
],
[
6
]])
cov
=
array
(
[[
3.01602775
,
1.02746769
,
-
3.60224613
,
-
2.08792829
],
[
1.02746769
,
5.65146472
,
-
3.98616664
,
0.48723704
],
[
-
3.60224613
,
-
3.98616664
,
13.04508284
,
-
1.59255406
],
[
-
2.08792829
,
0.48723704
,
-
1.59255406
,
8.28742469
]])
samples
=
1000
vector_size
=
4
figure
(
1
)
clf
()
d
,
U
=
eig
(
cov
)
L
=
diagflat
(
d
)
A
=
dot
(
U
,
sqrt
(
L
))
X
=
randn
(
vector_size
,
samples
)
Y
=
dot
(
A
,
X
)
+
tile
(
mean
,
samples
)
#import matplotlib.pyplot as plt
for
i
in
range
(
4
):
for
j
in
range
(
4
):
if
i
!=
j
:
plot
(
Y
[
i
],
Y
[
j
],
'x'
)
axis
(
'equal'
)
#plt.plot(x,y,'x');
#plt.axis('equal');
#plt.show()
show
()
#import numpy as np
#x,y = np.random.multivariate_normal(mean, cov, 5000).T
#print 'x:', x
#print 'y:', y
#plt.plot(x,y,'x'); plt.axis('equal'); plt.show()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment