Jun 30

No undo in Stata do file editor

Tag: stataadmin @ 11:35 am

I persistently hit “command+S” or “cntrl+S” when editing any file. Unfortunately, in Stata’s built-in do file editor (on the Mac at least) once I hit such a command, the undo history clears. This is a horrible feature. All other modern editors keep a running history of all edits so that undo can be called as often as possible. Combine this problem with a lack of syntax-highlighting and no line-specific errors, and Stata is even more difficult to use.


Jun 29

Delete non-empty directory in unix/linux/mac os x

Tag: linux, os xadmin @ 3:13 pm

Just type

rm -rf directory_name


Jun 28

Wednesday was IPO Day

Tag: news, venture capitaladmin @ 12:31 pm

Perhaps in response to my post on the increased cost of IPOs and the advent of new markets to go public, Wednesday had 5 successful IPOs. VentureBeat reports that comScore, Data Domain, Spreadtrum Communications, Spectra Energy Partners and AuthenTec each had significant first day returns. Is this a signal of the top of the market?


Jun 27

Use remote files in Matlab

Tag: matlab, storageadmin @ 9:21 am

If you have an FTP server set-up somewhere with ample space and bandwidth, Matlab can store and retrieve its files and data remotely. Just use these simple commands to connect and disconnect:

% File to connect to the betanaught.com server where my Matlab/data resides

% connect to the db
f = ftp('yourdomain.com', 'user', 'password');

% change the directory
cd(f, 'matlab');

% now change the directory that we want to download the directory
cd '/';

% Download the directory
mget(f, 'remote_dir');

% *****************
% INSERT PROGRAM HERE
% *****************

% when done move a directory here
cd ..
% now move the directory back to the server
mput(f, 'remote_dir');
disp('Files have been put back on the server');

% close the connect
close(f);


Jun 27

Going public…sort of

Tag: news, venture capitaladmin @ 9:17 am

The IPO is the preferred exit choice of most venture capitalists and entrepreneurs. Sarbanes-Oxley has made going public extremely expensive and thus increased the performance/return hurdle for IPOs. Leave it to the market to adapt:

Public or private? This question vexes chief executives more than any other these days. But does the choice have to be so black-and-white? For those not convinced that it does, a new breed of private exchange is gaining popularity where shares are not sold in public offerings but instead are placed with large investors, who are free to trade them later in the secondary market.

Banks and exchange operators alike are taking an interest in creating such hybrid marketplaces. Goldman Sachs recently launched an electronic market called GSTrUE (Tradable Unregistered Equity), selling 15% of Oaktree Capital Management for $880m, much of it to a cluster of hedge funds. Other Wall Street giants, including Merrill Lynch and Morgan Stanley, are developing similar platforms.

Rather than selling to the general public, these new “hybrid” public offerings — 144a securities — are available to large, accredited investors. Prices are likely lower than standard IPOs, but once costs are accounted for, many VCs might be better off with this route. Also,

This stability is one attraction for issuers. Another is the possibility of raising capital while avoiding the less desirable trappings of full public ownership, such as class-action litigation, compliance with the Sarbanes-Oxley law on corporate governance, and pressure to make the quarterly numbers. One reason Oaktree opted for GSTrUE was that it did not want to be forced to show steady growth when its business is inherently volatile. Other alternative money managers are considering similar moves, as are some family-owned firms that need capital but fear becoming the targets of activists. The trend may also benefit private-equity and venture-capital funds, since it should make it easier for them to cash out of companies that are not yet ready to enter, or return to, fully public markets.

I pretty much quoted it all, but read the rest.


Jun 26

Choosing the number of components in a mixture model

Tag: econometricsadmin @ 12:28 pm

I am working on estimating the returns to venture capital using a mixture model. That model should capture the persistent tail events in the returns distribution. Choosing the number of components — how many different “modes” are there –is non-trivial and apparently not solved. Below I list some papers that present their own solutions and test statistics:

Fitting of mixtures with unspecified number of components using cross validation distance estimate

Determining the Number of Component Clusters in the Standard Multivariate Normal Mixture Model Using Model-Selection Criteria.

Testing the number of components in a normal mixture

An entropy criterion for assessing the number of clusters in a mixture model

Unsupervised learning of finite mixture models

Here is a good list of mixture model references with even more papers. The EM algorithm used to generate estimates is found in Dempster, et. al.


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 22

Textmate as the ultimate editor

Tag: latex, mac, os x, php, stataadmin @ 4:10 pm

With dozens of “bundles” that allow for application-specific editing, the Mac text editor TextMate is a great tool for the researcher. I posted four screenshots below for Stata, LaTeX, Matlab and PHP. The most powerful is PHP as there is a default bundle that lets you run the script directly from the file. With a little work (install TeX on your Mac), you can easily compile and view your LaTeX files. The quick command(e.g. “begin + “tab”) make editing a breeze. What I like most is the syntax highlighting that it brings to editing .m and .do files.  Moreover, you can create “projects” that let you easily handle multiple files.

Textmate with Stata

Textmate and Stata

Textmate with LaTeX

Textmate and Latex

Textmate with PHP

Textmate and PHP

Textmate with Matlab

Textmate and Matlab


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.


Next Page »