Because portable versions of Google Chrome and Dropbox are available (discussed here), lack of these programs on the school computers hasn't been an issue for me. It however appears that these two program are now sufficiently popular that they are finally installed on the computers in my school libraries and labs.
Sunday, August 5, 2012
Saturday, August 4, 2012
How to Connect to Remote Server using Remote Desktop Connection and Share Local Work Files
Before setting up the Remote Desktop Connection options - if you work on multiple computers, you sometimes find that you have to change the file paths in your code because the document folder tends to be different for different versions of Windows. Or, your file is on a USB drive and different computer maps your drive to different letters. Remap the location of your work files to a drive letter allow you to always reference your files to a specific location. To do so, follow these steps:
A. Start a command prompt by clicking the “Start” button and then select “Run”, then enter cmd and click “Ok”.
B. In the command prompt, use the subst command as described in the figure below. In this case, I map my project files (Treasury Supply) folder to the m: drive. The last line in the figure will map the directory l:\moreWorkFiles to the n: drive.
To setup the Remote Desktop Connection option so you can access your files, follow these steps:
1. Start the program (the pictures are clipped from Windows XP, but the program is also installed by default on Windows Vista and on Windows 7)
2. Click "Options" in the Remote Desktop Connection dialog box
3. Select the “Local Resources” tab, then click “More…” under the “Local Resources” tab
4. Expand “Drives”
5. Select the drive you want to access on the remote computer (I created the M: drive using the subst command), then click “Ok”
6. Select the “General” tab to enter your computer and logon information, then click “Connect”
7. Profit! (I.e., done.)
8. After you log into the terminal server, you access the shared drive at \\tsclient\m, where “m” is the drive you shared.
9. Some analytical program does not like this name. In that case, you would need to map the network path (\\tsclient\m) to a drive. You can do this using Windows explorer. Go to the Tools –> Map Network Drive, and set it up accordingly.
Tuesday, July 17, 2012
Week Cal, My DateBk Replacement on the iOS
With the recent Week Cal update allowing rolling events to be flexible (i.e., I can set it to roll for 1 day, 2 day, 1 week, 1 month, etc), I am compelled to mention the iOS calendar app Week Cal.
In my Palm Pilot PDA days - I love the calendar DateBk. But after my Palm Tungsten T5 suffers from drop too many drop, I ended up getting an iPod touch and were abhorred with the crappy program that is Calendar. Perhaps crappy is too strong a word - it is just that the default calendar program is exactly what the program name suggested - a calendar. The screen real estate is poorly utilized, and there is a severe lack of features.
After googling on and off for about a month, I was thankful to find this Lifehacker article (here). And for the better, I am happy to have settled with Week Cal by chance.
For those that used DateBk, I love the conditional formatting, templates, and floating events. I use the conditional formatting to mark important or timed appointments (which is useful because I put a lot of other information on the calendar in additional to just appointment. The conditional formatting allows me the highlight the actual appointments. I use floating events also because of the various other information I put on my calendar - so that I do not have to manually roll these events for each day. For those unfamiliar, the rolling event is an option that you can set to have events automatically "float" or "roll" to the following day. Even I first started using Week Cal, they already have the first two features. With the past two updates, the rolling event function is added, making it close to everything I need.
Saturday, July 14, 2012
Stata Time Series Operators (Lags, Leads, and Indices)
For reference because I always end up having to look this up:
lag: L, L2, … : gen lag2Var = L2.var
lead: F, F2, … : gen lead2Var = F2.var
difference: D, D2, … : gen diffofdiffVar = D2.var
seasonal difference: S, S2, … : gen seadiffVar = S2.var
I have never used the seasonal difference. I assume it depends on the seasonal frequency defined via tsset.
D2 is defined as (y[t]-y[t-1]) - (y[t-1]-y[t-2]), and not y[t]-y[t-2]. For y[t]-y[t-2], if there are no gaps in the time variable, you can use y[_n]-y[_n-2].
Reference: Forecasting in STATA: Tools and Tricks [Economic Forecasting (Econ 390) Spring 2010]
Friday, July 6, 2012
WinSplit – Aerosnap for XP and Vista
People who like and hate the aerosnap feature on Windows 7 are about 50/50. I happen to be in the like group. Unfortunately, since I am still stuck in the Stone Age with XP and Vista laptops, I have been looking for a utility that would replicate this function.
I used to use a program call AeroSnap, but it was a bit buggy and the author of the program has long since stop updating it. You can still find it on CNET (here). If you follow the link to the publisher’s home page, you will see that even the website is gone.
Very recently, I find a new program that close to replicate the aerosnap function – called WinSplit Revolution. It does a full set of window managing feature – though I just use the aerosnap function. You can define hotkeys to snap your windows, and you can snap them more than just the left, right, top, and bottom. However, as far as I can tell, it doesn’t allow you to do it with the mouse. (I.e., move the window to the right edge of the screen to have it snap to the right side.)
So, not an optimal solution – but second best is good enough for me.
You can read about and download WinSplit Revolution (here). It is a freeware.
Sunday, May 13, 2012
SAS Wildcard for Variable List
For posterity, the wildcard character for variable list in SAS is “:”. An example:
data auctionDateData;
set temp;
keep Announce_Date Auction_Date Issue_date termType;
keep auction_dateYield:;
run;
The page I referenced below talks about other specifications also - specifying only numeric variables, only character variables, and the standard selection by numbering (i.e., var1-var25 var32-var50).
Knowing this would change how I named my variables (i.e., using more “_” to categorize my variables so I can use “:” and “_” to distinguish the groups I want to isolate.)
Reference: SAS Variables SAS Variable Lists [support.sas.com]
Thursday, April 12, 2012
Portable Dropbox, SD/USB Card, and Dropbox Upload/Download by Dragging
First item. I finally find a good Portable Dropbox program. Discussions on the program on the Dropbox forum is located here: http://forums.dropbox.com/topic.php?id=33387. The program can be downloaded at http://nionsoftware.com/dbpahk/.
This program does not require administrator access, so you can install it on your school lab computers. It also allows you to sync to a removable media like a USB flash drive or a SD card.
As I have started carrying a SD/USB card in my wallet with my work files, the Portable Dropbox program allows me to sync the files between my card and my other computers elsewhere. (Yes, that’s right – a SD card with the USB interface build-in: SanDisk Ultra II SD Plus 2GB Card.) Having access to standard Dropbox features like rolling back to older versions is great also. That way, I can do work on any of the school computer labs instead of always having to carry my laptop, know that my files are backed up and automatically sync to my other computers. Now, I just need to run the program when I start working at the lab computers.
As a side note, I want to reiterate how awesome my SD/USB card is. It fits in my wallet, can go in my camera, and can also go in to any computers that takes USB. Sadly, SanDisk doesn’t seem to make higher capacity versions of it.
Second item: http://blog.dropbox.com/?p=1116. Dropbox now allows dragging files from your operating system (like windows explorer or even your desktop) into your browser to upload files. Previously, you would need to open a dialog box to specific the file to upload. From my test, the Dropbox website now lets you upload files as well as download files. To download, just dragging files from your web browser to windows explorer (or your desktop).
Follow up: Hausman Test on Stata for RE vs. FE
Some follow up comments from a previous post on the Hausman test in the RE/FE context:
RE assumes that Cov(a[i],x[it])= 0. {The model here is: Y[it] = b*x[it] + e[it], where e[it] = a[i] + u[it]).} The coefficient estimates from using RE and FE have the following properties depending on whether that assumption is true:
b[RE] b[FE] Cov(a[i],x[it])=0 efficient, consistent inefficient, consistent Cov(a[i],xpit]!=0 inconsistent consistent
In words, if Cov(a[i],x[it])=0 is true, then since the coefficient estimates are both consistent, they are "likely" to be close and so the difference between b[RE] and b[FE] is small. If Cov(a[i],xpit]!=0, then since b[RE] is inconsistent, you would like that the difference is likely to be large.
The test statistics is (b[RE]-b[FE])' v^(-1) (b[RE]-b[FE]), where v is the estimated asymptotically variance of (b[RE]-b[FE]) with Chi square distribution.
Reference: Hausman test (fe vs. re), use robust SE or not? [Statalist],
Stata 12 help for hausman [Stata]
Saturday, February 11, 2012
Getting Yahoo Finance Dividend Data in CSV Format and Plotting the Dividend Data in Stata
Here is some code to create a Stata program to get dividend data from Yahoo Finance and plotting it:
program define sdchart
preserve
clear
insheet using "http://ichart.finance.yahoo.com/table.csv?s=`0'&a=00&b=01&c=1900&d=11&e=31&f=2099&g=v&ignore=.csv"
gen tempDate = date(date, "YMD")
drop date
gen date = tempDate
format date %td
drop tempDate
line dividend date
drop dividend date
restore
end
If you put the http URL in your web browser, and replaced `0’ with a stock ticker (like "INTC"), you will be returned with a CSV file with Intel’s dividend. For example, click the following:
http://ichart.finance.yahoo.com/table.csv?s=INTC&a=00&b=01&c=1900&d=11&e=31&f=2099&g=v&ignore=.csv
The rest of the code just takes the csv file data and plots it in Stata. I like using Stata because
- I have been using Stata a lot lately for my work, and
- that it can download web data (like those from Yahoo Finance) directly within the program.
So if you run sdchart INTC, you will get:
I have the code in my profile.do file in the Stata startup directory.
Reference: How to download the history of dividend payments for stocks in the US market [Quantshare]
Thursday, February 2, 2012
Shortcuts to Minimizing the Microsoft Office Ribbon and Keyboard Shortcut to Ribbon Items
Microsoft Office has a way to minimize and restore the Ribbon quickly. You simply double click the currently selected menu tab to toggle. As an example, for the picture blow, you would double click the Home menu to minimize.
In addition, using the ALT key triggers the ribbon to show the keyboard shortcut. This was obvious to anyone that frequently hit the ALT key by mistake. What I did not know, is that hitting the shortcut key will cascade down to the next set of menu. This even works if you have the ribbon minimized. Very neat! For example, in Microsoft Word, if you select some text and then hit the following keys in sequence: Alt, H, I, Enter – it will highlight the text.
Source: Double-Click a Tab to Shrink Microsoft Office's Ribbon Toolbar [Lifehacker]
Wednesday, December 21, 2011
Stopping and Starting CrashPlan Backup from the Command Line
… or, how to stopping Windows services using the command line.
I use Crashplan to automate my backups. Although it runs in the background, it nonetheless takes quite a bit of resources to run (at least for my little laptop that could). Rather than keep pausing the backup for an x amount of hours repeatedly, I sometimes would rather just turn off backup completely for a while. To do this, I have two shortcuts on my quick launch bar to start and stop the Crashplan backup service.
The two shortcuts link to DOS batch files, which run a command-line command to start or stop the service (and therefore the backup). Here is the property dialog of the shortcut for stopping the service.
Also, make sure you click the “Advanced” button and enable the program to “run as administrator”:
In the batch file CrashPlan Stop.bat, I use the following commands:
net stop "CrashPlan Backup Service"
pause
In CrashPlan Start.bat, I use:
net start "CrashPlan Backup Service"
pause
Now, when I start testing programming code or running analysis, I just click the shortcut to stop the backup and prevent it from automatically starting itself.
Tuesday, December 20, 2011
Stata Code Snippets: Plotting Multiple Series with Different Colors and Customized Legend for Different Observations
Here are some Stata code snippets for plotting multiple series. An example using the auto dataset that comes with Stata:
sysuse auto
twoway (scatter price weight if foreign == 1, mcolor(`f0')) (scatter price weight if foreign == 0, mcolor(`f1')),legend(lab(1 "Foreign") lab(2 "Domestic"))
The resulting graph shows domestic cars in the late 70s tend to be heavier for various price points.
Reference: st: RE: –twoway scatter- different colors for different observations [Statalist: The Stata Listserver], Stata Learning Module Graphics: Combining Twoway Scatterplots [UCLA Academic Technology Services]
Sunday, December 18, 2011
Stop the Windows 7 or Vista Screen from Locking Up when User Account Control (UAC) Elevate a Program to have Administrator Access
The How-To Geek has an article on editing the Windows registry to stop the screen from blacking out and locking up when a program need administrator access (i.e., run as an administrator). I found that this is possible while trying a tweaking program named Tweak Me!.
For Windows Vista, you need to edit [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] and set PromptOnSecureDesktop to 0.
I.e.,
Reference: Make User Account Control (UAC) Stop Blacking Out the Screen in Windows 7 or Vista [How-To Geek]
Wednesday, December 7, 2011
Making Text from PDF Files Searchable from the “Start Search” Text Box
This is in reference to an earlier post here on installing iFilter to make more filetypes searchable in Windows.
Supposedly, from the Adobe website: “Adobe currently bundles a 32-bit PDF iFilter with Adobe Acrobat® 9 as well as free Adobe Reader® 9 software.” I have a 64-bit Windows 7 machine that has Adobe Acrobat 9 installed, but the iFilter was not setup. The iFilter works after I install Adobe PDF iFilter 9.
The Adobe setup file can be downloaded here: https://www.adobe.com/support/downloads/detail.jsp?ftpID=4025 .
Friday, December 2, 2011
Stata Code Snippets: Finding Duplicates in Observations
Here are some code Stata code snippets for checking duplicates in your panel data. (I have to figure out how to do this because my panel dataset have duplicates, and therefore I cannot do a tsset on the data) The command to use is duplicates.
To list any duplicate observations, run:
duplicates list
For the duplication issue I have with tssset, I specific the two relevant panel variables
duplicates list termtype dateIndex
Now, to create a dummy variable isdup to mark the duplicates
duplicates tag termtype dateIndex, gen(isdup)
In my case, I just manually remove the duplicates using the graphical editor:
edit if isdup
Or, to just remove it using the command
duplicates drop termtype dateIndex
An example:
sysuse auto
keep mpg rep78
duplicates list
duplicates list rep78
duplicates tag rep78, gen(isdup)
list if isdup
Thursday, November 17, 2011
Stata Code Snippets: Summarize Statistics by Category
I calculate summary statistics by categories in SAS a lot - like finding the annual average of a variable by security type. Here are some code snippets for doing that in Stata.
The command to use is collapse. For example, the following code calculates the average mpg and average weight between foreign and domestic cars from the AUTO dataset.
sysuse auto
collapse(mean) mpg (mean)weight, by(foreign)
Unlike SAS, which allows you to output the summary data to a different dataset, Stata alters the dataset.
To make a prettier table with summary data, use the tabdisp command:
tabdisp foreign, cell(mpg weight) format(%9.2f)
If you run the code, you will find that, as expected, foreign automobiles are lighter and have higher mpg in the late 70s according to the data.
Monday, November 14, 2011
Jump to a Certain Location on a Lengthy Page Instantly with Shift and Click
On a webpage with a lot of text, I often find myself clicking the scroll bar and holding on the left mouse button as the web browser slowly scroll its way up (or down) - a page at a time. If the page is long, it can take a while. The solution? Hold shift and then click at the approximate location on the scroll bar that you want to jump to. This will bring you immediate to the location.
I never thought there is a more efficient way to handling this situation, and therefore never thought of googling for a solution. I come across this by accident – after almost two decades of using computers.
Tuesday, October 4, 2011
Emacs Outline Mode
A friend brings to my attention that Emacs has an outline mode with a feature set similar to those found in Microsoft Word. This is nice to know should I ever find myself in a Linux only working environment.
Since I am in the Microsoft Windows environment, I use Microsoft OneNote for all my research information collection and mind-mapping needs. OneNote has a superset of features over and above those in Microsoft Word. It furthermore works great with recording notes using a tablet computer, allowing you to jump to the recording corresponding to various parts of your notes and (to some extent) recognizes your handwriting so your notes that searchable. It does screen capture and makes the text in these pictures searchable as well. (OneNote can technically search your audio notes also, but with much less success.) For file organization, you can even paste all your project files in a single note page.
Reference: Outline Mode [EmacsWiki]
Wednesday, September 21, 2011
The Fed for iPad
The Federal Reserve now has an iPad app (here). Unfortunately, I do not have an iPad and so I cannot access this and see how it works – whether it has push notification (say when the Fed releases a statement) or if it would have the ability to read the speeches to you (even better if it has videos of the speeches).
It would be even more awesome if it also allows Federal Reserve data to be graphed and manipulated – say let a user look at what the Fed funds rate has been at various times with a flick of the finger. Or, plot side-by-side graph of the Fed funds rate with its estimated yield curves. Or, let user examine what its balance sheet looks like over the course of the financial crisis. This is very much a personal wish list. But if realized, it would go quite a way on the path to better communication. I was talking to another economics graduate student some days ago, and he thought the Federal Reserve issues Treasury securities. (It does not.) This anecdote underscores the lack of general knowledge about the Federal Reserve.
Since I do not have an iPad. I have to make do with stone age technology – tracking Federal Reserve news from its RSS feeds on Google Reader. The four RSS feeds I follow are:
http://www.newyorkfed.org/rss/feeds/3.xml
http://www.federalreserve.gov/feeds/speeches_and_testimony.xml
Wednesday, August 10, 2011
MATLAB Error: “Name is nonexistent or not a directory”
You can add additional default paths to MATLAB using the “Set Path…” option under the File pull-down menu. This way, you can put utilities (your own .m files) you have written all in one place and have MATLAB access run them by just typing the script like – just as if they are in the current directory.
However, if you delete a file directory referenced by these paths – MATLAB will give you an error, but *not* allow you to delete it through the “Set Path…” dialog box. But when you start MATLAB, it will always give you the following error message:
Warning: Name is nonexistent or not a directory:
To delete the path, run “edit pathdef.m” and delete the reference to the deleted path. MATLAB checks this file when it starts and setup all the paths that it should check if it does not find the .m file in the current directly.
Reference: Why do I receive the warning message "Warning: Name is nonexistent or not a directory: .... " when I start MATLAB? [MATLAB & Simulink]