New answers tagged

0

I would not call this a mixture model, but you can model it with PyMC. Getting the MCMC to converge might be a pain, though, because the parameter space is pretty high dimensional. Let me refactor your data generating procedure to put the data in a DataFrame: import pymc3 as pm, numpy as np, matplotlib.pyplot as plt, pandas as pd from scipy import stats N = ...


1

The column that is giving you all zeros doesn't always give all zeros. I never use it, but I see that if I change year to include 0, the bs-intercept column has a one in it: patsy.dmatrix( "bs(year, knots=knots, degree=0, include_intercept=True) ", {"year": [0,1,2,3], "knots": k}).view() array([[1., 1., 0., 0., 0.], ...


1

This scale factor allows you to translate the default covariance functions (under which $\text{Var}[f(x)]=1$) into the actual covariance function you want to associate to $f(x)$ in your prior. It does not affect the correlation between any $f(x)$ and $f(x')$, although it does affect their covariance (multiplying it by $\eta^2$). Now, when do you need such a ...


3

Here is a minimal example, which works for a DataFrame df with columns X and Y. It uses patsy, which is (still) my go-to package for splines in Python df = pd.DataFrame({'X':np.arange(-5, 5, .1), 'Y':Y # add your data here }) B = patsy.dmatrix('bs(X, knots=np.arange(-5,5,1), degree=3)', df, ...


Top 50 recent answers are included