コード例 #1
0
def P_data(data,m1,b1,m2,b2,σ):
    x,y=data
    μ=m1*x+b1
    
    idx=where(x>=23)[0]
    μ[idx]=m2*x[idx]+b2
    
    distribution=Normal(μ,σ)
    return sum(distribution(y))
def P_data(data, a0, a1, a2, σ):
    x, y = data
    μ = a0 + a1 * x + a2 * x * x  # y ~ μ + random
    distribution = Normal(μ, σ)
    return sum(distribution(y))
def P_data(data, m, b, σ):
    x, y = data
    μ = m * x + b  # y ~ μ + random
    distribution = Normal(μ, σ)
    return sum(distribution(y))

def P_data(data, m, b, σ):
    x, y = data
    μ = m * x + b  # y ~ μ + random
    distribution = Normal(μ, σ)
    return sum(distribution(y))


# In[7]:

data = t, T
model = MCMCModel(
    data,
    P_data,
    m=Normal(0, 10),
    b=Uniform(-100, 100),
    σ=Jeffreys(),
)

# In[8]:

for i in range(2):
    model.run_mcmc(500)
model.plot_chains()

# In[9]:

model.BIC

# In[10]:
コード例 #5
0
def P_data(data,C,p,Z,θ0,σ):
    t,θ=data
    μ=C*exp(-p*t)/(Z-p)+exp(-Z*t)*(θ0-C/(Z-p))
    distribution=Normal(μ,σ)
    return sum(distribution(θ))
コード例 #6
0




# In[ ]:





# In[8]:


model=MCMCModel(sim,
               Z=Normal(5,10),
               )
model.run_mcmc(500,repeat=4)
model.plot_chains()


# In[9]:


model.plot_distributions()


# In[10]:


sim.run(0,11)
コード例 #7
0
def P_data(data,μ,σ):
    x=data
    distribution=Normal(μ,σ)
    return sum(distribution(data))
コード例 #8
0
# In[26]:


def P_data(data,m,b,σ):
    x,y=data
    μ=m*x+b
    distribution=Normal(μ,σ)
    return sum(distribution(y))


# In[31]:


data=x-1960,y
model=MCMCModel(data,P_data,
                m=Normal(0,10),
                b=Uniform(-10,10),
                σ=Jeffreys(),
               )


# In[34]:


model.run_mcmc(500)
model.plot_chains()


# In[35]:

コード例 #9
0

def P_data(data, m, b, σ):
    x, y = data
    μ = m * x + b
    distribution = Normal(μ, σ)
    return sum(distribution(y))


# In[8]:

data = x, y
model = MCMCModel(
    data,
    P_data,
    m=Normal(0, 10),
    b=Uniform(-10, 10),
    σ=Jeffreys(),
)

# In[9]:

for i in range(2):
    model.run_mcmc(500)
model.plot_chains()

# In[17]:

model.plot_distributions()

# In[ ]:
def P_data(data, μ):
    x = data
    σ = 0.1
    distribution = Normal(μ, σ)
    return sum(distribution(x))
plot(y, m, '-o')

# In[32]:


def P_data(data, μ):
    x = data
    σ = 0.1
    distribution = Normal(μ, σ)
    return sum(distribution(x))


# In[39]:

model = MCMCModel(m, P_data, μ=Normal(0, 20))

# In[40]:

model.run_mcmc(500)
model.plot_chains()

# In[41]:

model.plot_distributions()

# In[42]:


def P_data(data, μ, σ):
    x = data