A mata question: when I use the function affinity() [code below]
I get the results I expect, but the colon comparison operations
result in the resulting matrix being written to the Stata results
window [quite a nuisance for logging purposes]. Any thoughts why
this happens?
Thanks!
Tom
real colvector affinity(real rowvector ai, real matrix aj, real
rowvector sd) {
real matrix aij, upper, lower
aij = J(rows(aj), 1, 0)
upper = J(rows(aj), cols(aj), 0)
lower = J(rows(aj), cols(aj), 0)
upper = aj
printf("upper has %4.0g columns and %9.0g rows\n", cols(upper),
rows(upper))
lower = aj
// These two operations print out the entire resulting matrix to the
screen
upper:<= ai+sqrt(sd)
lower:>= ai-sqrt(sd)
upper:& lower
aij = rowsum(upper)
printf("aij has %4.0g columns and %9.0g rows\n", cols(aij), rows(aij))
return(aij)
}
--
*********************************************
Thomas Masterson
Research Scholar
Distribution of Income and Wealth Project
Levy Economics Institute of Bard College
Annandale-on-Hudson, NY 12504
(845) 758-7715
http://www.levy.org
*********************************************
*
* 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/