Beispiel #1
0
def prob_3():

    data_x, data_y = hw3_data.evap()

    sigma = pymc.Uniform('sigma', lower=0., upper=500., value=1.)

    # Covariates:
    #   max gr temp, min gr temp, ave gr temp index, max air temp, min air temp, ave air temp index
    beta = pymc.Normal(
        'beta',
        mu=[0, 0, 0, 0, 0, 0, 0],
        tau=[10**-6, 10**-6, 10**-6, 10**-6, 10**-6, 10**-6, 10**-6],
        value=[0, 0, 0, 0, 0, 0, 0])

    @deterministic
    def y_mean(beta=beta, data=data_x):
        return np.dot(data_x, beta)

    y_obs = pymc.Normal('y_obs',
                        value=data_y,
                        mu=y_mean,
                        tau=sigma**-2,
                        observed=True)
    evap_sim = pymc.Normal('evap_sim', mu=y_mean, tau=sigma**-2)

    return vars()
Beispiel #2
0
def prob_3():

    data_x, data_y = hw3_data.evap()

    sigma = pymc.Uniform('sigma', lower=0., upper=500., value=1.)

    # Covariates:
    #   max gr temp, min gr temp, ave gr temp index, max air temp, min air temp, ave air temp index 
    beta = pymc.Normal('beta', mu = [0,0,0,0,0,0,0], tau=[10**-6,10**-6,10**-6,10**-6,10**-6,10**-6,10**-6] , value=[0,0,0,0,0,0,0])  

    @deterministic
    def y_mean(beta=beta, data=data_x):
        return np.dot(data_x,beta) 

    y_obs = pymc.Normal('y_obs', value=data_y, mu=y_mean, tau=sigma**-2, observed=True)
    evap_sim = pymc.Normal('evap_sim', mu=y_mean, tau=sigma**-2)

    return vars()
Beispiel #3
0
from numpy import arange,array,ones,linalg
import hw3_data

data_x, data_y = hw3_data.evap()
# print data_y
print data_x
w = linalg.lstsq(data_x,data_y)[0] # obtaining the parameters
print w
Beispiel #4
0
from numpy import arange, array, ones, linalg
import hw3_data

data_x, data_y = hw3_data.evap()
# print data_y
print data_x
w = linalg.lstsq(data_x, data_y)[0]  # obtaining the parameters
print w