Conformability Error Stata
Contents |
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: st: 3200 conformability error when writing to stata variable from mata From Aaron Kirkman
Stata Factor Conformability Error
to work. Thank you, Aaron On Fri, Sep 14, 2012 at 12:00 AM, Nick Cox
Stata Mata Conformability
with 74 observations. By Mata's rules the two are not > conformable. > > It might be suggested that a reasonable default would be that Mata put this > vector in the first 20 observations. Or again, into the last 20 > observations. However, defaults such as those are not part of the Mata-Stata > game. You need to be explicit about which observations are to receive the > values in this vector. > conformability error stata matrix > Nick > > > On 14 Sep 2012, at 05:38, Aaron Kirkman
st: Conformability error in creating matrix while cross-tabulating data Date Thu, 5 Jul 2007 11:05:14 -0400 Dear Statalist, I am trying to get the frequency of certain variables and put it in a matrix (see
Stata Conformability Error 3200
code below). I need to cross tabulate each variable q271-q277 with each stata conformability error 503 variable q256-q260. I then need to add the frequencies of q256-q258 as one group and q259-q260 as the other conformability error mata group. Finally, I want to create a 7 x 2 matrix of the results (q271-q277 will be the 7 rows; and q256-q258 & q259-q260 will be the 2 columns). I ran http://www.stata.com/statalist/archive/2012-09/msg00601.html the following code, but am getting "conformability error". I think the problem is that I want a 7 x 2 matrix, but I'm using i = 271/277 rather than i=1/7. If this is the case, can you suggest an alternative? P.S. - Right now, I have variables q1-q7. I tried to drop them and rename q271-q277 as q1-q7 (in case this was http://www.stata.com/statalist/archive/2007-07/msg00165.html the issue), without much luck. Thanks, Hugh matrix results = J(7,2,.); forval i = 271/277 {; count if q`i'~=. & q256~=.; local a = r(N); count if q`i'~=. & q257~=.; local a = `a' + r(N); count if q`i'~=. & q258~=.; matrix results[`i',1] = `a' + r(N); count if q`i'~=. & q259~=.; local b = r(N); count if q`i'~=. & q260~=.; matrix results[`i',2] = `b' + r(N); }; matrix colnames results = NP FP; matrix rownames results = q271 q272 q273 q274 q275 q276 q277; matrix li results, noheader; * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ Follow-Ups: st: RE: Conformability error in creating matrix while cross-tabulating data From: "Nick Cox"
many ways to R, Matlab or GAUSS. It does have some unique and intriguing features however. One is that it is a compiled language rather than interpreted, which improves performance. It also has been parallelized in Stata/MP (available on all the SSCC Linux servers and Condor) which https://www.ssc.wisc.edu/sscc/pubs/4-26.htm dramatically improves performance. On the other hand Mata is fairly new and has not yet "caught on" at the SSCC, so we don't have any real-world comparisons to offer. Mata is not a replacement for Stata, nor is it intended to be a stand-alone statistical package. It is a tool which is best used as a supplement to Stata (or SAS or SPSS), for doing those things Stata does not do well on its own. In particular, Mata does not conformability error work in the context of a single data set, giving it additional flexibility. But you should not try to learn Mata unless you are already familiar with Stata or another statistical package. Mata is a relatively "low level" language. Much of your time in Stata (or SAS or SPSS) is spent using built-in programs, finding just the right combination of options to get Stata to do what you want. In Mata you will take direct control, telling Mata what you conformability error stata want to do step-by-step. (The Mata optimizer, which we will discuss at length, is a notable exception.) That means doing simple things is usually more cumbersome in Mata than in Stata, but Mata has fewer constraints. This article is primarily written for people who have significant experience using Stata, SAS or SPSS syntax, but no other programming languages. Thus there will be a lot of emphasis on learning how to do useful things by manipulating matrices, and many of the examples are designed to give experience doing so as well as illustrating a particular concept. Matlab and GAUSS veterans may find they can skim these sections, focusing on what is new to them. C programmers will find that Mata imitates C whenever it can, so they can probably skim the sections on standard programming constructs like loops. But no matter what your background, you will learn far more if you read this article at the computer, with Stata running, and actually type in the examples. Mata runs within Stata, so in order to use Mata you'll need to know how to run a Stata program, called a do file. If you've never used Stata, please read the section on do files in An Introduction to Stata. Interactive Stata (i.e. start it up and type in commands) is a great way to learn and that's how you'll do the examples in this article. But for real work you'll
be down. Please try the request again. Your cache administrator is webmaster. Generated Tue, 04 Oct 2016 20:55:07 GMT by s_hv972 (squid/3.5.20)