Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 94 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
94
Dung lượng
523,78 KB
Nội dung
CHAPTER 21 About Computers 21.1. General Strategy With the fast-paced development of computer hardware and software, anyone who uses computers profesionally needs a strategy about how to allocate their time and money for hardware and software. 21.1.1. Operating System. In my view, there are two alternatives today: either do everything in Microsoft Windows and other commercial software, or use GNU/Linux, the free unix operating system together with the free software built on top of it, see www.linux.org, in addition to Microsoft Windows. I will argue here for the second route. It is true, GNU/Linux has a steeper learning curve than Windows, but this also means that you have a more powerful tool, and serious efforts are under 535 536 21. ABOUT COMPUTERS way to make GNU/Linux more and more user friendly. Windows, on the other hand, has the following disadvantages: • Microsoft Windows and the other commercial software are expensive. • The philosophy of Microsoft Windows is to keep the user in the dark about how the computer is working, i.e., turn the computer user into a passive consumer. This severely limits the range of things you can do with your computer. The source code of the programs you are using is usually unavail- able, therefore you never know exactly what you are doing and you cannot modify the program for your own uses. The unavailability of source code also makes the programs more vulnerable to virus attacks and breakins. In Linux, the user is the master of the computer and can exploit its full potential. • You spend too much time pointing and clicking. In GNU/Linux and other unix systems, it is possible to set up menus to o,m but everything that can be done through a menu can also be done on the command line or through a script. • Windows and the commercial software based on it are very resource-hungry; they require powerful computers. Computers which are no longer fast and big enough to run the latest version of Windows are still very capable to run Linux. 21.1. GENERAL STRATEGY 537 • It is becoming more and more apparent that free software is more stable and of higher quality than commercial software. Free software is developed by programmers throughout the world who want good tools for themse lves. • Most Linux distributions have excellent systems which allows the user to automatically download always the latest versions of the software; this au- tomates the tedious task of software maintenance, i.e., updating and fitting together the updates. Some imp ortant software is not available on Linux or is much better on Windows. Certain tasks, like scanning, voice recognition, and www access, which have mass markets, are better done on Microsoft Windows than on Linux. Therefore you will probably not be able to eliminate Microsoft Windows completely; however it is pos- sible to configure your PC so that you can run MS-Windows and Linux on it, or to have a Linux machine be the network server for a network which has Windows machines on it (this is more stable, faster, and cheaper than Windows NT). There are s everal versions of Linux available, and the one which is mos t inde- pendent of commercial interests, and which is one of the most quality-conscious dis- tributions, in my view, is Debian GNU/Linux, http://www.debian.org. The Linux route is more difficult at the beginning but will pay off in the long run, and I recom- mend it esp e cially if you are going to work outside the USA. The Salt Lake Linux 538 21. ABOUT COMPUTERS Users Group http://www.sllug.org/index.html meets on the third Wednesday of every month, usually on the University of Utah campus. In order to demonstrate the usefulness of Linux I loaded Debian GNU/Linux on an old computer with one of the early Pentium processors, which bec ame available at the Econ Department because it was too slow for Windows 98. It is by the w indow in the Econ Computer Lab. When you log onto this computer you are in the X- windows system. In Linux and other unix systems, the mouse usually has 3 buttons: left, right, and middle. The mouse which comes with the computer in the computer lab has 2 bottons: left and right, but if you press both buttons simultaneously you get the same effect as pressing the middle button on a unix mouse. If the cursor is in front of the background, then you will get 3 different menus by pressing the different mouse buttons. The left mouse button gives you the different programs, if you press both buttons at the same time you can perform operations on the windows, and the right button gives you a list of all open windows. Another little tidbit you need to know about unix systems is this: There are no drives as in Microsoft Dos or Windows, but all files are in one hierarchical directory tree. Instead of a backslash \ you have a forward slash /. In order to use the floppy disk, you have to insert the disk in the disk drive and then give the command mount /floppy. Then the disk is accessible to you as the contents of the directory /floppy. 21.1. GENERAL STRATEGY 539 Before taking the disk out you should give the command umount /floppy. You can do this only if /floppy is not the current directory. In order to remotely acce ss X-windows from Microsoft-Windows, you have to go through the following steps. • click on the exceed icon which is in the network-neighborhood folder. • then open a telnet session to the unix station you want to access. • at the unix station give the who -l command so that you know the id of the machine from which you are telnetting from; assume it is econlab9.econ.utah.edu. • then give the command (if you are in a bash shell as you probably will b e if it is linux) DISPLAY=econlab9.econ.utah.edu:0; export DISPLAY or, if it is the C-shell: setenv DISPLAY econlab9.econ.utah.edu:0 DISPLAY=buc-17.econ.utah.edu:0; export DISPLAY Something else: if I use the usual telnet program which comes with windows, in order to telnet into a unix machine, and then I try to edit a file using emacs, it does not work, it seems that some of the key sequences used by emacs make telnet hang. Therefore I use a different telnet program, Teraterm Pro, with downloading instruc- tions at http://www.egr.unlv.ecu/stock answers/remote access/install ttssh.html. 540 21. ABOUT COMPUTERS 21.1.2. Application Software. I prefer learning a few pieces of software well instead of learning lots of software superficially. Therefore the choice of software is an especially important question. I am using the editor emacs for reading mail, for writing papers which are then printed in T E X, for many office tasks, such as appointment calendar, address book, etc., for browsing the www, and as a frontend for running SAS or R/Splus and also the shell and C. Emacs shows that free software can have unsurpassed quality. The webpage for GNU is www.gnu.org. With personal computers becoming more and more powerful, emacs and much of the Gnu-s oftware is available not only on unix systems but also on Windows. As a preparation to a migration to Linux, you may want to install these programs on Microsoft Windows first. On the other hand, netscape and wordperfect are now both available for free on Linux. Besides emacs I am using the typesetting system T E X, or, to be precise, the T E X- macro-package A M S-L A T E X. This is the tool which mathematicians use to write their articles and books, and many econometrics and statistics textbooks was written using T E X. Besides its math capabilities, another advantage of T E X is that it supports many different alphabets and languages. For statistical software I recommend the combination of SAS and Splus, and it is easy to have a copy of the GNU-version of Splus, called R, on your computer. R is 21.1. GENERAL STRATEGY 541 not as powerful as Splus, but it is very similar, in the simple tasks almost identical. There is also a GNU version of SPSS in preparation. 21.1.3. Other points. With modern technology it is easy to keep everything you ever write, all your class notes, papers, b ook excerpts, etc. It w ill just take one or perhaps a handful of CD-roms to have it available, and it allows you greater continuity in your work. In my view, windowing systems are overrated: they are necessary for web brows- ing or graphics applications, but I am still using character-based terminals most of the time. I consider them less straining on the eye, and in this way I also have world- wide access to my unix account through telnet. Instead of having several windows next to each other I do my work in several emacs buffers which I can display at will (i.e., the windows are on top of each other, but if necessary I can also display them side by side on the screen). In an earlier version of these notes, in 1995, I had written the following: I do not consider it desirable to have a computer at home in which I buy and install all the software for myself. The installation of the regular updates, and then all the adjustments that are necesary so that the new software works together again like the old software did, is a lot of work, which should be centralized. I keep all 542 21. ABOUT COMPUTERS my work on a unix account at the university. In this way it is accessible to me wherever I go, and it is backed up regularly. In the meanwhile, I changed my mind about that. After switching to Debian GNU/Linux, with its excellent automatic updating of the software, I realized how outdated the unix workstations at the Econ Department have become. My Linux workstations have more modern software than the Sun stations. In my own situa- tion as a University Professor, there is an additional benefit if I do my work on my own Linux workstation at home: as long as I am using University computers, the University will claim copyright for the software which I develop, even if I do it on my own time . If I have my own Linux workstation at home, it is more difficult for the University to appropriate work which they do not pay for. 21.2. The Emacs Editor You can use emacs either on a character-based terminal or in X-windows. On a character-based terminal you simply type emacs. In a windows setting, it is probably available in one of the menus, but you can also get into it by just typing emacs & in one of the x-terminal windows. The ampersand means that you are running emacs in the “background.” This is sufficient since emacs opens its own window. If you issue the command without the ampersand, then the X-te rminal window from which 21.2. THE EMACS EDITOR 543 you invoked local will not accept any other commands, i.e., will be useless, until you leave emacs again. The emacs commands which you have to learn first are the help commands. They all start with a C-h, i.e., control-h: typ e h while holding the control button down. The first thing you m ay want to do at a quiet moment is go through the emacs tutorial: get into emacs and then type C-h t and then follow instructions. Another very powerful resource at your fingertip is emacs-info. To get into it type C-h i. It has information pages for you to browse through, not only about emacs itself, but also a variety of other subjects. The parts most important for you is the Emacs menu item, which gives the whole Emacs-manual, and the ESS menu item, which explains how to run Splus and SAS from inside emacs. Another important emacs key is the “quit” command C-g. If you want to abort a command, this will usually get you out. Also important command is the changing of the buffer, C-x b. Usually you will have many buffers in emacs, and switch between them if needed. The command C-x C-c terminates emacs. Another thing I recommend you to learn is how to send and receive electronic mail from inside emacs. To send mail, give the command C-x m. Then fill out address and message field, and send it by typing C-c C-c. In order to receive mail, type M-x rmail. There are a few one-letter commands which allow you to move around in 544 21. ABOUT COMPUTERS your messages: n is next message, p is previous message, d is delete the message, r means: reply to this message. 21.3. How to Enter and Exit SAS From one of the computers on the Econ network, go into the Windows menu and double-click on the SAS icon. It will give you two windows, the command window on the bottom and a window for output on the top. Type your commands into the command window, and click on the button with the runner on it in order to submit the commands. If you log on to the workstation marx or keynes, the first command you have to give is openwin in order to start the X-window-system. Then go to the local window and give the command sas &. The ampersand means that sas is run in the background; if you forget it you won’t be able to use the local window until you exist sas again. As SAS starts up, it creates 3 windows, and you have to move those windows where you want them and then click the left mouse button. From any computer with telnet access, get into the DOS prompt and then type telnet marx.econ.utah.edu. Then sign on with your user-id and your password, and then issue the command sas. Over telnet, those SAS commands which use function keys etc. will probably not work, and you have to do more typing. SAS over telnet is more feasible if you use SAS from inside emacs for instance. [...]... command on the last line starting with > and hit return, this command will be submitted to Splus The key combination M-p puts the previous command on the last line with the prompt; you may then edit it and resubmit it simply by typing the return key (the cursor does not have to be at the end of the line to do this) Earlier commands can be obtained by repeated M-p, and M-n will scroll the commands in. .. citibase line: beginyr=47 endyr=85 If their data starts later, they will add missing values at the beginning, but the data will still be lined up with your data 21.6 THE DATA STEP IN SAS 561 The retain statement tells SAS to retain the value of the variable from one loop through the data step to the next (instead of re-initializing it as a missing value.) The variable monthtot initially contains a missing... They cannot be learned by trial and error, and they cannot be learned in one or two sessions If you are sitting at the console, then you must give the command openwin() to tell Splus to display high resolution graphs in a separate window You will get a postscript printout simply by clicking the mouse on the print button in this window If you are logged in over telnet and access Splus through emacs,... Those variables in the first dataset which are not present in the second dataset get missing values for the second dataset, and vice versa So you would end up with the variable year going twice from 1947 to 1985, and the variables kcon20 having 39 missing values at the end, and prate having 39 missing values at the beginning People who want to use some Citibase data should include the following options... beginning of statistical models, chapter 11 A Mini Quiz will check that you read chapters 6–10 before coming to class Homework is an estimation problem Monday June 25: Mini Quiz about chapter 11 We will finish chapter 11 After this session you will have a take-home final exam for this part of the class, using the features of R It will be due on Monday, July 2nd, at the beginning of class If you have installed... you can) using your statistics package Remark: In order to make the hand computations easier, Cobb and Douglass reduced the data for capital and labor to index numbers (1899=100) which were rounded to integers, before running the regressions, and Figure 1 was constructed using these rounded data Since you are using the nonstandardized data, you may get slightly different results Answer lines(ellipse.lm(cbbfit,... 1 8118 18542 19192 labor 6855 7167 7277 7026 7269 8601 9218 9446 9096 9110 6947 7602 wage 97 99 100 99 99 104 103 107 111 114 115 119 Table 1 Cobb Douglas Original Data data cobbdoug; infile ’cobbdoug.txt’; input year output capital labor; run; But for this to work you must delete the first line in the file cobbdoug.txt which contains the variable names (Is it possible to tell SAS to skip the first line?)... year will be a missing value, since adding something to a missing value gives a missing value again If the dataset does not end with a December, then the (partial) sum of the months of the last year will not be read into the new data set The variable date which comes with the citibase data is a special data type Internally it is the number of days since Jan 1, 1960, but it prints in several formats... by Cobb and Douglas in their original article [CD28] introducing the production function which would bear their name output is “Day’s index of the physical volume of production (1899 = 100)” described in [DP20], capital is the capital stock in manufacturing in millions of 1880 dollars [CD28, p 145], labor is the “probable average number of wage earners employed in manufacturing” [CD28, p 148], and wage... smith and get the file this way For this you have to login to your account and then cd ehrbar/ec7800/sasdata and then first give the command binary because it is a binary file, and then get sascat.dat Or you can download it from the www by http://www.cc.utah.edu/ ehrbar/sascat.dat but depending on your web 546 21 ABOUT COMPUTERS browser it may not arrive in the right format And the following SAS commands . to virus attacks and breakins. In Linux, the user is the master of the computer and can exploit its full potential. • You spend too much time pointing and clicking. In GNU/Linux and other unix. the class, using the features of R. It will be due on Monday, July 2nd, at the beginning of class. If you have installed wget in a location R can find it in (I think no longer necessary). 21.5. INSTRUCTIONS. terminal or in X-windows. On a character-based terminal you simply type emacs. In a windows setting, it is probably available in one of the menus, but you can also get into it by just typing emacs