No. | Orientierungsgrad | Temperatur | Druck |
---|---|---|---|
1 | 45 | 17.5 | 30 |
2 | 38 | 17.0 | 25 |
3 | 41 | 18.5 | 20 |
4 | 34 | 16.0 | 30 |
5 | 59 | 19.0 | 45 |
6 | 47 | 19.5 | 35 |
7 | 35 | 16.0 | 25 |
8 | 43 | 18.0 | 35 |
9 | 54 | 19.0 | 35 |
10 | 52 | 19.5 | 40 |
stat.py
# coding: UTF-8
import numpy as np
def stat(obj, exp):
n = exp.shape[1]
exp = np.vstack([np.ones(n), exp]) #Konstante Laufzeit, erklärende Variable
coef = np.linalg.lstsq(exp.T, obj)[0] #Partieller Regressionskoeffizient
return coef
if __name__ == '__main__':
f = (45, 38, 41, 34, 59, 47, 35, 43, 54, 52) #Orientierungsgrad
t = (17.5, 17.0, 18.5, 16.0, 19.0, 19.5, 16.0, 18.0, 19.0, 19.5) #Temperatur
p = (30, 25, 20, 30, 45, 35, 25, 35, 35, 40) #Druck
obj = np.array(f) #Objektive Variable
exp = np.array([t, p]) #Erklärende Variable
b0, bt, bp = stat(obj, exp)
print "Multiple Regressionsgleichung:Orientierungsgrad= %f + %f*Temperatur+ %f*Druck" % (b0, bt, bp)
> python stat.py
Multiple Regressionsgleichung:Orientierungsgrad= -34.712931 + 3.469813*Temperatur+ 0.533009*Druck
Recommended Posts