Add statistics for some scales.

master
junos 2023-07-03 14:50:35 +02:00
parent 40170339c2
commit 96bbe32f56
1 changed files with 46 additions and 1 deletions

View File

@ -32,7 +32,7 @@ from features.esm_SAM import extract_stressful_events
# %% # %%
save_figs = True save_figs = False
# %% # %%
participants_inactive_usernames = participants.query_db.get_usernames( participants_inactive_usernames = participants.query_db.get_usernames(
@ -79,6 +79,15 @@ df_esm_PANAS_summary_participant[
{8.0: "positive affect", 9.0: "negative affect"} {8.0: "positive affect", 9.0: "negative affect"}
) )
# %%
df_esm_PANAS_summary_participant.groupby("PANAS subscale").describe()["mean"]
# %%
df_esm_PANAS_summary_participant.groupby("PANAS subscale").describe()["std"]
# %%
df_esm_PANAS_summary_participant.query("std == 0")
# %% # %%
fig1 = sns.displot( fig1 = sns.displot(
data=df_esm_PANAS_summary_participant, x="mean", hue="PANAS subscale", binwidth=0.2 data=df_esm_PANAS_summary_participant, x="mean", hue="PANAS subscale", binwidth=0.2
@ -193,6 +202,20 @@ df_esm_SAM_summary_participant = (
.reset_index(col_level=1) .reset_index(col_level=1)
) )
# %%
df_esm_SAM_event_stressfulness_summary_participant = df_esm_SAM_summary_participant[
df_esm_SAM_summary_participant["questionnaire_id"] == 87
]
df_esm_SAM_event_stressfulness_summary_participant.describe()["mean"]
# %%
df_esm_SAM_event_stressfulness_summary_participant.describe()["std"]
# %%
sns.displot(
data=df_esm_SAM_event_stressfulness_summary_participant, x="mean", binwidth=0.2
)
# %% # %%
df_esm_SAM_threat_challenge_summary_participant = df_esm_SAM_summary_participant[ df_esm_SAM_threat_challenge_summary_participant = df_esm_SAM_summary_participant[
(df_esm_SAM_summary_participant["questionnaire_id"] == 88) (df_esm_SAM_summary_participant["questionnaire_id"] == 88)
@ -225,6 +248,16 @@ fig3.set_axis_labels(x_var="participant standard deviation", y_var="frequency")
if save_figs: if save_figs:
fig3.figure.savefig("SAM_std_participant.pdf", dpi=300) fig3.figure.savefig("SAM_std_participant.pdf", dpi=300)
# %%
df_esm_SAM_threat_challenge_summary_participant.groupby("event subscale").describe()[
"mean"
]
# %%
df_esm_SAM_threat_challenge_summary_participant.groupby("event subscale").describe()[
"std"
]
# %% [markdown] # %% [markdown]
# ## Stressfulness of period # ## Stressfulness of period
@ -233,6 +266,12 @@ df_esm_SAM_period_summary_participant = df_esm_SAM_summary_participant[
df_esm_SAM_summary_participant["questionnaire_id"] == 93 df_esm_SAM_summary_participant["questionnaire_id"] == 93
] ]
# %%
df_esm_SAM_period_summary_participant.describe()["mean"]
# %%
df_esm_SAM_period_summary_participant.describe()["std"]
# %% # %%
sns.displot(data=df_esm_SAM_period_summary_participant, x="mean", binwidth=0.2) sns.displot(data=df_esm_SAM_period_summary_participant, x="mean", binwidth=0.2)
@ -276,6 +315,12 @@ df_esm_JCQ_summary_participant[
{10: "job demand", 11: "job control"} {10: "job demand", 11: "job control"}
) )
# %%
df_esm_JCQ_summary_participant.groupby("JCQ subscale").describe()["mean"]
# %%
df_esm_JCQ_summary_participant.groupby("JCQ subscale").describe()["std"]
# %% # %%
fig4 = sns.displot( fig4 = sns.displot(
data=df_esm_JCQ_summary_participant, data=df_esm_JCQ_summary_participant,