我正在使用scipy Cookbookols.py下载的代码(下载在第一段用粗体OLS)但我需要了解而不是使用ols函数的随机数据来进行多元线性回归.
我有一个特定的因变量y和三个解释变量.每当我尝试将变量放入随机变量时,它就会给出错误:
TypeError:此构造函数不带参数.
有人可以帮忙吗?这可能吗?
这是我试图使用的ols代码的副本以及我尝试输入的变量
from __future__ import division
from scipy import c_, ones, dot, stats, diff
from scipy.linalg import inv, solve, det
from numpy import log, pi, sqrt, square, diagonal
from numpy.random import randn, seed
import time
class ols:
"""
Author: Vincent Nijs (+ ?)
Email: v-nijs at kellogg.northwestern.edu
Last Modified: Mon Jan 15 17:56:17 CST 2007
Dependencies: See import statement at the top of this file
Doc: Class for multi-variate regression using …Run Code Online (Sandbox Code Playgroud)