{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Questionnaire Example" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
StatsPipeline_Plotting_Example.ipynb
](StatsPipeline_Plotting_Example.ipynb) for further information!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"pipeline = bp.stats.StatsPipeline(\n",
" steps=[(\"prep\", \"normality\"), (\"test\", \"pairwise_tests\")],\n",
" params={\"dv\": \"PANAS\", \"groupby\": \"subscale\", \"subject\": \"subject\", \"within\": \"time\"},\n",
")\n",
"\n",
"pipeline.apply(panas);"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"nbsphinx-thumbnail"
]
},
"outputs": [],
"source": [
"fig, axs = plt.subplots(ncols=3)\n",
"\n",
"features = [\"NegativeAffect\", \"PositiveAffect\", \"Total\"]\n",
"\n",
"box_pairs, pvalues = pipeline.sig_brackets(\n",
" \"test\", stats_effect_type=\"within\", plot_type=\"single\", x=\"time\", features=features, subplots=True\n",
")\n",
"\n",
"bp.plotting.multi_feature_boxplot(\n",
" data=panas,\n",
" x=\"time\",\n",
" y=\"PANAS\",\n",
" features=features,\n",
" group=\"subscale\",\n",
" order=[\"pre\", \"post\"],\n",
" stats_kwargs={\"box_pairs\": box_pairs, \"pvalues\": pvalues, \"verbose\": 0},\n",
" palette=cmaps.faculties_light,\n",
" ax=axs,\n",
")\n",
"for ax, feature in zip(axs, features):\n",
" ax.set_title(feature)\n",
"\n",
"fig.tight_layout()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "biopsykit",
"language": "python",
"name": "biopsykit"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}