博客
关于我
理解statsmodels中OLS对应基金alpha、beta、R-squared
阅读量:349 次
发布时间:2019-03-04

本文共 1428 字,大约阅读时间需要 4 分钟。

  • 概解statsmodels

    《》

    To fit most of the models covered by statsmodels, you will need to create two design matrices.

    The first is a matrix of endogenous variable(s) (i.e. dependent, response, regressand, etc.). 对应Y

    The second is a matrix of exogenous variable(s) (i.e. independent, predictor, regressor, etc.). 对应X

    class statsmodels.regression.linear_model.OLS(endog, exog=None, missing='none', hasconst=None, **kwargs)

  • Model fit and summary

    Fitting a model in statsmodels typically involves 3 easy steps:

    1. Use the model class to describe the model
    2. Fit the model using a class method
    3. Inspect the results using a summary method
    mod = sm.OLS(y, X)  # Describe modelres = mod.fit()		# Fit modelres.summary()		# Summarize model
  • OLS

  • alpha、beta

    x = pd.series # 基准收益X = add_constant(x) # 2-d array y = pd.series # portfolio 收益res = sm.OLS(y, X).fit()alpha, beta = res.params()

    Alpha may be positive or negative and is the result of active investing.

    Beta, on the other hand, can be earned through passive index investing.

  • R-squared||coefficient of determination

    R-squared is also called the coefficient of determination. It’s a statistical measure of how well the regression line fits the data.

    R 2 R^2 R2 is a statistical measure that represents the proportion of the variance for a dependent variable that’s explained by an independent variable or variables in a regression model.

    用于判定统计模型的解释力。通过度量因变量的variance中可以由自变量解释部分所占的比例。

  • Reference

转载地址:http://gdge.baihongyu.com/

你可能感兴趣的文章
mysql 敲错命令 想取消怎么办?
查看>>
Mysql 整形列的字节与存储范围
查看>>
mysql 断电数据损坏,无法启动
查看>>
MySQL 日期时间类型的选择
查看>>
Mysql 时间操作(当天,昨天,7天,30天,半年,全年,季度)
查看>>
MySQL 是如何加锁的?
查看>>
MySQL 是怎样运行的 - InnoDB数据页结构
查看>>
mysql 更新子表_mysql 在update中实现子查询的方式
查看>>
MySQL 有什么优点?
查看>>
mysql 权限整理记录
查看>>
mysql 权限登录问题:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
查看>>
MYSQL 查看最大连接数和修改最大连接数
查看>>
MySQL 查看有哪些表
查看>>
mysql 查看锁_阿里/美团/字节面试官必问的Mysql锁机制,你真的明白吗
查看>>
MySql 查询以逗号分隔的字符串的方法(正则)
查看>>
MySQL 查询优化:提速查询效率的13大秘籍(避免使用SELECT 、分页查询的优化、合理使用连接、子查询的优化)(上)
查看>>
mysql 查询数据库所有表的字段信息
查看>>
【Java基础】什么是面向对象?
查看>>
mysql 查询,正数降序排序,负数升序排序
查看>>
MySQL 树形结构 根据指定节点 获取其下属的所有子节点(包含路径上的枝干节点和叶子节点)...
查看>>