Meta tags:
description= Posts about Stata written by GR;
Headings (most frequently used words):
culture, the, to, code, and, posts, tagged, stata, geeks, archives, recent, comments, blogroll, references, resources, oscar, appeal, now, these, are, names, pt, using, filefilter, make, insheet, happy, control, for, recursively, building, graph, commands, importnew, ado, requires, so, long, arial, adding, elements, graphs, as, slideshow, executing, do, files, from, text, editors, misc, links,
Text of the page (most frequently used words):
the (175), and (61), that (50), you (44), this (43), stata (40), for (37), with (30), are (22), but (21), file (21), graph (21), local (20), 2011 (18), names (18), line (17), name (16), control (16), can (16), set (15), data (14), 2012 (14), #graphs (14), which (14), files (14), format (14), command (14), year (14), have (13), not (13), legend (13), comments (12), 2010 (12), use (12), other (11), just (11), from (11), gabriel (11), write (10), text (10), march (10), 2009 (10), july (10), october (10), 2013 (10), one (10), version (10), also (10), then (10), date (10), pdf (10), when (10), rsource (10), using (9), about (9), only (9), effect (9), like (8), code (8), culture (8), april (8), june (8), november (8), rather (8), than (8), preferences (8), nt_inc_p (8), lwidth (8), thick (8), lcolor (8), elements (8), there (8), directory (8), time (8), what (7), september (7), really (7), all (7), work (7), out (7), way (7), interval (7), twoway (7), more (7), dta (7), txt (7), now (6), blog (6), things (6), simulation (6), january (6), february (6), editor (6), your (6), maxdate (6), mindate (6), order (6), first (6), they (6), into (6), program (6), obsolete (6), kdensity (6), variable (6), 1500 (6), gen (6), get (5), mac (5), imdb (5), some (5), may (5), august (5), december (5), 2017 (5), lot (5), down (5), any (5), post (5), clear (5), replace (5), here (5), how (5), talk (5), formats (5), since (5), part (5), two (5), eps (5), display (5), device (5), script (5), graphfont (5), importnew (5), control_good (5), insheet (5), grepnames (5), grep (5), sex (5), wordpress (4), com (4), research (4), social (4), posts (4), migrants (4), 2016 (4), sociology (4), diffusion (4), good (4), story (4), read (4), doesn (4), much (4), won (4), their (4), pretty (4), even (4), default (4), keep (4), drop (4), round (4), none (4), lines (4), example (4), show (4), should (4), something (4), don (4), instance (4), number (4), case (4), window (4), why (4), well (4), make (4), fonts (4), ado (4), back (4), been (4), capture (4), future (4), sourcefile (4), true (4), end (4), still (4), having (4), legendtick (4), over (4), where (4), eststo (4), perfectly (4), these (4), see (4), was (4), frequency (4), website (3), create (3), perl (3), science (3), theory (3), strange (3), afoot (3), 2020 (3), recent (3), 2021 (3), shell (3), search (3), older (3), models (3), concepts (3), interface (3), once (3), until (3), them (3), support (3), change (3), open (3), says (3), top (3), export (3), setting (3), color (3), same (3), want (3), instead (3), next (3), obvious (3), unfortunately (3), will (3), such (3), controlled (3), pdfs (3), would (3), foo (3), syntax (3), difficult (3), library (3), define (3), runiform (3), 1000 (3), close (3), day (3), includes (3), single (3), multigraph (3), 1985 (3), 2005 (3), rnormal (3), reg (3), specify (3), error (3), however (3), net (3), observed (3), extremely (3), controls (3), filefilter (3), literal (3), rossman (3), namequery (3), series (3), birth (3), reihan (3), rare (3), appeal (3), site (2), required (2), log (2), sign (2), subscribed (2), subscribe (2), privacy (2), free (2), davis (2), raw (2), center (2), population (2), org (2), eric (2), booth (2), notes (2), lseltzer (2), gabrielrossman (2), networks (2), reading (2), 2014 (2), 2015 (2), 2018 (2), lyx (2), rss (2), people (2), think (2), user (2), surprisingly (2), often (2), regression (2), etc (2), own (2), intuitive (2), song (2), itself (2), little (2), interest (2), long (2), form (2), stuff (2), checking (2), supposed (2), textmate (2), run (2), bugs (2), sitting (2), compatibility (2), many (2), compatible (2), could (2), tab (2), box (2), finder (2), though (2), after (2), editors (2), opening (2), integrated (2), habit (2), prefer (2), usually (2), behavior (2), executing (2), aaa_rock (2), navy (2), hot_ac (2), maroon (2), top_40 (2), mainstream_ac (2), xtitle (2), xmtick (2), xlabel (2), labsize (2), vsmall (2), angle (2), forty_five (2), tdmon_dd (2), _ccyy (2), aaa (2), rock (2), hot (2), mainstream (2), graphregion (2), fcolor (2), white (2), images (2), transparent (2), multiple (2), times (2), identical (2), except (2), missing (2), yesterday (2), explain (2), crossover (2), native (2), better (2), reveal (2), bit (2), most (2), match (2), another (2), has (2), problem (2), adding (2), appear (2), audience (2), general (2), flow (2), interesting (2), nothing (2), bullet (2), three (2), thanks (2), checked (2), recommend (2), devices (2), options (2), least (2), type (2), fixed (2), note (2), means (2), low (2), fontface (2), fontfaceserif (2), echo (2), issue (2), different (2), everything (2), looking (2), font (2), arial (2), find (2), changing (2), learn (2), because (2), handling (2), convention (2), style (2), option (2), new (2), backwards (2), saveold (2), great (2), versions (2), foreign (2), erase (2), nice (2), need (2), anyway (2), sender (2), fix (2), especially (2), friends (2), who (2), trouble (2), requires (2), replicate (2), hard (2), call (2), var (2), legends (2), handle (2), recursively (2), quote (2), 1990 (2), 1995 (2), 2000 (2), reflects (2), both (2), esttab (2), nodepvars (2), nomtitles (2), penalty (2), without (2), reality (2), specification (2), main (2), trying (2), 474 (2), 257 (2), 073 (2), 065 (2), 492 (2), 023 (2), _cons (2), 577 (2), 319 (2), 054 (2), 048 (2), might (2), zero (2), fact (2), typically (2), related (2), say (2), assumption (2), associated (2), continuous (2), dealing (2), twitter (2), quotes (2), does (2), chokes (2), taking (2), repeated (2), know (2), had (2), thoughts (2), users (2), documents (2), codeandculture (2), popular (2), reasons (2), cohorts (2), security (2), real (2), regexs (2), regexm (2), yob (2), ren (2), basis (2), put (2), named (2), slight (2), big (2), lah (2), per (2), black (2), unique (2), dash (2), oscar (2), started, design, email, comment, loading, collapse, bar, manage, subscriptions, view, reader, report, content, already, account, join, 128, subscribers, unix, tutorial, ucla, academic, technology, services, safari, books, gated, internet, movie, database, ninja, cpanda, california, references, resources, jenn, lena, gabi, huiber, tidbit, week, michael, mitchell, daily, sociological, imagination, statistics, harvard, soc2econ, rense, corten, religion, curiosities, permutations, econometrics, disgruntled, sociologist, drip, ssrc, blogroll, list, cogiddo, jdgalt, soc, edudammerung, universe, kenny, online, teaching, 2019, 2022, 2025, archives, typesetting, superstar, socm176, organizations, scraping, satire, resampling, regular, expressions, random, variables, python, power, analysis, philosophy, phenomenology, netlogo, macros, loops, history, genetics, financial, crisis, ethnomethodology, epistemology, economic, economics, culure, cleaning, causality, categorization, bayesian, asa, pkremp, geeks, ethical, misgivings, forging, agent, string, wget, looks, firefox, bimbots, scrape, facebook, comes, logit, pedagogy, try, emphasize, meaning, mathematical, plug, chug, formulae, hand, proofs, explanation, absolutely, loved, npr, planet, money, making, rihanna, man, fond, reminds, bing, crosby, david, bowie, singing, drummer, boy, matching, cardigans, production, listen, atc, linked, short, podcast, useful, nearly, tight, integration, worth, fine, minor, word, fink, yet, sounds, again, few, months, worked, snow, leopard, features, anything, developers, implement, applications, apps, resume, detailed, overview, lion, misc, links, alternately, rewrite, probably, overkill, console, fortunately, easily, advanced, sub, uncheck, edit, opened, applies, launched, market, managers, defaults, running, creature, external, pipe, current, makes, somewhat, inconvenient, final_f, artist, sara, bareilles, sum, max, min, sarabareilles_lovesong_1, dkorange, forest_green, sarabareilles_lovesong_2, did, basic, trick, exact, colors, conceal, standard, s2color, scheme, ideally, completely, added, smooth, transition, full, gave, dissolve, similarly, possible, tables, ready, crop, cover, boxes, background, ugly, clunky, tightly, commingled, generate, properly, grow, larger, crowding, tricks, successful, presentation, limit, sees, ahead, preserve, sense, timing, helps, attention, focusing, expectations, counter, therefore, boring, seeing, ten, points, realizing, speaker, slideshow, whose, helped, figure, statalist, haven, wouldn, surprised, windows, matter, oddities, understanding, relies, creating, considers, got, earlier, platforms, looked, graphexportpdf, base, suppress, screen, rendering, level, palatino, aren, wysiwyg, interactive, look, saved, disk, turn, inconsistent, depending, avoid, confusion, serif, intrinsically, confusing, breaks, specifying, similar, targeting, implication, gui, bits, gnuplot, ghr, uses, collaborator, forgot, caution, introduced, dependency, exists, path, reference, specific, location, off, copy, pwd, paste, sep, setwd, convert, factors, false, vanilla, tested, please, positive, negative, results, remember, installed, side, pinch, reason, impose, recipient, careful, dataset, updating, lately, hearing, were, rewrote, importspss, translate, coded, above, forvalues, disp, selection, criteria, looping, involves, embedded, marks, multi, scatterplots, marker, categories, compact, easier, compare, parentheses, condition, building, commands, obs, persists, disappears, entirely, measuring, cautious, whether, further, cram, measure, 005, 053, 980, 025, 538, 038, let, appreciate, exactly, happens, raises, question, controlling, bundle, noisy, indicator, latent, human, capital, model, self, reported, highest, degree, attained, leaves, aspects, formal, education, gpa, major, institution, quality, forms, preference, correlated, indeed, omitted, bias, measurement, typical, allow, tends, values, spurious, finding, mediated, through, actual, common, estimation, strategy, roland, fryer, calls, residual, throw, whatever, remains, introduce, goes, simulated, dummy, negatively, solved, natively, observations, guys, foo2, collected, tweets, sometimes, contain, escapes, backslash, recognize, characters, unbalanced, realized, night, test, left, censorship, batch, textwrangler, course, scriptable, contemplating, plunge, hive, mind, suggested, escaped, apostrophes, modeled, recently, someone, mostly, works, strings, being, finicky, takes, frequently, ends, throwing, half, rows, point, stray, character, throws, row, thereafter, gotten, excel, xlsx, tolerable, relatively, small, importing, scale, imports, large, happy, yes, those, stories, thing, retell, mocking, commentary, underlying, incident, eggs, coffee, breakfast, nobody, likely, forward, mail, repeating, particular, banal, accurate, nugget, inspiration, book, apply, bass, film, office, jay, diverse, entropy, indices, adolph, classic, lieberson, became, less, numbers, scaled, size, either, administration, noticeably, worse, prior, 1920, grown, tempfile, fillin, recode, sort, male, female, title, cohort, meet, minimal, threshold, quick, dirty, automate, wrote, called, give, arguments, sensitive, gives, births, despite, personally, american, actually, never, asked, him, photo, remain, possibility, salam, memorable, nom, plume, his, certificate, jason, miller, brian, anywhere, closed, caveat, include, occur, five, given, while, misses, fat, downloads, lahd, tell, evidence, web, searchable, thus, very, downloading, efficiently, going, unzipped, archive, grepping, appears, variation, existing, facts, documented, literature, girls, eclectic, demographic, group, high, premium, creativity, second, coinages, characteristic, prefix, consonant, pair, third, distinctly, object, bewildered, mockery, others, retelling, theme, urban, exclusion, follow, systematic, rules, apocryphal, inspired, play, conversation, discuss, today, somebody, girl, pronounced, silent, fan, years, although, commensurate, favorite, whereas, interested, generally, concern, across, finite, contains, constructing, schilke, cigar, tagged, hello, world, home,
Text of the page (random words):
ith a backslash however stata does not recognize this convention and it chokes on this when the quote characters are unbalanced i realized this the other night when i was trying to test for left censorship and fixed it using the batch find replace in textwrangler of course this is not scriptable and so i was contemplating taking the plunge into perl when the modeled behavior hive mind suggested the stata command filefilter using this command i can replace the escaped literal quotes which chokes stata s insheet with literal apostrophes which stata s insheet can handle filefilter foo txt foo2 txt from bs q to rq problem solved natively in stata and i have about 25 more observations thanks guys june 8 2012 at 1 24 pm gr 3 comments control for x gabriel an extremely common estimation strategy which roland fryer calls name that residual is to throw controls at an effect then say whatever effect remains net of the controls is the effect typically as you introduce controls the effect goes down but not all the way down to zero here s an example using simulated data where we do a regression of y continuous on x dummy with and without control continuous and negatively associated with x 1 2 x 0 474 0 257 0 073 0 065 control 0 492 0 023 _cons 0 577 0 319 0 054 0 048 n 1500 1500 so as is typical we see that even if you allow that x 1 tends to be associated with low values for control you still see an x penalty however this is a spurious finding since by assumption of the simulation there is no actual net effect of x on y but only an effect mediated through the control this raises the question of what it means to have controlled for something typically we re not really controlling for something perfectly but only for a single part of a bundle of related concepts or if you prefer a noisy indicator of a latent variable for instance when we say we ve controlled for human capital the model specification might only really have self reported highest degree attained this leaves out both other aspects of formal education eg gpa major institution quality and other forms of hc eg g and time preference these related concepts will be correlated with the observed form of the control but not perfectly indeed it can even work if we don t have omitted variable bias but just measurement error on a single variable as is the assumption of this simulation to get back to the simulation let s appreciate that the control is really the control as observed if we could perfectly specify the control variable the main effect might go down all the way to zero in fact in the simulation that s exactly what happens 1 2 3 x 0 474 0 257 0 005 0 073 0 065 0 053 control 0 492 0 023 control_good 0 980 0 025 _cons 0 577 0 319 0 538 0 054 0 048 0 038 n 1500 1500 1500 that is when we specify the control with error much of the x penalty persists however when we specify the control without error the net effect of x disappears entirely unfortunately in reality we don t have the option of measuring something perfectly and so all we can do is be cautious about whether a better specification would further cram down the main effect we re trying to measure here s the code clear set obs 1500 gen x round runiform gen control_good rnormal 05 1 x 2 gen y control_good rnormal 0 5 1 gen control control_good rnormal 0 5 1 eststo clear eststo reg y x eststo reg y x control esttab se b 3 se 3 nodepvars nomtitles eststo reg y x control_good esttab se b 3 se 3 nodepvars nomtitles have a nice day march 15 2012 at 5 29 am gr 8 comments recursively building graph commands gabriel i really like multi line graphs and scatterplots where the marker color style reflects categories such graphs are both more compact than just having multiple graphs and they make it easier to compare different things the way you do this is with twoway a lot of parentheses and the if condition for example twoway kdensity x if year 1985 kdensity x if year 1990 kdensity x if year 1995 kdensity x if year 2000 kdensity x if year 2005 legend order 1 1985 2 1990 3 1995 4 2000 5 2005 unfortunately such graphs can be difficult to script this is especially so for the legends which by default show the variable name rather than the selection criteria i handle this by recursively looping over a local which in the case of the legend involves embedded quote marks capture program drop multigraph program define multigraph local var 1 local interval 2 local command local legend local legendtick 1 forvalues i 1985 interval 2005 local command command kdensity var if year i local legend legend legendtick i local legendtick legendtick 1 disp twoway command legend legend twoway command legend order legend end to replicate the hard coded command above you d call it like this multigraph x 5 march 8 2012 at 9 56 am gr 2 comments importnew ado requires r gabriel after hearing from two friends in a single day who are still on stata 10 that they were having trouble opening stata 12 dta files i rewrote my importspss ado script to translate stata files into an older format by default stata 9 i ve tested this with stata 12 and in theory it should work with older versions but please post positive or negative results in the comments remember that you need to have r installed anyway i would recommend handling the backwards compatibility issue on the sender s side with the native saveold command but this should work in a pinch if for some reason you can t impose on the sender to fix it and you need to fix it on the recipient s end be especially careful if the dataset includes formats that stata s been updating a lot lately e g the date formats the syntax is just importnew foo dta here s the code importnew ado by ghr 10 7 2011 this script uses r to make new stata files backwards compatible that is use it when your collaborator forgot to use saveold use great caution if you are using data formats introduced in recent versions eg tb dependency r and library foreign if r exists but is not in path change the reference to r in line 29 to be the specific location capture program drop importnew program define importnew set more off local future 1 local version 9 version number for your copy of stata local obsolete round runiform 1000 local sourcefile round runiform 1000 capture file close rsource file open rsource using sourcefile r write text replace file write rsource library foreign _n file write rsource directory c pwd _n file write rsource future future _n file write rsource obsolete paste obsolete dta sep _n file write rsource setwd directory _n file write rsource data read dta future convert factors true missing type false _n file write rsource write dta data file obsolete version version _n file close rsource shell r vanilla sourcefile r erase sourcefile r use obsolete dta clear erase obsolete dta end have a nice day october 10 2011 at 11 15 am gr so long arial gabriel now that i ve been looking into setting my graphs in a serif font instead of the default arial i find that changing fonts in stata graphs is surprisingly difficult it s not that it s intrinsically difficult just confusing to learn because stata s handling of fonts breaks with the general stata convention of specifying options as part of a command and is instead more similar to the gnuplot style of changing device preferences then executing a command targeting the device one implication of this is that there s no option to change the graph font in the graph gui interface which is how i usually learn new bits of command line syntax another issue is that graphs aren t wysiwyg rather the interactive display graph can look different from the graph saved to disk and that in turn can be inconsistent depending on what file format you use to avoid confusion i just set everything at once like this local graphfont palatino graph set eps fontface graphfont graph set eps fontfaceserif graphfont graph set eps echo back preferences graph set window fontface graphfont graph set window fontfaceserif graphfont graph set window echo back preferences one of the oddities is that there is no set of pdf options rather at least on a mac you control the pdf device as part of the display device window my understanding is that stata for mac relies on the low level os x pdf support for creating pdfs and this would explain why it considers pdf to be part of the display device rather than one of the file type devices as well as why it won t make pdfs if you suppress screen rendering why stata for mac got pdf support earlier than the other platforms and why the pdfs looked like this until they fixed it in 11 2 and 12 note that this means that your pdf will use the eps fonts if you use my graphexportpdf ado script and the display fonts if you use the base graph export foo pdf syntax i haven t checked but i wouldn t be surprised if the pdf preferences in stata for windows are controlled by the eps preferences rather than the display preferences in any case i recommend just setting all devices the same so it won t matter thanks to eric booth whose statalist post helped me figure this out october 5 2011 at 4 00 am gr 8 comments adding elements to graphs as a slideshow gabriel one of the tricks to a successful presentation is to limit what your audience sees so they don t get ahead of you and also to preserve a general sense of timing and flow this helps keep the audience s attention and also is good for focusing expectations in such a way that the next bit is counter intuitive and therefore interesting nothing is so boring as sitting in a talk and seeing ten bullet points and realizing that the speaker is only on bullet number three similarly if you re using graphs in a talk which you should as much as possible since they read better than tables you may only want to reveal part of a graph as you talk about it then reveal the next bit when you re ready the most obvious way to do this is to just crop the graph or cover it with boxes that match the background or something unfortunately that s ugly and clunky and doesn t work if the graph elements are tightly commingled another way to do it is to generate two graphs one of which has the elements and the other of which doesn t the problem with this is that the graphs don t match up properly for instance if you have a line graph and you keep adding lines to it the legend will first appear and then grow larger crowding out the graph itself ideally what you want is a set of graphs that are completely identical except some elements are missing in one version which are added in the other version you can then line the graphs up talk about the first set of elements and then do a smooth transition to the version with the full set of elements here s an example from the talk i gave yesterday in order to explain crossover i first show the song s native formats then dissolve to also show the crossover formats here s how i did it the basic trick is that stata can create transparent graph elements by setting the color to none you do the exact same graph multiple times you just set colors to be transparent when you want to conceal elements that is the code in lines 10 14 is identical to that in lines 17 21 except that lines 13 and 14 set line color to none instead of stata s standard s2color scheme use final_f clear keep if artist sara bareilles drop if format all format other sum date local maxdate r max local mindate r min local interval maxdate mindate 10 local interval round interval 7 twoway line nt_inc_p date if format aaa_rock lwidth thick lcolor navy line nt_inc_p date if format hot_ac lwidth thick lcolor maroon line nt_inc_p date if format top_40 lwidth thick lcolor none line nt_inc_p date if format mainstream_ac lwidth thick lcolor none xtitle xmtick mindate 7 maxdate xlabel mindate interval maxdate labsize vsmall angle forty_five format tdmon_dd _ccyy legend order 1 aaa rock 2 hot ac 3 top 40 4 mainstream ac graphregion fcolor white graph export images sarabareilles_lovesong_1 pdf replace twoway line nt_inc_p date if format aaa_rock lwidth thick lcolor navy line nt_inc_p date if format hot_ac lwidth thick lcolor maroon line nt_inc_p date if format top_40 lwidth thick lcolor dkorange line nt_inc_p date if format mainstream_ac lwidth thick lcolor forest_green xtitle xmtick mindate 7 maxdate xlabel mindate interval maxdate labsize vsmall angle forty_five format tdmon_dd _ccyy legend order 1 aaa rock 2 hot ac 3 top 40 4 mainstream ac graphregion fcolor white graph export images sarabareilles_lovesong_2 pdf replace october 4 2011 at 4 42 am gr 2 comments executing do files from text editors gabriel stata now defaults to opening a do file in the integrated do file editor rather than just running it the integrated do file editor is now pretty good but i m a creature of habit and i prefer to use an external text editor usually textmate then pipe to stata the current default behavior makes this somewhat inconvenient fortunately you can change this pretty easily in the preferences open stata s preferences go to the do file tab and then the advanced sub tab now uncheck the box that says edit do files opened from the finder in do file editor even though it says from the finder this also applies to do files launched pretty much any way you can think of after market file managers text editors etc alternately you could rewrite your text editor s stata support to use stata console but that s probably overkill september 28 2011 at 5 18 am gr 3 comments misc links gabriel useful detailed overview of lion the user interface stuff doesn t interest me nearly as much as the tight integration of version control and resume also worth checking if your apps are compatible stata and lyx are supposed to work fine textmate is supposed to run ok with some minor bugs no word on r fink doesn t work yet it sounds good but i m once again sitting it out for a few months until the compatibility bugs get worked out also as with snow leopard many of the features won t really do anything until developers implement them in their applications i absolutely loved the npr planet money story on the making of rihanna s man down not so fond of the song itself which reminds me of bing crosby and david bowie singing little drummer boy in matching cardigans if you have any interest at all in production of culture read the blog post and listen to the long form podcast the atc version linked from the blog post is the short version good explanation of e which comes up surprisingly often in sociology logit regression diffusion models etc i like this a lot as in my own pedagogy i really try to emphasize the intuitive meaning of mathematical concepts rather than just the plug and chug formulae on the one hand or the proofs on the other people are using bimbots to scrape facebook and to think that i have ethical misgivings about forging a user agent string so wget looks like firefox july 20 2011 at 3 46 pm gr older posts rss posts rss comments the culture geeks gr pkremp search for asa bayesian categorization causality cleaning c...
|