Skip to content

Instantly share code, notes, and snippets.

@farshadl123
farshadl123 / rasch_model.py
Last active November 27, 2023 02:16
rasch_model_pymc3
with pm.Model() as model:
## Independent priors
alpha = pm.Normal('Person', mu = 0, sigma = 3, shape = (1, len(data)))
gamma = pm.Normal('Question', mu = 0, sigma = 3, shape = (data.shape[1], 1))
## Log-Likelihood
def logp(d):
v1 = tt.transpose(d) * tt.log(tt.nnet.sigmoid(alpha - (gamma - gamma.mean(0))))
v2 = tt.transpose((1-d)) * tt.log(1 - tt.nnet.sigmoid(alpha - (gamma - gamma.mean(0))))
This file has been truncated, but you can view the full file.
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",