Aug 22

Edit Remote Files in TextMate Tabs

Tag: mac, os x, tricksadmin @ 4:48 pm

If you want to edit remote files in TextMate (say with Transmit over FTP), opening them up usually means individual windows.  No more.  Follow these simple instructions and you can have a project with tabs whenever you edit a remote file.


Jul 04

Export tab delimited files in PHPMyAdmin

Tag: mysql, tricksadmin @ 2:10 pm

Although there is not an explicit option to export a MySQL table to a tab-delimited file in PHPmyAdmin, it is possible. Simply go the database of your choice, then select the table for export. Then click on the “Export” tab and on that page select “CSV.” Finally, in the field “Fields terminated by” put in ‘\t’ without the quotes. Note that it saves the files with a ‘.csv’ extension, but that shouldn’t matter to most applications.


Jun 24

Save Estimation Results in Stata

Tag: stata, tricksadmin @ 6:40 pm

JohnZ posted a solution to saving your coefficient estimates in Stata to a simple dataset. Here is the code:

*!
*! est2data.ado --
*!
*! Usage: est2data nbase outfname
*!
*! Saves the 'b' and 'se' vectors of the most recent estimation results
*! to a dataset named 'outfname', using 'nbase' as the base name for the
*! dataset columns.
*!
*! Also saves variable labels. Each row of the resulting dataset
*! is a coefficient estimate.
*!
program define est2data
preserve
args nbase outfname
drop in 1/`c(N)'
matrix bvec = e(b)'
matrix vvec = vecdiag(e(V))'
svmat bvec, names(`nbase'_est)
svmat vvec, names(`nbase'_se)
quietly: replace `nbase'_se = sqrt(`nbase'_se)

local vnames: rownames bvec
local numv: list sizeof vnames
quietly: gen `nbase'_names = ""
quietly: gen `nbase'_lbl = ""
forvalues ivar = 1/`numv' {
local thisv: word `ivar' of `vnames'
quietly: replace `nbase'_names = "`thisv'" in `ivar'
local thislbl "NA"
capture local thislbl: variable label `thisv'
quietly: replace `nbase'_lbl = "`thislbl'" in `ivar'
}
keep `nbase'_*
notes: "e(N) `e(N)'"
notes: "e(depvar) `e(depvar)'"
notes: "e(ll) `e(ll)'"
notes: "e(cmd) `e(cmd)'"
save `outfname', replace
end

Thanks John!


Jun 24

Creating a bootstrap sample in Matlab

Tag: matlab, tricksadmin @ 9:15 am

Let x be your vector of data which has to be bootstrapped. For each instance of the loop write:

x = x(floor(rows(x)*rand(rows(x),1))+1,:); % bootstrap observations

Now we have a matrix with the same number of rows and columns, but with re-sampled data with replacement. A one line bootstrap! (Modified code from John Cochrane)


Jun 20

Writing "converges in probability" in LaTeX

Tag: latex, tricksadmin @ 1:59 pm

Ella posted a comment on the site that shows how to write “converges in probability” in LaTeX:

\stackrel{p}{\longrightarrow}

with either “$ $” or “\[ \]” or “\begin{equation}” around it. Thanks Ella.


Jun 08

Inserting figures in LaTeX

Tag: latex, tricksadmin @ 7:17 pm

…is a non-trivial exercise. This page has a great summary of the various options. The basic form is:

\begin{figure}[htp]
\centering
\includegraphics[totalheight=0.3\textheight]{amount_raised.png}
\caption{Amount invested in venture capital rounds 1987 - 2006}\label{fig:araised}
\end{figure}