                 chi[n * j + i] = new_chi[j];
             }
             logdens_pop[i] = logdens_pop_prop;
+            logdens_meas[i] = logdens_meas_prop;
             ++naccept[i];
         }
 

	}

	for (int j = 0; j < dim_theta; ++j) {
		theta[j] *= 0.2 * snorm(rng);
	}

	// Initialize the cholesky factor for the theta proposals


	double sigma_msmt[5] = {2.2e-4, 3.3e-4, 5.2e-4, 3.7e-4, 2.2e-4};  // Standard deviation for the measurement errors

	for (int j = 0; j < mfeat; ++j) {
		sigma_msmt[j] *= 1.0;
	}

	for (int i=0; i<ndata; i++) {
        // Loop over the data indices
		for (int j=0; j<p; j++) {
