[SciPy-user] Multivariate regression?
Fri Oct 5 16:10:02 CDT 2007
This may be unnecessarily complicated, but I almost always use fmin
where I have defined some squared error that I want to minimize. This
essentially lets you do an arbitrarily complicated expression.
To use it to do a linear regression, you would use a cost function like:
model = c*x+c
error_squared = (model - y_exp)**2
where x and y_exp would have to be defined in the script before the
function is called.
c_final = optimize.fmin(myfunc, [m0, b0])
would then fit the data using m0 and b0 as initial guesses.
fmin essentially varies the parameters in the vector c until a minimum
of the returned value is found. You could use any model you wanted.
On 10/5/07, halish <firstname.lastname@example.org> wrote:
> in the first place, I'd like to say 'Hi' to all the subscribers, as
> this is my first mail.
> I study econometrics and statistics, and i wanted to try out my
> favourite programming as a scientific tool. Unfortunately, I could not
> find a function for ordinary least squares estimation. The
> stats.linregress() is insufficient for my needs, and stats.glm() seems
> to be for something else (not sure really).
> Would you guys suggest something? Or should I just write it on my own?
> SciPy-user mailing list
More information about the SciPy-user