PLEASE FIND CORRELATION BETWEEN TC TG HDL LDL VLDL BOTH RATIO WITH CYC C E GFR AND SAME PARAMETERS WITH CREATININE E GFR

Reading File
Running Command

python3 -c " import openpyxl wb = openpyxl.load_workbook('/home/daytona/workspace/attachments/44a34df6-ea90-4821-87a9-f59d396c13db/ARTICLE SMITA-updated GFR.xlsx') print('Sheets:', wb.sheetnames) ws = wb.active print('Dimensions:', ws.dimensions) print('Max row:', ws.max_row, 'Max col:', ws.max_column) # Print first 3 rows to see headers for row in ws.iter_rows(min_row=1, max_row=3, values_only=True): print(row) "

The current file is a template with empty values. I need to read the raw data from the file to compute correlations. Let me check all sheets more carefully.
Running Command

python3 -c " import openpyxl wb = openpyxl.load_workbook('/home/daytona/workspace/attachments/44a34df6-ea90-4821-87a9-f59d396c13db/ARTICLE SMITA-updated GFR.xlsx') print('=== Sheet: Male ===') ws = wb['Male'] for row in ws.iter_rows(values_only=True): print(row) print() print('=== Sheet: Sheet3 ===') ws2 = wb['Sheet3'] print('Dimensions:', ws2.dimensions) print('Max row:', ws2.max_row, 'Max col:', ws2.max_column) for row in ws2.iter_rows(min_row=1, max_row=5, values_only=True): print(row) "

I have all the data. Now I'll compute the correlations, fill in Sheet3, and produce a professional output Excel file.
Running Command

python3 << 'EOF' import openpyxl import math from scipy import stats import numpy as np wb = openpyxl.load_workbook('/home/daytona/workspace/attachments/44a34df6-ea90-4821-87a9-f59d396c13db/ARTICLE SMITA-updated GFR.xlsx') ws = wb['Male'] # Column indices (0-based from row): AGE=3(D), CREAT=4(F->col5?), CHOL=5, TG=6, HDL=7, LDL=8, VLDL=9, TC/HDL=10, LDL/HDL=11, CYS-C=12(N), eGFR_Creat=14(P), eGFR_CysC=15(Q) # Let's confirm by checking headers row (row 3, index 2) headers = [cell.value for cell in ws[3]] print("Headers:", headers) print("Col count:", len(headers)) EOF

Running Command

python3 << 'EOF' import openpyxl import math from scipy import stats import numpy as np wb = openpyxl.load_workbook('/home/daytona/workspace/attachments/44a34df6-ea90-4821-87a9-f59d396c13db/ARTICLE SMITA-updated GFR.xlsx') ws = wb['Male'] # Column indices (1-based): A=1,B=2,C=3,D=4(AGE),E=5(UREA),F=6(CREAT),G=7(CHOL/TC),H=8(TG),I=9(HDL),J=10(LDL),K=11(VLDL),L=12(TC/HDL),M=13(LDL/HDL),N=14(CYS-C),O=15(empty),P=16(eGFR Creat),Q=17(eGFR CysC) data = { 'TC': [], 'TG': [], 'HDL': [], 'LDL': [], 'VLDL': [], 'TC_HDL': [], 'LDL_HDL': [], 'AGE': [], 'CYS_C': [], 'CREAT': [], 'eGFR_Creat': [], 'eGFR_CysC': [] } for row in ws.iter_rows(min_row=4, max_row=ws.max_row, values_only=True): if row[0] is None: continue age = row[3] # D creat = row[5] # F tc = row[6] # G tg = row[7] # H hdl = row[8] # I ldl = row[9] # J vldl = row[10] # K tc_hdl = row[11] # L ldl_hdl = row[12] # M cys_c = row[13] # N sex = row[2] # C # Compute eGFR values manually if age and creat and isinstance(creat, (int, float)): if sex == 'Male': egfr_creat = 175 * (creat**-1.154) * (age**-0.203) else: egfr_creat = 175 * (creat**-1.154) * (age**-0.203) * 0.742 else: egfr_creat = None if age and cys_c and isinstance(cys_c, (int, float)): if sex == 'Male': egfr_cysc = 127.7 * (cys_c**-1.17) * (age**-0.13) else: egfr_cysc = 127.7 * (cys_c**-1.17) * (age**-0.13) * 0.91 else: egfr_cysc = None if all(v is not None for v in [tc, tg, hdl, ldl, vldl, tc_hdl, ldl_hdl, cys_c, creat, egfr_creat, egfr_cysc]): data['TC'].append(tc) data['TG'].append(tg) data['HDL'].append(hdl) data['LDL'].append(ldl) data['VLDL'].append(vldl) data['TC_HDL'].append(tc_hdl) data['LDL_HDL'].append(ldl_hdl) data['CYS_C'].append(cys_c) data['CREAT'].append(creat) data['eGFR_Creat'].append(egfr_creat) data['eGFR_CysC'].append(egfr_cysc) data['AGE'].append(age) print(f"Total valid rows: {len(data['TC'])}") params = ['TC', 'TG', 'HDL', 'LDL', 'VLDL', 'TC_HDL', 'LDL_HDL'] param_labels = ['TC', 'TG', 'HDL', 'LDL', 'VLDL', 'TC/HDL', 'LDL/HDL'] print("\n{'Parameter': 'r_CysC', 'p_CysC', 'r_Creat', 'p_Creat'}") print("-"*60) results = [] for p, lbl in zip(params, param_labels): x = np.array(data[p]) r_cysc, p_cysc = stats.pearsonr(x, np.array(data['eGFR_CysC'])) r_creat, p_creat = stats.pearsonr(x, np.array(data['eGFR_Creat'])) results.append((lbl, r_cysc, p_cysc, r_creat, p_creat)) print(f"{lbl:10s} | r={r_cysc:+.4f}, p={p_cysc:.4f} | r={r_creat:+.4f}, p={p_creat:.4f}") # Now write to Sheet3 ws3 = wb['Sheet3'] # Row mapping: TC=3, TG=4, HDL=5, LDL=6, VLDL=7, TC/HDL=8, LDL/HDL=9 label_to_row = {'TC': 3, 'TG': 4, 'HDL': 5, 'LDL': 6, 'VLDL': 7, 'TC/HDL': 8, 'LDL/HDL': 9} for lbl, r_cysc, p_cysc, r_creat, p_creat in results: row_num = label_to_row.get(lbl) if row_num: ws3.cell(row=row_num, column=2, value=round(r_cysc, 4)) ws3.cell(row=row_num, column=3, value=round(p_cysc, 4)) ws3.cell(row=row_num, column=4, value=round(r_creat, 4)) ws3.cell(row=row_num, column=5, value=round(p_creat, 4)) # Also add LDL/HDL row if not present ws3.cell(row=9, column=1, value='LDL/HDL') import os os.makedirs('/home/daytona/workspace/smita-gfr/', exist_ok=True) out_path = '/home/daytona/workspace/smita-gfr/ARTICLE_SMITA_GFR_Correlations.xlsx' wb.save(out_path) print(f"\nSaved to {out_path}") EOF

The correlations are computed. The save error is due to the formula strings in the original file - I'll use data_only=False and copy to a fresh workbook.
Running Command

python3 << 'EOF' import openpyxl from openpyxl.styles import Font, PatternFill, Alignment, Border, Side, numbers from openpyxl.utils import get_column_letter from scipy import stats import numpy as np import os # Re-read data wb_src = openpyxl.load_workbook('/home/daytona/workspace/attachments/44a34df6-ea90-4821-87a9-f59d396c13db/ARTICLE SMITA-updated GFR.xlsx') ws = wb_src['Male'] data = {k: [] for k in ['TC','TG','HDL','LDL','VLDL','TC_HDL','LDL_HDL','CYS_C','CREAT','eGFR_Creat','eGFR_CysC']} for row in ws.iter_rows(min_row=4, max_row=ws.max_row, values_only=True): if row[0] is None: continue age=row[3]; creat=row[5]; tc=row[6]; tg=row[7]; hdl=row[8] ldl=row[9]; vldl=row[10]; tc_hdl=row[11]; ldl_hdl=row[12]; cys_c=row[13]; sex=row[2] if sex=='Male': egfr_creat = 175*(creat**-1.154)*(age**-0.203) if (age and creat) else None egfr_cysc = 127.7*(cys_c**-1.17)*(age**-0.13) if (age and cys_c) else None else: egfr_creat = 175*(creat**-1.154)*(age**-0.203)*0.742 if (age and creat) else None egfr_cysc = 127.7*(cys_c**-1.17)*(age**-0.13)*0.91 if (age and cys_c) else None if all(v is not None for v in [tc,tg,hdl,ldl,vldl,tc_hdl,ldl_hdl,cys_c,creat,egfr_creat,egfr_cysc]): data['TC'].append(tc); data['TG'].append(tg); data['HDL'].append(hdl) data['LDL'].append(ldl); data['VLDL'].append(vldl) data['TC_HDL'].append(tc_hdl); data['LDL_HDL'].append(ldl_hdl) data['CYS_C'].append(cys_c); data['CREAT'].append(creat) data['eGFR_Creat'].append(egfr_creat); data['eGFR_CysC'].append(egfr_cysc) params = ['TC','TG','HDL','LDL','VLDL','TC_HDL','LDL_HDL'] labels = ['TC','TG','HDL','LDL','VLDL','TC/HDL','LDL/HDL'] results = [] for p,lbl in zip(params,labels): x = np.array(data[p]) r1,p1 = stats.pearsonr(x, np.array(data['eGFR_CysC'])) r2,p2 = stats.pearsonr(x, np.array(data['eGFR_Creat'])) sig1 = 'Significant' if p1<0.05 else 'Not Significant' sig2 = 'Significant' if p2<0.05 else 'Not Significant' results.append((lbl, round(r1,4), round(p1,4), sig1, round(r2,4), round(p2,4), sig2)) # Build fresh workbook wb = openpyxl.Workbook() ws_out = wb.active ws_out.title = 'Correlation Results' # Styles hdr_font = Font(name='Arial', bold=True, color='FFFFFF', size=11) hdr_fill = PatternFill('solid', fgColor='1F4E79') sub_fill = PatternFill('solid', fgColor='2E75B6') sub_font = Font(name='Arial', bold=True, color='FFFFFF', size=10) alt_fill = PatternFill('solid', fgColor='D9E1F2') norm_fill = PatternFill('solid', fgColor='FFFFFF') center = Alignment(horizontal='center', vertical='center', wrap_text=True) thin = Side(border_style='thin', color='B0B0B0') border = Border(left=thin, right=thin, top=thin, bottom=thin) # Title ws_out.merge_cells('A1:G1') ws_out['A1'] = 'Correlation of Lipid Parameters with eGFR (Cystatin C & Creatinine Based)' ws_out['A1'].font = Font(name='Arial', bold=True, size=14, color='1F4E79') ws_out['A1'].alignment = center ws_out.row_dimensions[1].height = 30 ws_out.merge_cells('A2:G2') ws_out['A2'] = f'n = {len(data["TC"])} patients | Pearson Correlation (r) and p-value' ws_out['A2'].font = Font(name='Arial', italic=True, size=10, color='404040') ws_out['A2'].alignment = center ws_out.row_dimensions[2].height = 18 # Group headers row 3 ws_out.merge_cells('B3:D3') ws_out.merge_cells('E3:G3') for cell, txt in [('A3','Parameter'), ('B3','eGFR - Cystatin C Based'), ('E3','eGFR - Creatinine Based')]: ws_out[cell] = txt ws_out[cell].font = hdr_font ws_out[cell].fill = hdr_fill ws_out[cell].alignment = center ws_out[cell].border = border ws_out.row_dimensions[3].height = 22 # Sub-headers row 4 for col, txt in [(1,'Parameter'),(2,'r'),(3,'p-value'),(4,'Significance'),(5,'r'),(6,'p-value'),(7,'Significance')]: c = ws_out.cell(row=4, column=col, value=txt) c.font = sub_font; c.fill = sub_fill; c.alignment = center; c.border = border ws_out.row_dimensions[4].height = 20 # Data rows for i, (lbl, r1, p1, sig1, r2, p2, sig2) in enumerate(results): row_num = i + 5 fill = alt_fill if i % 2 == 0 else norm_fill vals = [lbl, r1, p1, sig1, r2, p2, sig2] for col, val in enumerate(vals, 1): c = ws_out.cell(row=row_num, column=col, value=val) c.font = Font(name='Arial', size=10, bold=(col==1), color=('C00000' if 'Not Sig' in str(val) else ('375623' if 'Significant' in str(val) and 'Not' not in str(val) else '000000'))) c.fill = fill; c.alignment = center; c.border = border ws_out.row_dimensions[row_num].height = 18 # Column widths for col, w in [(1,14),(2,8),(3,10),(4,16),(5,8),(6,10),(7,16)]: ws_out.column_dimensions[get_column_letter(col)].width = w # Note row note_row = len(results) + 6 ws_out.merge_cells(f'A{note_row}:G{note_row}') ws_out[f'A{note_row}'] = 'Note: Significance threshold p < 0.05. eGFR Creatinine = MDRD formula; eGFR Cystatin C = Hoek formula.' ws_out[f'A{note_row}'].font = Font(name='Arial', italic=True, size=9, color='595959') ws_out[f'A{note_row}'].alignment = Alignment(horizontal='left') os.makedirs('/home/daytona/workspace/smita-gfr/', exist_ok=True) out_path = '/home/daytona/workspace/smita-gfr/ARTICLE_SMITA_GFR_Correlations.xlsx' wb.save(out_path) print(f"Saved: {out_path}") print("\nResults Summary:") print(f"{'Parameter':<12} {'r(CysC)':>9} {'p(CysC)':>9} {'Sig?':<18} {'r(Creat)':>10} {'p(Creat)':>10} {'Sig?'}") for row in results: print(f"{row[0]:<12} {row[1]:>9.4f} {row[2]:>9.4f} {row[3]:<18} {row[4]:>10.4f} {row[5]:>10.4f} {row[6]}") EOF

Running Command

ls -la /home/daytona/workspace/smita-gfr/ 2>/dev/null || echo "dir not found" df -h /home/daytona/workspace/

Running Command

mkdir -p /home/daytona/workspace/smita-gfr && ls -la /home/daytona/workspace/

Running Command

python3 << 'EOF' # Test writing a simple xlsx first import openpyxl wb = openpyxl.Workbook() ws = wb.active ws['A1'] = 'Test' wb.save('/home/daytona/workspace/smita-gfr/test.xlsx') print("test write OK") import os os.remove('/home/daytona/workspace/smita-gfr/test.xlsx') print("removed test file") EOF

The S3-backed workspace filesystem doesn't support seek operations (needed by zipfile). I'll write to /tmp first, then copy to workspace.
Running Command

python3 << 'EOF' import openpyxl from openpyxl.styles import Font, PatternFill, Alignment, Border, Side from openpyxl.utils import get_column_letter from scipy import stats import numpy as np import shutil # Re-read data wb_src = openpyxl.load_workbook('/home/daytona/workspace/attachments/44a34df6-ea90-4821-87a9-f59d396c13db/ARTICLE SMITA-updated GFR.xlsx') ws = wb_src['Male'] data = {k: [] for k in ['TC','TG','HDL','LDL','VLDL','TC_HDL','LDL_HDL','CYS_C','CREAT','eGFR_Creat','eGFR_CysC']} for row in ws.iter_rows(min_row=4, max_row=ws.max_row, values_only=True): if row[0] is None: continue age=row[3]; creat=row[5]; tc=row[6]; tg=row[7]; hdl=row[8] ldl=row[9]; vldl=row[10]; tc_hdl=row[11]; ldl_hdl=row[12]; cys_c=row[13]; sex=row[2] if sex=='Male': egfr_creat = 175*(creat**-1.154)*(age**-0.203) if (age and creat) else None egfr_cysc = 127.7*(cys_c**-1.17)*(age**-0.13) if (age and cys_c) else None else: egfr_creat = 175*(creat**-1.154)*(age**-0.203)*0.742 if (age and creat) else None egfr_cysc = 127.7*(cys_c**-1.17)*(age**-0.13)*0.91 if (age and cys_c) else None if all(v is not None for v in [tc,tg,hdl,ldl,vldl,tc_hdl,ldl_hdl,cys_c,creat,egfr_creat,egfr_cysc]): data['TC'].append(tc); data['TG'].append(tg); data['HDL'].append(hdl) data['LDL'].append(ldl); data['VLDL'].append(vldl) data['TC_HDL'].append(tc_hdl); data['LDL_HDL'].append(ldl_hdl) data['CYS_C'].append(cys_c); data['CREAT'].append(creat) data['eGFR_Creat'].append(egfr_creat); data['eGFR_CysC'].append(egfr_cysc) params = ['TC','TG','HDL','LDL','VLDL','TC_HDL','LDL_HDL'] labels = ['TC','TG','HDL','LDL','VLDL','TC/HDL','LDL/HDL'] results = [] for p,lbl in zip(params,labels): x = np.array(data[p]) r1,p1 = stats.pearsonr(x, np.array(data['eGFR_CysC'])) r2,p2 = stats.pearsonr(x, np.array(data['eGFR_Creat'])) sig1 = 'Significant' if p1<0.05 else 'Not Significant' sig2 = 'Significant' if p2<0.05 else 'Not Significant' results.append((lbl, round(r1,4), round(p1,4), sig1, round(r2,4), round(p2,4), sig2)) # Build workbook wb = openpyxl.Workbook() ws_out = wb.active ws_out.title = 'Correlation Results' hdr_font = Font(name='Arial', bold=True, color='FFFFFF', size=11) hdr_fill = PatternFill('solid', fgColor='1F4E79') sub_fill = PatternFill('solid', fgColor='2E75B6') sub_font = Font(name='Arial', bold=True, color='FFFFFF', size=10) alt_fill = PatternFill('solid', fgColor='D9E1F2') norm_fill = PatternFill('solid', fgColor='FFFFFF') center = Alignment(horizontal='center', vertical='center', wrap_text=True) thin = Side(border_style='thin', color='B0B0B0') bdr = Border(left=thin, right=thin, top=thin, bottom=thin) ws_out.merge_cells('A1:G1') ws_out['A1'] = 'Correlation of Lipid Parameters with eGFR (Cystatin C & Creatinine Based)' ws_out['A1'].font = Font(name='Arial', bold=True, size=14, color='1F4E79') ws_out['A1'].alignment = center ws_out.row_dimensions[1].height = 32 ws_out.merge_cells('A2:G2') ws_out['A2'] = f'n = {len(data["TC"])} patients | Pearson Correlation (r) and p-value | Significance: p < 0.05' ws_out['A2'].font = Font(name='Arial', italic=True, size=10, color='404040') ws_out['A2'].alignment = center ws_out.row_dimensions[2].height = 18 ws_out.merge_cells('B3:D3') ws_out.merge_cells('E3:G3') for cell, txt in [('A3','Parameter'), ('B3','eGFR - Cystatin C Based'), ('E3','eGFR - Creatinine Based')]: ws_out[cell].value = txt ws_out[cell].font = hdr_font ws_out[cell].fill = hdr_fill ws_out[cell].alignment = center ws_out[cell].border = bdr ws_out.row_dimensions[3].height = 22 for col, txt in [(1,'Parameter'),(2,'r'),(3,'p-value'),(4,'Significance'),(5,'r'),(6,'p-value'),(7,'Significance')]: c = ws_out.cell(row=4, column=col, value=txt) c.font = sub_font; c.fill = sub_fill; c.alignment = center; c.border = bdr ws_out.row_dimensions[4].height = 20 for i, (lbl, r1, p1, sig1, r2, p2, sig2) in enumerate(results): row_num = i + 5 fill = alt_fill if i % 2 == 0 else norm_fill for col, val in enumerate([lbl, r1, p1, sig1, r2, p2, sig2], 1): c = ws_out.cell(row=row_num, column=col, value=val) color = '000000' if 'Not Significant' in str(val): color='C00000' elif str(val) == 'Significant': color='375623' c.font = Font(name='Arial', size=10, bold=(col==1), color=color) c.fill = fill; c.alignment = center; c.border = bdr ws_out.row_dimensions[row_num].height = 18 for col, w in [(1,14),(2,8),(3,10),(4,18),(5,8),(6,10),(7,18)]: ws_out.column_dimensions[get_column_letter(col)].width = w note_row = len(results) + 6 ws_out.merge_cells(f'A{note_row}:G{note_row}') ws_out[f'A{note_row}'] = 'Note: eGFR Creatinine = MDRD formula [175 x Creat^-1.154 x Age^-0.203 (x0.742 if female)]; eGFR Cystatin C = Hoek formula [127.7 x CysC^-1.17 x Age^-0.13 (x0.91 if female)].' ws_out[f'A{note_row}'].font = Font(name='Arial', italic=True, size=9, color='595959') ws_out[f'A{note_row}'].alignment = Alignment(horizontal='left') # Save to /tmp first, then copy to workspace tmp_path = '/tmp/ARTICLE_SMITA_GFR_Correlations.xlsx' out_path = '/home/daytona/workspace/smita-gfr/ARTICLE_SMITA_GFR_Correlations.xlsx' wb.save(tmp_path) shutil.copy2(tmp_path, out_path) print(f"Saved: {out_path}") print("\nResults:") print(f"{'Parameter':<12} {'r(CysC)':>9} {'p(CysC)':>9} {'':4} {'r(Creat)':>10} {'p(Creat)':>10}") for row in results: print(f"{row[0]:<12} {row[1]:>9.4f} {row[2]:>9.4f} {'*' if row[2]<0.05 else ' ':4} {row[4]:>10.4f} {row[5]:>10.4f} {'*' if row[5]<0.05 else ''}") EOF

Running Command

# The directory disappears between commands on S3 - need to create and copy in one shot mkdir -p /home/daytona/workspace/smita-gfr && ls /home/daytona/workspace/smita-gfr && python3 -c " import shutil, os os.makedirs('/home/daytona/workspace/smita-gfr', exist_ok=True) shutil.copy2('/tmp/ARTICLE_SMITA_GFR_Correlations.xlsx', '/home/daytona/workspace/smita-gfr/ARTICLE_SMITA_GFR_Correlations.xlsx') print('Copied') " && ls -la /home/daytona/workspace/smita-gfr/

Running Command

python3 -c " import shutil, os os.makedirs('/home/daytona/workspace/smita-gfr', exist_ok=True) shutil.copy('/tmp/ARTICLE_SMITA_GFR_Correlations.xlsx', '/home/daytona/workspace/smita-gfr/ARTICLE_SMITA_GFR_Correlations.xlsx') print('Copied OK') " && ls -la /home/daytona/workspace/smita-gfr/

Running Command

python3 -c " import shutil, os os.makedirs('/home/daytona/workspace/smita-gfr', exist_ok=True) # Use copyfileobj directly with open('/tmp/ARTICLE_SMITA_GFR_Correlations.xlsx','rb') as src, open('/home/daytona/workspace/smita-gfr/ARTICLE_SMITA_GFR_Correlations.xlsx','wb') as dst: dst.write(src.read()) print('Done') " && ls -lh /home/daytona/workspace/smita-gfr/

The file is saved. Now let me print the full results for the response.
Running Command

python3 << 'EOF' from scipy import stats import numpy as np import openpyxl wb_src = openpyxl.load_workbook('/home/daytona/workspace/attachments/44a34df6-ea90-4821-87a9-f59d396c13db/ARTICLE SMITA-updated GFR.xlsx') ws = wb_src['Male'] data = {k: [] for k in ['TC','TG','HDL','LDL','VLDL','TC_HDL','LDL_HDL','CYS_C','CREAT','eGFR_Creat','eGFR_CysC']} for row in ws.iter_rows(min_row=4, max_row=ws.max_row, values_only=True): if row[0] is None: continue age=row[3]; creat=row[5]; tc=row[6]; tg=row[7]; hdl=row[8] ldl=row[9]; vldl=row[10]; tc_hdl=row[11]; ldl_hdl=row[12]; cys_c=row[13]; sex=row[2] if sex=='Male': egfr_creat = 175*(creat**-1.154)*(age**-0.203) if (age and creat) else None egfr_cysc = 127.7*(cys_c**-1.17)*(age**-0.13) if (age and cys_c) else None else: egfr_creat = 175*(creat**-1.154)*(age**-0.203)*0.742 if (age and creat) else None egfr_cysc = 127.7*(cys_c**-1.17)*(age**-0.13)*0.91 if (age and cys_c) else None if all(v is not None for v in [tc,tg,hdl,ldl,vldl,tc_hdl,ldl_hdl,cys_c,creat,egfr_creat,egfr_cysc]): data['TC'].append(tc); data['TG'].append(tg); data['HDL'].append(hdl) data['LDL'].append(ldl); data['VLDL'].append(vldl) data['TC_HDL'].append(tc_hdl); data['LDL_HDL'].append(ldl_hdl) data['CYS_C'].append(cys_c); data['CREAT'].append(creat) data['eGFR_Creat'].append(egfr_creat); data['eGFR_CysC'].append(egfr_cysc) print(f"N = {len(data['TC'])}") print(f"eGFR(CysC) range: {min(data['eGFR_CysC']):.2f} - {max(data['eGFR_CysC']):.2f}") print(f"eGFR(Creat) range: {min(data['eGFR_Creat']):.2f} - {max(data['eGFR_Creat']):.2f}") params = ['TC','TG','HDL','LDL','VLDL','TC_HDL','LDL_HDL'] labels = ['TC','TG','HDL','LDL','VLDL','TC/HDL','LDL/HDL'] print() print(f"{'Param':<10} | {'r (CysC-eGFR)':>14} {'p (CysC)':>10} {'Sig':>16} | {'r (Creat-eGFR)':>16} {'p (Creat)':>10} {'Sig':>16}") print("-"*100) for p,lbl in zip(params,labels): x = np.array(data[p]) r1,p1 = stats.pearsonr(x, np.array(data['eGFR_CysC'])) r2,p2 = stats.pearsonr(x, np.array(data['eGFR_Creat'])) s1 = 'p<0.05 *' if p1<0.05 else 'NS' s2 = 'p<0.05 *' if p2<0.05 else 'NS' print(f"{lbl:<10} | {r1:>14.4f} {p1:>10.4f} {s1:>16} | {r2:>16.4f} {p2:>10.4f} {s2:>16}") EOF

Here are the complete Pearson correlation results from your dataset (n = 50 patients).

Correlation of Lipid Parameters with eGFR

Formulas used:
  • eGFR (Creatinine) = MDRD: 175 × Creat^-1.154 × Age^-0.203 (×0.742 for females)
  • eGFR (Cystatin C) = Hoek: 127.7 × CysC^-1.17 × Age^-0.13 (×0.91 for females)

Table: Pearson Correlation (r) and p-values

Parameterr (CysC eGFR)p-valueSignificancer (Creatinine eGFR)p-valueSignificance
TC-0.16030.2661NS+0.00390.9785NS
TG+0.10980.4480NS+0.07270.6161NS
HDL-0.04180.7733NS+0.02210.8788NS
LDL-0.19130.1832NS-0.02070.8868NS
VLDL+0.10980.4480NS+0.07270.6161NS
TC/HDL-0.13990.3325NS-0.00970.9465NS
LDL/HDL-0.18550.1971NS-0.03270.8217NS
NS = Not Significant (p >= 0.05)

Interpretation

None of the lipid parameters (TC, TG, HDL, LDL, VLDL, TC/HDL ratio, LDL/HDL ratio) showed a statistically significant correlation with either eGFR-Cystatin C or eGFR-Creatinine in this dataset (all p-values well above 0.05).
Key observations:
  • LDL showed the strongest (though non-significant) negative correlation with CysC-eGFR (r = -0.1913, p = 0.183), suggesting higher LDL tends weakly toward lower eGFR by this measure.
  • TC also had a weak negative correlation with CysC-eGFR (r = -0.1603) but none with creatinine-eGFR.
  • TG and VLDL showed identical weak positive correlations (r = +0.1098 for CysC-eGFR; they are mathematically linked since VLDL = TG/5).
  • Correlations with creatinine-based eGFR were all extremely weak (|r| < 0.08), suggesting lipid levels have little relationship with creatinine clearance in this cohort.
  • The discrepancy in direction between CysC-eGFR and creatinine-eGFR correlations for TC (r = -0.16 vs +0.004) reflects the different sensitivities of the two GFR estimation methods.
The overall finding of no significant correlation is consistent with reports in CKD populations where dyslipidemia is common but its relationship with GFR depends heavily on stage, comorbidities, and medication use.

Download the formatted Excel file with all results:

ARTICLE SMITA GFR Correlations

Spreadsheet · XLSX

This is a shared conversation. Sign in to Orris to start your own chat.