请选择 进入手机版 | 继续访问电脑版
楼主: iamzjk
20770 82

[其他] 书已免费,新增习题答案,Python在计量经济学中的应用 Python for Econometrics,   [推广有奖]

  • 0关注
  • 7粉丝

本科生

31%

还不是VIP/贵宾

-

威望
0
论坛币
3161 个
通用积分
4.0203
学术水平
27 点
热心指数
15 点
信用等级
17 点
经验
1869 点
帖子
22
精华
1
在线时间
30 小时
注册时间
2010-3-11
最后登录
2018-1-10

iamzjk 学生认证  发表于 2014-9-30 22:25:07 |显示全部楼层 |坛友微信交流群
相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
重要Python_for_Econometrics.pdf (2.54 MB)
Python_introduction_solutions.zip (1.01 MB, 需要: 5 个论坛币) 本附件包括:
  • exercise3_new.csv
  • probability_and_statistics_functions_solutions.py
  • flow_control_and_loops_solutions.py
  • logical_operators_and_find_solutions.py
  • optimization_solutions.py
  • builtin_datatypes_solutions.py
  • inf_nan_and_numerics_solutions.py
  • special_matrices_solutions.py
  • graphics_solutions.py
  • SP500.csv
  • FTSE.csv
  • importing_and_exporting_data_solutions.py
  • exercise3.xlsx
  • exercise3_numeric.txt
  • exercise3_numeric.csv
  • exercise3_numeric.xls
  • exercise3.xls
  • performance_and_optimization_solutions.py
  • cython_arma.c
  • cython_arma.pyd
  • cython_arma.pyx
  • file_system_and_navigation_solutions.py
  • custom_functions_and_modules_solutions.py
  • array_and_matrix_functions_solutions.py
  • arrays_and_matrices_solutions.py
  • basic_functions_solutions.py
  • basic_math_solutions.py
  • exercise3.mat
  • exercise3.npz
  • exercise3_compressed.npz


Contents
1 Introduction 1
1.1 Background
1.2 Conventions
1.3 Important Components of the Python Scientific Stack
1.4 Setup
1.5 Using Python
1.6 Exercises
1.A Frequently Encountered Problems
1.B register_python.py
1.C Advanced Setup
2 Python 2.7 vs. 3 (and the rest) 27
2.1 Python 2.7 vs. 3 .
2.2 Intel Math Kernel Library and AMD Core Math Library . . . . . . . . . . . . . . . . . . . . . . . . 27
2.3 Other Variants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.A Relevant Differences between Python 2.7 and 3
3 Built-in Data Types 31
3.1 Variable Names
3.2 Core Native Data Types
3.3 Python and Memory Management
3.4 Exercises
4 Arrays and Matrices 47
4.1 Array
4.2 Matrix
4.3 1-dimensional Arrays
4.4 2-dimensional Arrays
4.5 Multidimensional Arrays
4.6 Concatenation
4.7 Accessing Elements of an Array
4.8 Slicing and Memory Management
v
4.9 import and Modules
4.10 Calling Functions
4.11 Exercises
5 Basic Math 63
5.1 Operators
5.2 Broadcasting
5.3 Array and Matrix Addition (+) and Subtraction (-)
5.4 Array Multiplication (
5.5 Matrix Multiplication (
5.6 Array and Matrix Division (=)
5.7 Array Exponentiation (**
5.8 Matrix Exponentiation (**)
5.9 Parentheses
5.10 Transpose
5.11 Operator Precedence
5.12 Exercises
6 Basic Functions and Numerical Indexing 71
6.1 Generating Arrays and Matrices
6.2 Rounding
6.3 Mathematics
6.4 Complex Values
6.5 Set Functions
6.6 Sorting and Extreme Values
6.7 Nan Functions
6.8 Functions and Methods/Properties
6.9 Exercises
7 Special Arrays 83
7.1 Exercises
8 Array and Matrix Functions 85
8.1 Views
8.2 Shape Information and Transformation
8.3 Linear Algebra Functions
8.4 Exercises
9 Importing and Exporting Data 99
9.1 Importing Data using pandas
9.2 Importing Data without pandas
9.3 Saving or Exporting Data using pandas
vi
9.4 Saving or Exporting Data without pandas
9.5 Exercises
10 Inf, NaN and Numeric Limits 109
10.1 inf and NaN
10.2 Floating point precision
10.3 Exercises
11 Logical Operators and Find 113
11.1 >, >=, <, <=, ==, !=
11.2 and, or, not and xor
11.3 Multiple tests
11.4 is
11.5 Exercises
12 Advanced Selection and Assignment 119
12.1 Numerical Indexing
12.2 Logical Indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
12.3 Performance Considerations and Memory Management . . . . . . . . . . . . . . . . . . . . . . . 128
12.4 Assignment with Broadcasting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
12.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
13 Flow Control, Loops and Exception Handling 133
13.1 Whitespace and Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
13.2 if . . . elif . . . else . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
13.3 for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
13.4 while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
13.5 try . . . except . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
13.6 List Comprehensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
13.7 Tuple, Dictionary and Set Comprehensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
13.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
14 Dates and Times 143
14.1 Creating Dates and Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
14.2 Dates Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
14.3 Numpy datetime64 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
15 Graphics 147
15.1 seaborn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
15.2 2D Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
15.3 Advanced 2D Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
15.4 3D Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
vii
15.5 General Plotting Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
15.6 Exporting Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
15.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
16 Structured Arrays 167
16.1 Mixed Arrays with Column Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
16.2 Record Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
17 pandas 171
17.1 Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
17.2 Statistical Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
17.3 Time-series Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
17.4 Importing and Exporting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
17.5 Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
17.6 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
18 Custom Function and Modules 207
18.1 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
18.2 Variable Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
18.3 Example: Least Squares with Newey-West Covariance . . . . . . . . . . . . . . . . . . . . . . . 215
18.4 Anonymous Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
18.5 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
18.6 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
18.7 PYTHONPATH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
18.8 Python Coding Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
18.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
18.A Listing of econometrics.py . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
19 Probability and Statistics Functions 225
19.1 Simulating Random Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
19.2 Simulation and Random Number Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
19.3 Statistics Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
19.4 Continuous Random Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
19.5 Select Statistics Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
19.6 Select Statistical Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
19.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
20 Optimization 243
20.1 Unconstrained Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
20.2 Derivative-free Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
20.3 Constrained Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
20.4 Scalar Function Minimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
viii
20.5 Nonlinear Least Squares . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
20.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
21 String Manipulation 255
21.1 String Building . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
21.2 String Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
21.3 Formatting Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
21.4 Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
21.5 Safe Conversion of Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
22 File System Operations 267
22.1 Changing the Working Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
22.2 Creating and Deleting Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
22.3 Listing the Contents of a Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
22.4 Copying, Moving and Deleting Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
22.5 Executing Other Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
22.6 Creating and Opening Archives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
22.7 Reading and Writing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
22.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
23 Performance and Code Optimization 273
23.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
23.2 Timing Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
23.3 Vectorize to Avoid Unnecessary Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
23.4 Alter the loop dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
23.5 Utilize Broadcasting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
23.6 Use In-place Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
23.7 Avoid Allocating Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
23.8 Inline Frequent Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
23.9 Consider Data Locality in Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
23.10Profile Long Running Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
23.11Numba . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
23.12Cython . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
23.13Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
24 Parallel 291
24.1 map and related functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
24.2 Multiprocess module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
24.3 IPython Parallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
25 Object Oriented Programming (OOP) 295
25.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
ix
25.2 Class basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
25.3 Building a class for Autoregressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
25.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
26 Other Interesting Python Packages 307
26.1 statsmodels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
26.2 pytz and babel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
26.3 rpy2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
26.4 PyTables and h5py . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
27 Examples 309
27.1 Estimating the Parameters of a GARCH Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
27.2 Estimating the Risk Premia using Fama-MacBeth Regressions . . . . . . . . . . . . . . . . . . . 313
27.3 Estimating the Risk Premia using GMM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
27.4 Outputting L




二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:econometrics Econometric metrics python Metric 经济学

重要Python_for_Econometrics.pdf

2.72 MB

这个是旧版本,请下载前面的那个

已有 12 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
残阳_等待 + 100 精彩帖子
yunnandlg + 100 + 20 精彩帖子
YY.HH + 1 + 1 + 1 精彩帖子
LIXUANHANK + 5 + 5 + 5 精彩帖子
zhangibt + 100 精彩帖子
静水深流 + 1 精彩帖子
zhuosn + 1 精彩帖子
crystal8832 + 36 + 2 + 2 + 2 奖励积极上传好的资料
sfhsky + 6 精彩帖子
oliyiyi + 12 精彩帖子

总评分: 经验 + 472  论坛币 + 176  学术水平 + 18  热心指数 + 11  信用等级 + 10   查看全部评分

本帖被以下文库推荐

fjrong 在职认证  发表于 2014-9-30 22:30:55 来自手机 |显示全部楼层 |坛友微信交流群
iamzjk 发表于 2014-9-30 22:25
没有币的请发邮件到索取
好东西,谢谢分享

使用道具

相当不错                                                                        
                                       
                                                     
                                                     
                                             
                                                                 
                                                                                 

使用道具

ding
kankan

使用道具

Bridgenc 发表于 2014-10-1 01:16:53 |显示全部楼层 |坛友微信交流群
Thanks for sharing.

使用道具

songlinjl 发表于 2014-10-1 06:30:16 来自手机 |显示全部楼层 |坛友微信交流群
Bridgenc 发表于 2014-10-1 01:16
Thanks for sharing.
大仙级的

使用道具

hoho936 发表于 2014-10-2 04:18:29 |显示全部楼层 |坛友微信交流群
好东西感谢分享

使用道具

Enthuse 发表于 2014-10-3 00:49:49 |显示全部楼层 |坛友微信交流群
thanks ...

使用道具

graylay 发表于 2014-10-3 15:56:49 |显示全部楼层 |坛友微信交流群
謝謝分享

使用道具

maolo928 发表于 2014-10-4 08:46:00 |显示全部楼层 |坛友微信交流群
好东东,谢谢了。

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-3-28 17:17