Subthalamic beta activity and neuroimaging concordance in deep brain stimulation: electrode placement and clinical outcomes.
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Jupyter notebook · 543 lines · 21 KB · no license
- # %% [markdown]
- # # 4. Motor improvements (UPDRS III & IV analysis)
- # %% [markdown]
- # This is the fourth Notebook that has to be runned. In this one we will study the motor improvements in the UPDRS scale
- # %%
- # Load libraries
- import numpy as np
- import pandas as pd
- import matplotlib.pyplot as plt
- import seaborn as sns
- import scipy.stats as stats
- import scipy.stats
- from scipy.stats import chi2_contingency, f_oneway, kruskal, shapiro, anderson, ttest_rel, f_oneway, ttest_ind, kstest
- from statsmodels.stats.multicomp import pairwise_tukeyhsd
- import statsmodels.api as sm
- from statsmodels.formula.api import ols
- from statsmodels.stats.anova import anova_lm
- # %%
- df = pd.read_csv('/home/razkinm/projects/6articulodbs/raw/data.csv', sep=';')
- df_e = pd.read_csv('/home/razkinm/projects/6articulodbs/derivates/df_preprocessed.csv', sep=',')
- df_exploracion = df[['CIC', 'SEXO', 'DD', 'EDAD', 'UPDRS III Off - PREQX', 'UPDRS III On - PREQX', 'UPDRS IV - PRE', 'UPDRS III Off- POSTQX', 'UPDRS III On- POSTQX', 'UPDRS IV - POSTQX', 'LEAD IZQ', 'LEAD DER']]
- df_exploracion = df_exploracion.dropna()
- df_exploracion['COCANAL IZQ'] = None
- df_exploracion['COCANAL DER'] = None
- # Iterate over df_exploracion and df_e to compare values
- for index_exploracion, row_exploracion in df_exploracion.iterrows():
- for index_e, row_e in df_e.iterrows():
- if row_exploracion['CIC'] == row_e['ID']:
- if row_e['HEMISFERIO'] == 1:
- df_exploracion.at[index_exploracion, 'COCANAL DER'] = row_e['COCANAL']
- if row_e['HEMISFERIO'] == 0:
- df_exploracion.at[index_exploracion, 'COCANAL IZQ'] = row_e['COCANAL']
- df_exploracion['COCANAL DER'] = df_exploracion['COCANAL DER'].fillna(0)
- df_exploracion['COCANAL_GENERAL'] = np.where(
- (df_exploracion['COCANAL IZQ'] == 0) & (df_exploracion['COCANAL DER'] == 0), 0,
- np.where((df_exploracion['COCANAL IZQ'] == 1) & (df_exploracion['COCANAL DER'] == 1), 2, 1)
- )
- # create a new variable called 'COINCIDE IMAGEN' to check if LEAD IZQ and LEAD DER have the same value
- df_exploracion['BOTH OPTIMO'] = np.where((df_exploracion['LEAD IZQ'] == 'optimo') & (df_exploracion['LEAD DER'] == 'optimo'), 1, 0)
- conditions = [
- # 'optimo' paired with either 'optimo' or 'suboptimo' except when paired with 'fuera'
- ((df_exploracion['LEAD IZQ'] == 'optimo') & (df_exploracion['LEAD DER'].isin(['optimo', 'suboptimo']))) |
- ((df_exploracion['LEAD DER'] == 'optimo') & (df_exploracion['LEAD IZQ'].isin(['optimo', 'suboptimo']))),
- # All other cases get 0
- True # Acts as a catch-all for any cases not covered above
- ]
- # Define corresponding actions for each condition
- choices = [
- 1, # Cases where 'optimo' is paired as specified
- 0 # All other combinations
- ]
- # Create the new column based on these conditions
- df_exploracion['OPTIMO_vs_no'] = np.select(conditions, choices)
- # %% [markdown]
- # ## 4.1 UPDRS General Analysis
- # %%
- # UPDRS III Off - PREQX
- mean_UPDRSIIIOffPREQX = df_exploracion['UPDRS III Off - PREQX'].mean()
- std_UPDRSIIIOffPREQX = df_exploracion['UPDRS III Off - PREQX'].std()
- # UPDRS III On - PREQX
- mean_UPDRSIIIOnPREQX = df_exploracion['UPDRS III On - PREQX'].mean()
- std_UPDRSIIIOnPREQX = df_exploracion['UPDRS III On - PREQX'].std()
- # UPDRS IV - PRE
- mean_UPDRSIVPRE = df_exploracion['UPDRS IV - PRE'].mean()
- std_UPDRSIVPRE = df_exploracion['UPDRS IV - PRE'].std()
- # UPDRS III Off - POSTQX
- mean_UPDRSIIIOffPOSTQX = df_exploracion['UPDRS III Off- POSTQX'].mean()
- std_UPDRSIIIOffPOSTQX = df_exploracion['UPDRS III Off- POSTQX'].std()
- # UPDRS III Off - POSTQX
- mean_UPDRSIIIOnPOSTQX = df_exploracion['UPDRS III On- POSTQX'].mean()
- std_UPDRSIIIOnPOSTQX = df_exploracion['UPDRS III On- POSTQX'].std()
- # UPDRS IV - POSTQX
- mean_UPDRSIVPOST = df_exploracion['UPDRS IV - POSTQX'].mean()
- std_UPDRSIVPOST = df_exploracion['UPDRS IV - POSTQX'].std()
- # UPDRS III Off - PREQX
- female_mean_UPDRSIIIOffPREQX = df_exploracion[df_exploracion['SEXO'] == 1]['UPDRS III Off - PREQX'].mean()
- female_std_UPDRSIIIOffPREQX = df_exploracion[df_exploracion['SEXO'] == 1]['UPDRS III Off - PREQX'].std()
- # UPDRS III On - PREQX
- female_mean_UPDRSIIIOnPREQX = df_exploracion[df_exploracion['SEXO'] == 1]['UPDRS III On - PREQX'].mean()
- female_std_UPDRSIIIOnPREQX = df_exploracion[df_exploracion['SEXO'] == 1]['UPDRS III On - PREQX'].std()
- # UPDRS IV - PRE
- female_mean_UPDRSIVPRE = df_exploracion[df_exploracion['SEXO'] == 1]['UPDRS IV - PRE'].mean()
- female_std_UPDRSIVPRE = df_exploracion[df_exploracion['SEXO'] == 1]['UPDRS IV - PRE'].std()
- # UPDRS III Off - POSTQX
- female_mean_UPDRSIIIOffPOSTQX = df_exploracion[df_exploracion['SEXO'] == 1]['UPDRS III Off- POSTQX'].mean()
- female_std_UPDRSIIIOffPOSTQX = df_exploracion[df_exploracion['SEXO'] == 1]['UPDRS III Off- POSTQX'].std()
- # UPDRS III Off - POSTQX
- female_mean_UPDRSIIIOnPOSTQX = df_exploracion[df_exploracion['SEXO'] == 1]['UPDRS III On- POSTQX'].mean()
- female_std_UPDRSIIIOnPOSTQX = df_exploracion[df_exploracion['SEXO'] == 1]['UPDRS III On- POSTQX'].std()
- # UPDRS IV - POSTQX
- female_mean_UPDRSIVPOST = df_exploracion[df_exploracion['SEXO'] == 1]['UPDRS IV - POSTQX'].mean()
- female_std_UPDRSIVPOST = df_exploracion[df_exploracion['SEXO'] == 1]['UPDRS IV - POSTQX'].std()
- # UPDRS III Off - PREQX
- male_mean_UPDRSIIIOffPREQX = df_exploracion[df_exploracion['SEXO'] == 2]['UPDRS III Off - PREQX'].mean()
- male_std_UPDRSIIIOffPREQX = df_exploracion[df_exploracion['SEXO'] == 2]['UPDRS III Off - PREQX'].std()
- # UPDRS III On - PREQX
- male_mean_UPDRSIIIOnPREQX = df_exploracion[df_exploracion['SEXO'] == 2]['UPDRS III On - PREQX'].mean()
- male_std_UPDRSIIIOnPREQX = df_exploracion[df_exploracion['SEXO'] == 2]['UPDRS III On - PREQX'].std()
- # UPDRS IV - PRE
- male_mean_UPDRSIVPRE = df_exploracion[df_exploracion['SEXO'] == 2]['UPDRS IV - PRE'].mean()
- male_std_UPDRSIVPRE = df_exploracion[df_exploracion['SEXO'] == 2]['UPDRS IV - PRE'].std()
- # UPDRS III Off - POSTQX
- male_mean_UPDRSIIIOffPOSTQX = df_exploracion[df_exploracion['SEXO'] == 2]['UPDRS III Off- POSTQX'].mean()
- male_std_UPDRSIIIOffPOSTQX = df_exploracion[df_exploracion['SEXO'] == 2]['UPDRS III Off- POSTQX'].std()
- # UPDRS III Off - POSTQX
- male_mean_UPDRSIIIOnPOSTQX = df_exploracion[df_exploracion['SEXO'] == 2]['UPDRS III On- POSTQX'].mean()
- male_std_UPDRSIIIOnPOSTQX = df_exploracion[df_exploracion['SEXO'] == 2]['UPDRS III On- POSTQX'].std()
- # UPDRS IV - POSTQX
- male_mean_UPDRSIVPOST = df_exploracion[df_exploracion['SEXO'] == 2]['UPDRS IV - POSTQX'].mean()
- male_std_UPDRSIVPOST = df_exploracion[df_exploracion['SEXO'] == 2]['UPDRS IV - POSTQX'].std()
- # print all results
- print('UPDRS III Off - PREQX')
- print('Mean:', mean_UPDRSIIIOffPREQX)
- print('Standard Deviation:', std_UPDRSIIIOffPREQX)
- print('UPDRS III On - PREQX')
- print('Mean:', mean_UPDRSIIIOnPREQX)
- print('Standard Deviation:', std_UPDRSIIIOnPREQX)
- print('UPDRS IV - PRE')
- print('Mean:', mean_UPDRSIVPRE)
- print('Standard Deviation:', std_UPDRSIVPRE)
- print('UPDRS III Off - POSTQX')
- print('Mean:', mean_UPDRSIIIOffPOSTQX)
- print('Standard Deviation:', std_UPDRSIIIOffPOSTQX)
- print('UPDRS III On - POSTQX')
- print('Mean:', mean_UPDRSIIIOnPOSTQX)
- print('Standard Deviation:', std_UPDRSIIIOnPOSTQX)
- print('UPDRS IV - POSTQX')
- print('Mean:', mean_UPDRSIVPOST)
- print('Standard Deviation:', std_UPDRSIVPOST)
- print('UPDRS FEMALE')
- print('UPDRS III Off - PREQX')
- print('Mean:', female_mean_UPDRSIIIOffPREQX)
- print('Standard Deviation:', female_std_UPDRSIIIOffPREQX)
- print('UPDRS III On - PREQX')
- print('Mean:', female_mean_UPDRSIIIOnPREQX)
- print('Standard Deviation:', female_std_UPDRSIIIOnPREQX)
- print('UPDRS IV - PRE')
- print('Mean:', female_mean_UPDRSIVPRE)
- print('Standard Deviation:', female_std_UPDRSIVPRE)
- print('UPDRS III Off - POSTQX')
- print('Mean:', female_mean_UPDRSIIIOffPOSTQX)
- print('Standard Deviation:', female_std_UPDRSIIIOffPOSTQX)
- print('UPDRS III On - POSTQX')
- print('Mean:', female_mean_UPDRSIIIOnPOSTQX)
- print('Standard Deviation:', female_std_UPDRSIIIOnPOSTQX)
- print('UPDRS IV - POSTQX')
- print('Mean:', female_mean_UPDRSIVPOST)
- print('Standard Deviation:', female_std_UPDRSIVPOST)
- print('UPDRS MALE')
- print('UPDRS III Off - PREQX')
- print('Mean:', male_mean_UPDRSIIIOffPREQX)
- print('Standard Deviation:', male_std_UPDRSIIIOffPREQX)
- print('UPDRS III On - PREQX')
- print('Mean:', male_mean_UPDRSIIIOnPREQX)
- print('Standard Deviation:', male_std_UPDRSIIIOnPREQX)
- print('UPDRS IV - PRE')
- print('Mean:', male_mean_UPDRSIVPRE)
- print('Standard Deviation:', male_std_UPDRSIVPRE)
- print('UPDRS III Off - POSTQX')
- print('Mean:', male_mean_UPDRSIIIOffPOSTQX)
- print('Standard Deviation:', male_std_UPDRSIIIOffPOSTQX)
- print('UPDRS III On - POSTQX')
- print('Mean:', male_mean_UPDRSIIIOnPOSTQX)
- print('Standard Deviation:', male_std_UPDRSIIIOnPOSTQX)
- print('UPDRS IV - POSTQX')
- print('Mean:', male_mean_UPDRSIVPOST)
- print('Standard Deviation:', male_std_UPDRSIVPOST)
- # %% [markdown]
- # ## 4.2 Is there a stadistically difference between people that have optimo/suboptimo or suboptimo/fuera?
- # %% [markdown]
- # #### For UPDRS III Off
- # %%
- # Assuming 'UPDRS III Off - PREQX' and 'UPDRS III Off - POSTQX' are your columns
- df_exploracion['DIFF UPDRS III Off'] = df_exploracion['UPDRS III Off- POSTQX'] - df_exploracion['UPDRS III Off - PREQX']
- from scipy.stats import shapiro, levene, ttest_ind, mannwhitneyu, kstest
- # Split the data into two groups
- group1 = df_exploracion[df_exploracion['OPTIMO_vs_no'] == 1]['DIFF UPDRS III Off'].dropna()
- group2 = df_exploracion[df_exploracion['OPTIMO_vs_no'] == 0]['DIFF UPDRS III Off'].dropna()
- # Test for normality
- print("Normality Test (Shapiro-Wilk):")
- norm1 = scipy.stats.kstest(group1)
- norm2 = scipy.stats.kstest(group2)
- print("Group 1:", norm1)
- print("Group 2:", norm2)
- # Test for equality of variances
- print("Equality of Variances Test (Levene’s Test):")
- lev_test = levene(group1, group2)
- print(lev_test)
- # Choose the test based on the assumptions
- print("\nIndependent Samples Test:")
- if norm1.pvalue > 0.05 and norm2.pvalue > 0.05 and lev_test.pvalue > 0.05:
- # If both distributions are normal and variances are equal, use t-test
- t_stat, p_val = ttest_ind(group1, group2)
- print(f"Independent t-test: t={t_stat}, p={p_val}")
- else:
- # If assumptions are not met, use Mann-Whitney U test
- u_stat, p_val = mannwhitneyu(group1, group2)
- print(f"Mann-Whitney U test: U={u_stat}, p={p_val}")
- # Interpret the p-value
- if p_val < 0.05:
- print("There is a statistically significant difference between the groups.")
- else:
- print("There is no statistically significant difference between the groups.")
- # %% [markdown]
- # #### For UPDRS III On
- # %%
- # Assuming 'UPDRS III Off - PREQX' and 'UPDRS III Off - POSTQX' are your columns
- df_exploracion['DIFF UPDRS III On'] = df_exploracion['UPDRS III On- POSTQX'] - df_exploracion['UPDRS III On - PREQX']
- from scipy.stats import shapiro, levene, ttest_ind, mannwhitneyu, norm
- # Split the data into two groups
- group1 = df_exploracion[df_exploracion['OPTIMO_vs_no'] == 1]['DIFF UPDRS III On'].dropna()
- group2 = df_exploracion[df_exploracion['OPTIMO_vs_no'] == 0]['DIFF UPDRS III On'].dropna()
- data = group1
- mean, std = norm.fit(data) # Fit a normal distribution to get mean and std
- stat, p = kstest(data, 'norm', args=(mean, std))
- print("Statistic:", stat, "P-value:", p)
- data = group2
- mean, std = norm.fit(data) # Fit a normal distribution to get mean and std
- stat, p = kstest(data, 'norm', args=(mean, std))
- print("Statistic:", stat, "P-value:", p)
- if p > 0.05:
- print("Data is normally distributed (fail to reject H0).")
- else:
- print("Data is not normally distributed (reject H0).")
- if p > 0.05:
- print("Data is normally distributed (fail to reject H0).")
- else:
- print("Data is not normally distributed (reject H0).")
- # Test for normality
- print("Normality Test (Shapiro-Wilk):")
- norm1 = shapiro(group1)
- norm2 = shapiro(group2)
- print("Group 1:", norm1)
- print("Group 2:", norm2)
- # Test for equality of variances
- print("Equality of Variances Test (Levene’s Test):")
- lev_test = levene(group1, group2)
- print(lev_test)
- # Choose the test based on the assumptions
- print("\nIndependent Samples Test:")
- if norm1.pvalue > 0.05 and norm2.pvalue > 0.05 and lev_test.pvalue > 0.05:
- # If both distributions are normal and variances are equal, use t-test
- t_stat, p_val = ttest_ind(group1, group2)
- print(f"Independent t-test: t={t_stat}, p={p_val}")
- else:
- # If assumptions are not met, use Mann-Whitney U test
- u_stat, p_val = mannwhitneyu(group1, group2)
- print(f"Mann-Whitney U test: U={u_stat}, p={p_val}")
- # Interpret the p-value
- if p_val < 0.05:
- print("There is a statistically significant difference between the groups.")
- else:
- print("There is no statistically significant difference between the groups.")
- # %% [markdown]
- # #### For UPDRS IV
- # %%
- # Assuming 'UPDRS III Off - PREQX' and 'UPDRS III Off - POSTQX' are your columns
- df_exploracion['DIFF UPDRS IV'] = df_exploracion['UPDRS IV - POSTQX'] - df_exploracion['UPDRS IV - PRE']
- from scipy.stats import shapiro, levene, ttest_ind, mannwhitneyu
- # Split the data into two groups
- group1 = df_exploracion[df_exploracion['OPTIMO_vs_no'] == 1]['DIFF UPDRS IV'].dropna()
- group2 = df_exploracion[df_exploracion['OPTIMO_vs_no'] == 0]['DIFF UPDRS IV'].dropna()
- # Test for normality
- print("Normality Test (Shapiro-Wilk):")
- norm1 = shapiro(group1)
- norm2 = shapiro(group2)
- print("Group 1:", norm1)
- print("Group 2:", norm2)
- # Test for equality of variances
- print("Equality of Variances Test (Levene’s Test):")
- lev_test = levene(group1, group2)
- print(lev_test)
- # Choose the test based on the assumptions
- print("\nIndependent Samples Test:")
- if norm1.pvalue > 0.05 and norm2.pvalue > 0.05 and lev_test.pvalue > 0.05:
- # If both distributions are normal and variances are equal, use t-test
- t_stat, p_val = ttest_ind(group1, group2)
- print(f"Independent t-test: t={t_stat}, p={p_val}")
- else:
- # If assumptions are not met, use Mann-Whitney U test
- u_stat, p_val = mannwhitneyu(group1, group2)
- print(f"Mann-Whitney U test: U={u_stat}, p={p_val}")
- # Interpret the p-value
- if p_val < 0.05:
- print("There is a statistically significant difference between the groups.")
- else:
- print("There is no statistically significant difference between the groups.")
- # %% [markdown]
- # ## 4.3 Analysis for differences related to sex, age or disease duration
- # %% [markdown]
- # ## Any difference related to age?
- # %%
- df = df_exploracion.rename(columns={
- 'UPDRS III Off - PREQX': 'UPDRS_III_Off_PREQX',
- 'UPDRS III Off- POSTQX': 'UPDRS_III_Off_POSTQX',
- 'UPDRS III On - PREQX': 'UPDRS_III_On_PREQX',
- 'UPDRS III On- POSTQX': 'UPDRS_III_On_POSTQX',
- 'UPDRS IV - PRE': 'UPDRS_IV_PRE',
- 'UPDRS IV - POSTQX': 'UPDRS_IV_POSTQX',
- 'EDAD': 'EDAD'
- })
- df['UPDRS_III_Off_Diff'] = df['UPDRS_III_Off_POSTQX'] - df['UPDRS_III_Off_PREQX']
- df['UPDRS_III_On_Diff'] = df['UPDRS_III_On_POSTQX'] - df['UPDRS_III_On_PREQX']
- df['UPDRS_IV_Diff'] = df['UPDRS_IV_POSTQX'] - df['UPDRS_IV_PRE']
- # Análisis de regresión para verificar el efecto de la edad
- def regress_age_effect(df, dependent_var):
- X = sm.add_constant(df['EDAD'])
- model = sm.OLS(df[dependent_var], X).fit()
- print(f"Regression analysis for {dependent_var} on AGE")
- print(model.summary())
- regress_age_effect(df, 'UPDRS_III_Off_Diff')
- regress_age_effect(df, 'UPDRS_III_On_Diff')
- regress_age_effect(df, 'UPDRS_IV_Diff')
- # %% [markdown]
- # No hay evidencia significativa de que la edad tenga un efecto en las diferencias en las puntuaciones UPDRS_III_Off (p-valor = 0.794).
- # No hay evidencia significativa de que la edad tenga un efecto en las diferencias en las puntuaciones UPDRS_III_On (p-valor = 0.653).
- # No hay evidencia significativa de que la edad tenga un efecto en las diferencias en las puntuaciones UPDRS_IV_Diff (p-valor = 0.412).
- # %% [markdown]
- # ## Any difference related to sex?
- # %% [markdown]
- # ### Linear Regression Analysis
- # %%
- df = df_exploracion.rename(columns={
- 'UPDRS III Off - PREQX': 'UPDRS_III_Off_PREQX',
- 'UPDRS III Off- POSTQX': 'UPDRS_III_Off_POSTQX',
- 'UPDRS III On - PREQX': 'UPDRS_III_On_PREQX',
- 'UPDRS III On- POSTQX': 'UPDRS_III_On_POSTQX',
- 'UPDRS IV - PRE': 'UPDRS_IV_PRE',
- 'UPDRS IV - POSTQX': 'UPDRS_IV_POSTQX',
- 'SEXO': 'SEXO'
- })
- # Calcular las diferencias en las puntuaciones
- df['UPDRS_III_Off_Diff'] = df['UPDRS_III_Off_POSTQX'] - df['UPDRS_III_Off_PREQX']
- df['UPDRS_III_On_Diff'] = df['UPDRS_III_On_POSTQX'] - df['UPDRS_III_On_PREQX']
- df['UPDRS_IV_Diff'] = df['UPDRS_IV_POSTQX'] - df['UPDRS_IV_PRE']
- # Análisis de regresión para verificar el efecto del sexo
- def regress_sex_effect(df, dependent_var):
- X = sm.add_constant(df['SEXO'])
- model = sm.OLS(df[dependent_var], X).fit()
- print(f"Regression analysis for {dependent_var} on SEX")
- print(model.summary())
- # Verificar el efecto del sexo en las diferencias UPDRS
- regress_sex_effect(df, 'UPDRS_III_Off_Diff')
- regress_sex_effect(df, 'UPDRS_III_On_Diff')
- regress_sex_effect(df, 'UPDRS_IV_Diff')
- # %%
- # Filtrar los datos según LEAD y SEXO
- df_filtered_optimosub_male = df_exploracion[(df_exploracion['OPTIMO_vs_no'] == 1) & (df_exploracion['SEXO'] == 2)]
- df_filtered_optimosub_female = df_exploracion[(df_exploracion['OPTIMO_vs_no'] == 1) & (df_exploracion['SEXO'] == 1)]
- df_filtered_subfuera_male = df_exploracion[(df_exploracion['OPTIMO_vs_no'] == 0) & (df_exploracion['SEXO'] == 2)]
- df_filtered_subfuera_female = df_exploracion[(df_exploracion['OPTIMO_vs_no'] == 0) & (df_exploracion['SEXO'] == 1)]
- # Diccionario para almacenar los resultados
- results = {
- 'Group': [],
- 'UPDRS III Off': [],
- 'UPDRS III On': [],
- 'UPDRS IV': []
- }
- def paired_t_tests(df, group_name):
- # Calcular el tamaño de la muestra
- n = len(df)
- # Prueba t pareada para UPDRS III Off
- ttest_off = ttest_rel(df['UPDRS III Off - PREQX'], df['UPDRS III Off- POSTQX'])
- print(f"Paired t-test {group_name} UPDRS III Off (N={n}): t={ttest_off.statistic}, p={ttest_off.pvalue:.3f}")
- # Prueba t pareada para UPDRS III On
- ttest_on = ttest_rel(df['UPDRS III On - PREQX'], df['UPDRS III On- POSTQX'])
- print(f"Paired t-test {group_name} UPDRS III On (N={n}): t={ttest_on.statistic}, p={ttest_on.pvalue:.3f}")
- # Prueba t pareada para UPDRS IV
- ttest_iv = ttest_rel(df['UPDRS IV - PRE'], df['UPDRS IV - POSTQX'])
- print(f"Paired t-test {group_name} UPDRS IV (N={n}): t={ttest_iv.statistic}, p={ttest_iv.pvalue:.3f}")
- # Guardar los resultados en el diccionario
- results['Group'].append(group_name)
- results['UPDRS III Off'].append(round(ttest_off.pvalue, 3))
- results['UPDRS III On'].append(round(ttest_on.pvalue, 3))
- results['UPDRS IV'].append(round(ttest_iv.pvalue, 3))
- # Realizar las pruebas para cada grupo y sexo
- print('OPTIMOSUB - Male')
- paired_t_tests(df_filtered_optimosub_male, 'OPTIMO - Male')
- print('OPTIMOSUB - Female')
- paired_t_tests(df_filtered_optimosub_female, 'OPTIMO - Female')
- # Crear la tabla comparativa
- results_df = pd.DataFrame(results)
- print("\nResultados Comparativos de p-valores")
- print(results_df)
- # %%
- # df_sex = df_exploracion but just the rows that have OPTIMO_vs_no == 1
- df_sex = df_exploracion[df_exploracion['OPTIMO_vs_no'] == 1]
- df = df_sex.rename(columns={
- 'UPDRS III Off - PREQX': 'UPDRS_III_Off_PREQX',
- 'UPDRS III Off- POSTQX': 'UPDRS_III_Off_POSTQX',
- 'UPDRS III On - PREQX': 'UPDRS_III_On_PREQX',
- 'UPDRS III On- POSTQX': 'UPDRS_III_On_POSTQX',
- 'UPDRS IV - PRE': 'UPDRS_IV_PRE',
- 'UPDRS IV - POSTQX': 'UPDRS_IV_POSTQX',
- 'SEXO': 'SEXO'
- })
- # Calcular las diferencias en las puntuaciones
- df['UPDRS_III_Off_Diff'] = df['UPDRS_III_Off_POSTQX'] - df['UPDRS_III_Off_PREQX']
- df['UPDRS_III_On_Diff'] = df['UPDRS_III_On_POSTQX'] - df['UPDRS_III_On_PREQX']
- df['UPDRS_IV_Diff'] = df['UPDRS_IV_POSTQX'] - df['UPDRS_IV_PRE']
- # Análisis de regresión para verificar el efecto del sexo
- def regress_sex_effect(df, dependent_var):
- X = sm.add_constant(df['SEXO'])
- model = sm.OLS(df[dependent_var], X).fit()
- print(f"Regression analysis for {dependent_var} on SEX")
- print(model.summary())
- # Verificar el efecto del sexo en las diferencias UPDRS
- regress_sex_effect(df, 'UPDRS_III_Off_Diff')
- regress_sex_effect(df, 'UPDRS_III_On_Diff')
- regress_sex_effect(df, 'UPDRS_IV_Diff')
- # %% [markdown]
- # ## Any difference related to disease duration?
- # %% [markdown]
- # #### Linear Regression
- # %%
- df = df_exploracion.rename(columns={
- 'UPDRS III Off - PREQX': 'UPDRS_III_Off_PREQX',
- 'UPDRS III Off- POSTQX': 'UPDRS_III_Off_POSTQX',
- 'UPDRS III On - PREQX': 'UPDRS_III_On_PREQX',
- 'UPDRS III On- POSTQX': 'UPDRS_III_On_POSTQX',
- 'UPDRS IV - PRE': 'UPDRS_IV_PRE',
- 'UPDRS IV - POSTQX': 'UPDRS_IV_POSTQX',
- 'DD': 'DURATION'
- })
- # Calcular las diferencias en las puntuaciones
- df['UPDRS_III_Off_Diff'] = df['UPDRS_III_Off_POSTQX'] - df['UPDRS_III_Off_PREQX']
- df['UPDRS_III_On_Diff'] = df['UPDRS_III_On_POSTQX'] - df['UPDRS_III_On_PREQX']
- df['UPDRS_IV_Diff'] = df['UPDRS_IV_POSTQX'] - df['UPDRS_IV_PRE']
- # Análisis de regresión para verificar el efecto del sexo
- def regress_sex_effect(df, dependent_var):
- X = sm.add_constant(df['DURATION'])
- model = sm.OLS(df[dependent_var], X).fit()
- print(f"Regression analysis for {dependent_var} on DURATION")
- print(model.summary())
- # Verificar el efecto del sexo en las diferencias UPDRS
- regress_sex_effect(df, 'UPDRS_III_Off_Diff')
- regress_sex_effect(df, 'UPDRS_III_On_Diff')
- regress_sex_effect(df, 'UPDRS_IV_Diff')
UPDRS.ipynb at commit 451a9ca, no license · at the source
Overview
- Biomedical Research Doctorate Program, University of the Basque Country, Leioa, Spain
- Computational Neuroimaging Lab, Biobizkaia Health Research Institute, Barakaldo, Spain
- Department of Neurosurgery, Cruces University Hospital, Barakaldo, Spain
- Neurodegenerative Diseases Group, Biobizkaia Bizkaia Health Research Institute, Barakaldo, Spain
- Department of Neurology, Cruces University Hospital, Barakaldo, Spain
- CIBERNED-CIBER, Institute Carlos III, Madrid, Spain
- Radiology Department, Cruces University Hospital, Barakaldo, Spain
- Department of Surgery and Radiology and Physical Medicine, University of the Basque Country UPV/EHU, Leioa, Spain
- Neurophysiology Department, Cruces University Hospital, Barakaldo, Spain
- Department of Neurosciences, University of the Basque Country UPV/EHU, Leioa, Spain
- Ikerbasque: The Basque Foundation for Science, Bilbao, Spain
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repository
Its files are read in the Code ↔ Paper reader above.
compneurobilbao/stn-beta-analysis
451a9ca2349c7c74a04ec071a4e16f8d1f5fb343, 26 November 2025Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
5 files
- scripts/
UPDRS.ipynb , Jupyter, 543 lines - scripts/
contingency.ipynb , Jupyter, 109 lines - scripts/
general.ipynb , Jupyter, 244 lines - scripts/
preprocessing.ipynb , Jupyter, 123 lines - README.md, Text, 46 lines
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 4 scripts, each with its path and the digest of its content;
- no match between paragraphs and code yet;
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 2, 28 September 2026
- Funding: added Ikerbasque, Basque Foundation for Science; Ministerio de Ciencia e Innovación: RYC2021-032390-I, RYC2021; Instituto de Salud Carlos III: PI23/01270
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, pages, dates, 10 authors, 5 keywords, 31 references.
Cite
This paper
Razkin, M., de Gopegui, E. R., Tijero, B., del Valle, T. F., Bilbao, G., Dolado, A., Lambarri, I., Gómez-Estéban, J. C., Erramuzpe, A., & Ruiz-Lopez, M. (2026). Subthalamic beta activity and neuroimaging concordance in deep brain stimulation: electrode placement and clinical outcomes. Clinical neurophysiology practice, 11, 766-773. https://
BibTeX
@article{razkin2026subth
author = {Razkin, Malen and de Gopegui, Edurne Ruiz and Tijero, Beatriz and del Valle, Tamara Fernández and Bilbao, Gaizka and Dolado, Ainara and Lambarri, Imanol and Gómez-Estéban, Juan Carlos and Erramuzpe, Asier and Ruiz-Lopez, Marta},
title = {{Subthalamic beta activity and neuroimaging concordance in deep brain stimulation: electrode placement and clinical outcomes}},
journal = {Clinical neurophysiology practice},
year = {2026},
month = aug,
volume = {11},
pages = {766--773},
publisher = {Elsevier},
issn = {2467-981X},
doi = {10.1016/
url = {https://
pmid = {42733699},
pmcid = {PMC13571461}
}
RIS
TY - JOUR
AU - Razkin, Malen
AU - de Gopegui, Edurne Ruiz
AU - Tijero, Beatriz
AU - del Valle, Tamara Fernández
AU - Bilbao, Gaizka
AU - Dolado, Ainara
AU - Lambarri, Imanol
AU - Gómez-Estéban, Juan Carlos
AU - Erramuzpe, Asier
AU - Ruiz-Lopez, Marta
TI - Subthalamic beta activity and neuroimaging concordance in deep brain stimulation: electrode placement and clinical outcomes
T2 - Clinical neurophysiology practice
J2 - Clin Neurophysiol Pract
PY - 2026
DA - 2026/
VL - 11
SP - 766
EP - 773
SN - 2467-981X
PB - Elsevier
DO - 10.1016/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1016/
"type": "article-journal",
"title": "Subthalamic beta activity and neuroimaging concordance in deep brain stimulation: electrode placement and clinical outcomes",
"container-title": "Clinical neurophysiology practice",
"author": [
{
"family": "Razkin",
"given": "Malen"
},
{
"family": "de Gopegui",
"given": "Edurne Ruiz"
},
{
"family": "Tijero",
"given": "Beatriz"
},
{
"family": "del Valle",
"given": "Tamara Fernández"
},
{
"family": "Bilbao",
"given": "Gaizka"
},
{
"family": "Dolado",
"given": "Ainara"
},
{
"family": "Lambarri",
"given": "Imanol"
},
{
"family": "Gómez-Estéban",
"given": "Juan Carlos"
},
{
"family": "Erramuzpe",
"given": "Asier"
},
{
"family": "Ruiz-Lopez",
"given": "Marta"
}
],
"container-title-short":
"volume": "11",
"page": "766-773",
"DOI": "10.1016/
"PMID": "42733699",
"PMCID": "PMC13571461",
"ISSN": "2467-981X",
"publisher": "Elsevier",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
27
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1038/s41531-026-01380-1 [code]
- Identifying maximal beta power from directional subthalamic local field potentials in Parkinson's disease.Journal: NPJ Parkinson's diseaseIn common: statsmodels, seaborn, pandas, 3 other tools, extracellular electrophysiology (units, LFP), clinical / translational, 6 references
- [2] doi:10.1038/s41531-026-01531-4 [code]
- Inconsistent subthalamic local field potential beta activity amid in- and antiphasic neuronal bursts.Journal: NPJ Parkinson's diseaseIn common: pandas, SciPy, Matplotlib, 1 other tool, extracellular electrophysiology (units, LFP), clinical / translational, 4 references
- [3] doi:10.1002/ana.78206 [code]
- Multimodal Image Guidance in Subthalamic Deep Brain Stimulation for Parkinson's Disease.Journal: Annals of neurologyIn common: seaborn, pandas, SciPy, 2 other tools, clinical / translational, 3 references
- [4] doi:10.1038/s41531-026-01354-3 [code]
- Neuromodulation-induced normalization of cortical metastable dynamics signatures in Parkinson's disease.Journal: NPJ Parkinson's diseaseIn common: statsmodels, seaborn, pandas, 3 other tools, 2 references
- [5] doi:10.1038/s41467-026-75837-5 [code]
- A hierarchical framework for cortical and subcortical gray-matter parcellation across rodents, primates, and humans.Journal: Nature communicationsIn common: statsmodels, seaborn, pandas, 3 other tools, 2 references
- [6] doi:10.1038/s41591-026-04432-4 [code]
- Activity-dependent adaptive deep brain stimulation improves gait in Parkinson's disease.Journal: Nature medicineIn common: SciPy, Matplotlib, NumPy, clinical / translational, 3 references
- [7] doi:10.1162/imag.a.1264 [code]
- Data-driven subtyping and staging of ALS: A multicenter, longitudinal, deformation-based morphometry study.Journal: Imaging neuroscience (Cambridge, Mass.)In common: statsmodels, seaborn, pandas, 3 other tools, clinical / translational, 1 reference
- [8] doi:10.1038/s41591-026-04434-2 [code]
- Adaptive deep brain stimulation for dynamic gait control in Parkinson's disease: a randomized feasibility trial.Journal: Nature medicineIn common: pandas, SciPy, Matplotlib, 1 other tool, clinical / translational, 2 references
- [9] doi:10.1162/imag.a.1262 [code]
- Frame-wise multi-echo distortion correction for superior functional MRI.Journal: Imaging neuroscience (Cambridge, Mass.)In common: seaborn, pandas, SciPy, 2 other tools, 2 references
- [10] doi:10.1162/imag.a.1362 [code]
- Human fMRI at 11.7T: Assessing feasibility, stability, and reliability on the Iseult scanner.Journal: Imaging neuroscience (Cambridge, Mass.)In common: statsmodels, seaborn, pandas, 3 other tools, 1 reference
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 4 scripts, and 0 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:f0a41a1d26e54c6b…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
