Saturday, July 07, 2018

A safer way to allow gambling

With the recent decision by the Supreme Court to allow states to legalize sports betting, states should think through possibly ways to legalize gambling. We should thinking through how to do it while reducing the negative consequences, such as, gambling addiction. I think one of the keys is separating as much as possible gambling from temptation. We should worry less about someone who has planned a gambling trip with a known monetary limit than we should about someone who is caught up in the excitement of gambling, looses too much, and tries irrationally to win it back by gambling more. I propose to do this by a mechanism that enforces planning and limits. Gambling regulation would create special-purpose gambling accounts where people could deposit money. Casinos and other gambling establishments would then not accept cash, but instead, could only accept money from these accounts. The key is that casinos could only take money that had been in the account for a certain minimum amount of time (e.g. five days). A mechanism would be needed to prevent people from giving each other chips in the casino in exchange for cash, but this is likely possible with cash cards, authentication, and oversight. There has been some attempts along these lines: several countries have instituted something similar for electronic gambling. More research would obviously be best.

Obviously, casinos prefer unrestricted gambling but they may support this type of regulation if it is the only way to operate in a state. Likely the biggest road-block would be entrenched interests, such as state lotteries and localities (e.g. Native American reservations) that have already legalized gambling. Overall, if we can drastically reduce the negative consequences of gambling in the legal/main market then we should be trying to move people away from worse areas, such as the black market, given that it appears many people don't always operate rationally.

Thursday, February 08, 2018

FinTech: Service to optimize credit card payments

Many people carry credit balances across multiple cards. The best general strategy to allocate a given amount towards monthly payments is to make the minimum payments on each card and then allocate the remainder to the card with the highest interest rates. Multiple studies have shown, however, that people do not do this, but instead follow simple heuristic such as dividing payments in proportion to each card's balance. This suggests that a FinTech startup could offer a service of managing payments in an optimal way. It could incorporate more complex concerns like not maxing out certain cards, being smart about card-specific rewards/changes, and managing a family portfolio. Also, consumers have high levels of anxiety about debt so a comforting intermediary might be preferred.

Sunday, November 12, 2017

Blinded voters guides

A common practice when hiring is to "blind" the resumes of candidates at initial evaluation stages so that attributes such as race/ethnicity, gender, and age do not unduly influence the initial process. I would like a similar "screen" for voters guides for local elections where I may be unfamiliar with the candidates. The guide would present candidates as unnamed #1, #2, ..., and then give the pros/cons (e.g., policy stances, competence, etc.) for each. The viewer could read the information and then later choose to reveal the names (and associated demographics) of the candidates.

Monday, September 12, 2016

Guidelines for making a Stata package

Here are some guidelines for making a well behaved Stata package (ado):
  1. Provide all relevant output programmatically, not just textually. Another package may want to work with yours.
  2. Provide a way to check the version of your package.
  3. Use version.
  4. The package file should have a line like 'd Distribution-Date: 01jan2000' so that the package can be updated from adoupdate.
  5. Make clear in the help file what side effects your program may have (globals, characteristics, mata objects, scalars, incrementing of the RNG state by using randomization functions, files left around). Cleanup after yourself if you can, especially after errors (use preserve, tempfiles/tempvars/tempnames, and capture blocks with cleanup sections).
  6. List your package dependencies. You can do this in the package file, but you should also mention this in the help file (and say if you autoinstall dependencies). 
  7. If you capture the output from a long running process, make sure to allow for exit if the break key was pressed (check _rc==1).
  8. Use _assert. It makes error checking code much nicer to read.
  9. Provide tests (such as static source code checks and unit checks) with good coverage. Relatedly, your help material should include useful examples.
  10. Put a brief description/authors in *! initial lines above the command in the ado file (used by which). Don't make this a full changelog, put that in a changelog file.
  11. If you use compiled plugins or mata mlibs, provide the source code. This can help users determine solutions to errors.
  12. If the package is estimating statistical routines then include references for the procedure and make very explicit details of your algorithm.
  13. Make sure your program works with when either the current directory or the tempdir contain spaces.
Extra-special niceties:
  1. Have an option so that relevant output (such as displayed text or saved files) is not dependent on machine-specific characteristics (e.g. directory, # processors, speed/time). This allows for log files to be compared across runs to check for real differences using text comparison methods.
  2. Provide a way to access previous versions of package and a place to post errors. You can easily do this by host your project on a development website like GitHub.
  3. Provide a way to cite the programs.
  4. Provide a centralized place for listing issues/bug reports/enhacement requests/etc (e.g. at GitHub).
  5. If you provide a web-based development site (e.g. at GitHub) provide a version of your help in HTML (see the log2html Stata package).

Monday, May 02, 2016

LyX template for UMD dissertation format

The following is a template for formatting dissertation in LyX for PhD dissertations for the University of Maryland, College Park. The umdthesis.cls file is a slightly modified version of thesis.cls from here (and renamed so it doesn't conflict with existing thesis files). Instructions for using the LyX file are in a comment at the top of that file.


Saturday, April 23, 2016

"Auto-edit failed" errors in LyX

A nice feature of LyX is that you can edit \included (or \inputed) files from the InsertFileChild Document dialog window. I was recently having a problem, however, where I could edit file types that had notepad as the default handler but not those that had Notepad++ as the default handler. I would get dialog messages saying "Error: Cannot edit file \n Auto-edit file file_path.tex failed". If this happened to you, here's the reason and fix.

Unless the child document is a .lyx file, LyX will check to see which handler is associated with text files in Tools→ Preferences→ File Handling→ File Formats, "Plain Text". If this is set to "Custom:auto", then LyX will call Win32's ShellExecute() with the action/verb as edit. The problem my setup is that if you merely set Notepad++ as the default handler of a certain file type by right clicking on the file type and selecting Open withChoose Another App→ Use this App to open all XXX files then the application isn't registered as the handler with the edit verb. Possible solutions
  1. Set Notepad++ to be editor for all included files. Do this by setting the edit command for Plain Text files as "C:\Program Files (x86)\Notepad++\notepad++.exe". This is what I did
  2. LyX could be patched so that if the first call to ShellExecute()  in  osWin32.cpp:autoOpenFile() with edit failed with error code SE_ERR_NOASSOC (=31) to try again with a verb of NULL.
  3. The user can register an edit verb with the default file handler in the registry. See here and here.
General reference for this type of problem.

Thursday, February 18, 2016

More efficient news reading

Nassim Taleb famously doesn't read the news. One of his reasons is that much of the news is inconsequential. This is both because news outlets need to publish even on slows days (the BBC has on only one day stated "[t]here is no news") and because it is difficult to tell at the time what will be important, especially from just headlines. Existing metrics to help determine if something of note actually happened include article view/share counts (e.g. RSS feeds of the "top 10" articles) and links (Google News), but these are insufficient. A better metric would be if a financial market (such as a prediction market) was available. Imagine a news service that tracked markets you cared about and if there was a large and non-temporary price change it would you send you the top stories from around that time period. One could imagine that the user could use a set of news search terms and the link to a market to setup and alert themselves. This could also be a platform for deciding about new prediction markets to set up. The target end-user would be general news readers, not traders as there'd obviously have a bit of a lag.