Created
October 30, 2015 12:08
-
-
Save hyamamoto/124b5882ff4a79d7b150 to your computer and use it in GitHub Desktop.
Self-study note: Playing with SAS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d = { | |
0 1 0 0, | |
2 1 0 0, | |
0 1 0 4 | |
}; | |
e = d`; | |
e2 = t(d); | |
a = { | |
1 2, | |
3 4 | |
}; | |
b = { | |
5 6, | |
7 8 | |
}; | |
b2 = a # b; | |
sum = sum(b2); | |
c = a * b; | |
d = a * inv(b); | |
e = a / b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = { | |
1 2, | |
3 4 | |
}; | |
b = det(a); | |
c = int(a); | |
d = a * c; | |
a = { | |
1 2, | |
3 4 | |
}; | |
b = { | |
5 6, | |
7 8 | |
}; | |
TRA = trace(a); | |
TRB = trace(b); | |
TRA_B = trace(a + b) | |
TRAB = trace(a * b) | |
TRBA = trace(b * a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc iml; reset print; | |
X = { | |
1 1, | |
1 1, | |
1 2, | |
1 2, | |
1 3, | |
1 3 | |
}; | |
Y = {1, 2, 1, 3, 2, 3}; | |
Xr = nrow(X); | |
Xc = ncol(X); | |
XX = X` * X; | |
XY = X` * Y; | |
i_XX = inv(XX); | |
b = i_XX * XY; | |
Yhat = X * b; | |
e = Y - Yhat; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data data; | |
input x y; | |
cards; | |
1 1 | |
1 2 | |
2 1 | |
2 3 | |
3 2 | |
3 3 | |
; | |
proc reg data = data; | |
model y = x; | |
run; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Practice 1; | |
A = { | |
1 2 1, | |
2 3 1, | |
1 2 2 | |
}; | |
TRA = trace(A); | |
dA = det(A); | |
iA = inv(A); | |
* Practice 2; | |
B = { | |
2 1 -3, | |
-1 2 1, | |
3 -1 2 | |
}; | |
C = { | |
-12, | |
7, | |
-1 | |
}; | |
D = inv(B) * C; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc iml; | |
reset print; | |
a = 2; | |
print a; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment