SHAZAM Questions and Answers (Q&A) - RSS feedhttp://community.econometrics.com/questions/SHAZAM Econometrics, Statistics and Analytics Communityen<font color="white">Copyright <b>SHAZAM Analytics, 2018</b></font>Wed, 15 Feb 2017 20:45:26 +0000MATRIX ALGEBRAhttp://community.econometrics.com/question/746/matrix-algebra/ I have a matrix A. Let's say 10 columns and 50 rows. Problem: I want to delete rows 25 to 30, and use the remaining part of the matrix in the calculations. I checked the Shazam manual (pp. 406-407), but the example was not easy to understand. Any good ideas how to delelete rows (and columns)?
Regards,
TL Thu, 02 Feb 2017 13:26:06 +0000http://community.econometrics.com/question/746/matrix-algebra/Answer by SHAZAMHelp for <p>I have a matrix A. Let's say 10 columns and 50 rows. Problem: I want to delete rows 25 to 30, and use the remaining part of the matrix in the calculations. I checked the Shazam manual (pp. 406-407), but the example was not easy to understand. Any good ideas how to delelete rows (and columns)?</p>
<p>Regards,
TL </p>
http://community.econometrics.com/question/746/matrix-algebra/?answer=747#post-id-747You are on the right track using the COPY command. You just need to specify the starting and ending rows. Here is an example:
* Create random matrix
matrix A = uni(10,2)
print A
* Copy the last 5 rows of A into the 1st 5 rows of B
dim B 5 2
copy A B / frow=6;10 trow=1;5
print B
Hope this helps.Sat, 04 Feb 2017 17:58:09 +0000http://community.econometrics.com/question/746/matrix-algebra/?answer=747#post-id-747Comment by TL for <p>You are on the right track using the COPY command. You just need to specify the starting and ending rows. Here is an example:</p>
<pre><code>* Create random matrix
matrix A = uni(10,2)
print A
* Copy the last 5 rows of A into the 1st 5 rows of B
dim B 5 2
copy A B / frow=6;10 trow=1;5
print B
</code></pre>
<p>Hope this helps.</p>
http://community.econometrics.com/question/746/matrix-algebra/?comment=748#post-id-748It helps, but not 100%. Question: Let's say you want to delete rows # 5, 6, and 7. Great if you can provide us with a solution.
TL.Wed, 08 Feb 2017 10:10:02 +0000http://community.econometrics.com/question/746/matrix-algebra/?comment=748#post-id-748Comment by TL for <p>You are on the right track using the COPY command. You just need to specify the starting and ending rows. Here is an example:</p>
<pre><code>* Create random matrix
matrix A = uni(10,2)
print A
* Copy the last 5 rows of A into the 1st 5 rows of B
dim B 5 2
copy A B / frow=6;10 trow=1;5
print B
</code></pre>
<p>Hope this helps.</p>
http://community.econometrics.com/question/746/matrix-algebra/?comment=749#post-id-749Solution: I think the following script will do:
sample 1 4 8 10
copy A:1 A:2 BWed, 08 Feb 2017 11:08:01 +0000http://community.econometrics.com/question/746/matrix-algebra/?comment=749#post-id-749Comment by SHAZAMHelp for <p>You are on the right track using the COPY command. You just need to specify the starting and ending rows. Here is an example:</p>
<pre><code>* Create random matrix
matrix A = uni(10,2)
print A
* Copy the last 5 rows of A into the 1st 5 rows of B
dim B 5 2
copy A B / frow=6;10 trow=1;5
print B
</code></pre>
<p>Hope this helps.</p>
http://community.econometrics.com/question/746/matrix-algebra/?comment=750#post-id-750Yes that is correct. Note that you don't need to specify the columns if taking the whole matrix so the
copy A:1 A:2 B
can just be
copy A BFri, 10 Feb 2017 09:06:16 +0000http://community.econometrics.com/question/746/matrix-algebra/?comment=750#post-id-750Comment by TL for <p>You are on the right track using the COPY command. You just need to specify the starting and ending rows. Here is an example:</p>
<pre><code>* Create random matrix
matrix A = uni(10,2)
print A
* Copy the last 5 rows of A into the 1st 5 rows of B
dim B 5 2
copy A B / frow=6;10 trow=1;5
print B
</code></pre>
<p>Hope this helps.</p>
http://community.econometrics.com/question/746/matrix-algebra/?comment=751#post-id-751Thanks!Wed, 15 Feb 2017 20:45:26 +0000http://community.econometrics.com/question/746/matrix-algebra/?comment=751#post-id-751