{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "nYR9yLMcBWtw" }, "source": [ "# Calibration of the Sr/Ca paleothermometer: a frequentist approach\n", "\n", "## Authors\n", "\n", "[Deborah Khider](https://orcid.org/0000-0001-7501-8430)\n", "\n", "## Preamble\n", "\n", "A common exercise in paleoclimatology is the calibration of the measured proxy (in this case, coral Sr/Ca) to the environmental parameter that controls it (sea surface temperature). This notebook walks through the calibration of Sr/Ca measurements made on various corals in Dry Tortugas compared to instrumental data, using a frequentist approach (Ordinary Least Squares). Some figures are reproduced from the original study by [DeLong et al. 2011](https://www.sciencedirect.com/science/article/pii/S0031018211002501?casa_token=u1x_ZYnm_mIAAAAA:rU7n-8jHh2g5UPgGHs5h1iptBXVa6rfvKFxpOwgMjHgB6g4jUZ9oRppzJz7O5UQHDlc1U3xhYSg).\n", "\n", "Let's import the necessary packages. For the regression work, we will use the [statsmodel](https://www.statsmodels.org/stable/index.html) package. " ] }, { "cell_type": "code", "execution_count": 63, "metadata": { "id": "xnPkxMo7nJMw" }, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "import seaborn as sns\n", "import matplotlib.pyplot as plt\n", "import statsmodels.api as sm\n", "\n", "#To make tables\n", "from great_tables import GT, md, html" ] }, { "cell_type": "markdown", "metadata": { "id": "scB-zxiPAfb-" }, "source": [ "## Loading the data\n", "\n", "For this calibration exercise, we will be using the Sr/Ca data from [DeLong et al. (2011)](https://www.sciencedirect.com/science/article/pii/S0031018211002501?casa_token=u1x_ZYnm_mIAAAAA:rU7n-8jHh2g5UPgGHs5h1iptBXVa6rfvKFxpOwgMjHgB6g4jUZ9oRppzJz7O5UQHDlc1U3xhYSg). The [previous chapter](DataExploration.ipynb) was dedicated to data exploration, so we will directly delve into the calibration work. " ] }, { "cell_type": "markdown", "metadata": { "id": "-DIlJiqwB97o" }, "source": [ "Lets's import it into our workspace using [pandas](https://pandas.pydata.org)." ] }, { "cell_type": "code", "execution_count": 64, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 296 }, "id": "TyDdLWg3qfJg", "outputId": "58fa9296-d5ee-4fed-d35b-00172ca5de81" }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
YearMean Sr/Ca (mmol/mol)Number of samplesSt. error of meanMean Sr/Ca (mmol/mol).1Number of samples.1St. error of mean.1Mean Sr/Ca (mmol/mol).2Number of samples.2St. error of mean.2DRTO SST (ºC)St. error of mean.3Sand Key SST (ºC)St. error of mean.4
02008.6250008.73709510.012000NaNNaNNaN9.02538530.00302730.1930110.010330NaNNaN
12008.5416678.77022320.003228NaNNaNNaN9.05144430.01006029.5511970.010570NaNNaN
22008.4583338.84102420.003956NaNNaNNaN9.11184330.00055428.5394990.022829NaNNaN
32008.3750008.94093320.0016148.9723821.00.019.19020430.02145926.6424730.026493NaNNaN
42008.2916679.02271520.0031259.0620881.00.019.23262630.01027824.9050000.019899NaNNaN
\n", "
" ], "text/plain": [ " Year Mean Sr/Ca (mmol/mol) Number of samples St. error of mean \\\n", "0 2008.625000 8.737095 1 0.012000 \n", "1 2008.541667 8.770223 2 0.003228 \n", "2 2008.458333 8.841024 2 0.003956 \n", "3 2008.375000 8.940933 2 0.001614 \n", "4 2008.291667 9.022715 2 0.003125 \n", "\n", " Mean Sr/Ca (mmol/mol).1 Number of samples.1 St. error of mean.1 \\\n", "0 NaN NaN NaN \n", "1 NaN NaN NaN \n", "2 NaN NaN NaN \n", "3 8.972382 1.0 0.01 \n", "4 9.062088 1.0 0.01 \n", "\n", " Mean Sr/Ca (mmol/mol).2 Number of samples.2 St. error of mean.2 \\\n", "0 9.025385 3 0.003027 \n", "1 9.051444 3 0.010060 \n", "2 9.111843 3 0.000554 \n", "3 9.190204 3 0.021459 \n", "4 9.232626 3 0.010278 \n", "\n", " DRTO SST (ºC) St. error of mean.3 Sand Key SST (ºC) St. error of mean.4 \n", "0 30.193011 0.010330 NaN NaN \n", "1 29.551197 0.010570 NaN NaN \n", "2 28.539499 0.022829 NaN NaN \n", "3 26.642473 0.026493 NaN NaN \n", "4 24.905000 0.019899 NaN NaN " ] }, "execution_count": 64, "metadata": {}, "output_type": "execute_result" } ], "source": [ "url = 'https://www.ncei.noaa.gov/pub/data/paleo/coral/atlantic/tortugas2011.xls'\n", "df = pd.read_excel(url, sheet_name=1,header=[2])\n", "df.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the [original study](https://www.sciencedirect.com/science/article/pii/S0031018211002501?casa_token=u1x_ZYnm_mIAAAAA:rU7n-8jHh2g5UPgGHs5h1iptBXVa6rfvKFxpOwgMjHgB6g4jUZ9oRppzJz7O5UQHDlc1U3xhYSg), Delong et al. chose a weighted linear regression over an ordinary least square regression to take into account the uncertainty in the data. Here, let's try both and compare the results." ] }, { "cell_type": "markdown", "metadata": { "id": "0FHZ0Dz8HXfN" }, "source": [ "## Ordinary least square regression\n", "\n", "### *Siderastrea sidera*\n", "\n", "Let's start with the calibration for *Siderastrea sidera*, using one core at a time as per the original study. \n", "\n", "#### Core A1\n", "\n", "Let's start with the calibration to the DRTO SST data. But first, let's remove NaNs:" ] }, { "cell_type": "code", "execution_count": 65, "metadata": {}, "outputs": [], "source": [ "cleaned_df = df.dropna(subset=['Mean Sr/Ca (mmol/mol)','DRTO SST (ºC)'])" ] }, { "cell_type": "code", "execution_count": 66, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 37 }, "id": "sRa08mPJICjT", "outputId": "77cd6ad3-cfd4-4fc6-a49e-e30b0050e2d2" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Intercept: 10.004\n", "Slope: -0.040\n", "Intercept Standard Error: 0.024\n", "Slope Standard Error: 0.001\n", "R_squared: 0.95\n" ] } ], "source": [ "X = cleaned_df.iloc[:,10]\n", "Y = cleaned_df.iloc[:,1]\n", "X = sm.add_constant(X)\n", "\n", "ols = sm.OLS(Y,X)\n", "results = ols.fit()\n", "\n", "#get the parameters\n", "intercept, slope = results.params\n", "\n", "#get the standard error\n", "intercept_se, slope_se = results.bse\n", "\n", "#R_squared\n", "r_squared = results.rsquared\n", "\n", "print(\"Intercept:\", f\"{intercept:.3f}\")\n", "print(\"Slope:\", f\"{slope:.3f}\")\n", "print(\"Intercept Standard Error:\", f\"{intercept_se:.3f}\")\n", "print(\"Slope Standard Error:\", f\"{slope_se:.3f}\")\n", "print(\"R_squared:\", f\"{r_squared :.2f}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's keep these results in a series of list that we will update as we go: " ] }, { "cell_type": "code", "execution_count": 67, "metadata": {}, "outputs": [], "source": [ "coral_id = ['A1 (S.Sidera)']\n", "SST_p = ['DRTO']\n", "m = [slope]\n", "p = [intercept]\n", "m_se = [slope_se]\n", "p_se = [intercept_se]\n", "r2 = [r_squared]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's repeat the calculation with the Sand Key SST data:" ] }, { "cell_type": "code", "execution_count": 68, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Intercept: 10.115\n", "Slope: -0.043\n", "Intercept Standard Error: 0.025\n", "Slope Standard Error: 0.001\n", "R_squared: 0.93\n" ] } ], "source": [ "cleaned_df = df.dropna(subset=['Mean Sr/Ca (mmol/mol)','Sand Key SST (ºC)'])\n", "\n", "X = cleaned_df.iloc[:,12]\n", "Y = cleaned_df.iloc[:,1]\n", "X = sm.add_constant(X)\n", "\n", "ols = sm.OLS(Y,X)\n", "results = ols.fit()\n", "\n", "#get the parameters\n", "intercept, slope = results.params\n", "\n", "#get the standard error\n", "intercept_se, slope_se = results.bse\n", "#R_squared\n", "r_squared = results.rsquared\n", "\n", "print(\"Intercept:\", f\"{intercept:.3f}\")\n", "print(\"Slope:\", f\"{slope:.3f}\")\n", "print(\"Intercept Standard Error:\", f\"{intercept_se:.3f}\")\n", "print(\"Slope Standard Error:\", f\"{slope_se:.3f}\")\n", "print(\"R_squared:\", f\"{r_squared :.2f}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's update our results list:" ] }, { "cell_type": "code", "execution_count": 69, "metadata": {}, "outputs": [], "source": [ "coral_id.append('A1 (S.Sidera)')\n", "SST_p.append('SANF1')\n", "m.append(slope)\n", "p.append(intercept)\n", "m_se.append(slope_se)\n", "p_se.append(intercept_se)\n", "r2.append(r_squared)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Core F1\n", "\n", "Let's proceed with the DRTO SST Data:" ] }, { "cell_type": "code", "execution_count": 70, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Intercept: 10.083\n", "Slope: -0.042\n", "Intercept Standard Error: 0.025\n", "Slope Standard Error: 0.001\n", "R_squared: 0.95\n" ] } ], "source": [ "cleaned_df = df.dropna(subset=['Mean Sr/Ca (mmol/mol).1','DRTO SST (ºC)'])\n", "\n", "X = cleaned_df.iloc[:,10]\n", "Y = cleaned_df.iloc[:,4]\n", "X = sm.add_constant(X)\n", "\n", "ols = sm.OLS(Y,X)\n", "results = ols.fit()\n", "\n", "#get the parameters\n", "intercept, slope = results.params\n", "\n", "#get the standard error\n", "intercept_se, slope_se = results.bse\n", "#R_squared\n", "r_squared = results.rsquared\n", "\n", "print(\"Intercept:\", f\"{intercept:.3f}\")\n", "print(\"Slope:\", f\"{slope:.3f}\")\n", "print(\"Intercept Standard Error:\", f\"{intercept_se:.3f}\")\n", "print(\"Slope Standard Error:\", f\"{slope_se:.3f}\")\n", "print(\"R_squared:\", f\"{r_squared :.2f}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And let's save our results:" ] }, { "cell_type": "code", "execution_count": 71, "metadata": {}, "outputs": [], "source": [ "coral_id.append('F1 (S.Sidera)')\n", "SST_p.append('DRTO')\n", "m.append(slope)\n", "p.append(intercept)\n", "m_se.append(slope_se)\n", "p_se.append(intercept_se)\n", "r2.append(r_squared)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's do the regression agaisnt Sand Key SST data:" ] }, { "cell_type": "code", "execution_count": 72, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Intercept: 10.221\n", "Slope: -0.046\n", "Intercept Standard Error: 0.027\n", "Slope Standard Error: 0.001\n", "R_squared: 0.93\n" ] } ], "source": [ "cleaned_df = df.dropna(subset=['Mean Sr/Ca (mmol/mol).1','Sand Key SST (ºC)'])\n", "\n", "X = cleaned_df.iloc[:,12]\n", "Y = cleaned_df.iloc[:,4]\n", "X = sm.add_constant(X)\n", "\n", "ols = sm.OLS(Y,X)\n", "results = ols.fit()\n", "\n", "#get the parameters\n", "intercept, slope = results.params\n", "\n", "#get the standard error\n", "intercept_se, slope_se = results.bse\n", "\n", "#R_squared\n", "r_squared = results.rsquared\n", "\n", "print(\"Intercept:\", f\"{intercept:.3f}\")\n", "print(\"Slope:\", f\"{slope:.3f}\")\n", "print(\"Intercept Standard Error:\", f\"{intercept_se:.3f}\")\n", "print(\"Slope Standard Error:\", f\"{slope_se:.3f}\")\n", "print(\"R_squared:\", f\"{r_squared :.2f}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And let's save the results:" ] }, { "cell_type": "code", "execution_count": 73, "metadata": {}, "outputs": [], "source": [ "coral_id.append('F1 (S.Sidera)')\n", "SST_p.append('SANF1')\n", "m.append(slope)\n", "p.append(intercept)\n", "m_se.append(slope_se)\n", "p_se.append(intercept_se)\n", "r2.append(r_squared)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### *Montastraea faveolata*" ] }, { "cell_type": "code", "execution_count": 74, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Intercept: 9.955\n", "Slope: -0.029\n", "Intercept Standard Error: 0.028\n", "Slope Standard Error: 0.001\n", "R_squared: 0.87\n" ] } ], "source": [ "cleaned_df = df.dropna(subset=['Mean Sr/Ca (mmol/mol).2','DRTO SST (ºC)'])\n", "\n", "X = cleaned_df.iloc[:,10]\n", "Y = cleaned_df.iloc[:,7]\n", "X = sm.add_constant(X)\n", "\n", "ols = sm.OLS(Y,X)\n", "results = ols.fit()\n", "\n", "#get the parameters\n", "intercept, slope = results.params\n", "\n", "#get the standard error\n", "intercept_se, slope_se = results.bse\n", "\n", "#R_squared\n", "r_squared = results.rsquared\n", "\n", "print(\"Intercept:\", f\"{intercept:.3f}\")\n", "print(\"Slope:\", f\"{slope:.3f}\")\n", "print(\"Intercept Standard Error:\", f\"{intercept_se:.3f}\")\n", "print(\"Slope Standard Error:\", f\"{slope_se:.3f}\")\n", "print(\"R_squared:\", f\"{r_squared :.2f}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And let's save the results:" ] }, { "cell_type": "code", "execution_count": 75, "metadata": {}, "outputs": [], "source": [ "coral_id.append('B3 (M. faveolata)')\n", "SST_p.append('DRTO')\n", "m.append(slope)\n", "p.append(intercept)\n", "m_se.append(slope_se)\n", "p_se.append(intercept_se)\n", "r2.append(r_squared)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's do the same with the Sand Key SST:" ] }, { "cell_type": "code", "execution_count": 76, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Intercept: 10.031\n", "Slope: -0.031\n", "Intercept Standard Error: 0.027\n", "Slope Standard Error: 0.001\n", "R_squared: 0.85\n" ] } ], "source": [ "cleaned_df = df.dropna(subset=['Mean Sr/Ca (mmol/mol).2','Sand Key SST (ºC)'])\n", "\n", "X = cleaned_df.iloc[:,12]\n", "Y = cleaned_df.iloc[:,7]\n", "X = sm.add_constant(X)\n", "\n", "ols = sm.OLS(Y,X)\n", "results = ols.fit()\n", "\n", "#get the parameters\n", "intercept, slope = results.params\n", "\n", "#get the standard error\n", "intercept_se, slope_se = results.bse\n", "\n", "#R_squared\n", "r_squared = results.rsquared\n", "\n", "print(\"Intercept:\", f\"{intercept:.3f}\")\n", "print(\"Slope:\", f\"{slope:.3f}\")\n", "print(\"Intercept Standard Error:\", f\"{intercept_se:.3f}\")\n", "print(\"Slope Standard Error:\", f\"{slope_se:.3f}\")\n", "print(\"R_squared:\", f\"{r_squared :.2f}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And let's save the results:" ] }, { "cell_type": "code", "execution_count": 77, "metadata": {}, "outputs": [], "source": [ "coral_id.append('B3 (M. faveolata)')\n", "SST_p.append('SANF1')\n", "m.append(slope)\n", "p.append(intercept)\n", "m_se.append(slope_se)\n", "p_se.append(intercept_se)\n", "r2.append(r_squared)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Summary\n", "\n", "Let's summarize our results into a table. Although Pandas DataFrames can represent data in a tabular format and are extremely useful for computation, they are not always easy to read. Here, we will be using [Great Tables](https://posit-dev.github.io/great-tables/articles/intro.html) to present the results in a publication-ready table." ] }, { "cell_type": "code", "execution_count": 78, "metadata": {}, "outputs": [], "source": [ "ols_df = pd.DataFrame({'Coral ID':coral_id,\n", " 'SST':SST_p,\n", " 'Slope':m,\n", " 'Slope SE$^a$':m_se,\n", " 'Intercept':p,\n", " 'Intercept SE$^a$':p_se,\n", " 'R$^2$':r2})" ] }, { "cell_type": "code", "execution_count": 79, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", "
Calibration of coral Sr/Ca to SST, Ordinary Least Square
Coral IDSSTSlopeSlope SE$^a$InterceptIntercept SE$^a$R$^2$
A1 (S.Sidera)DRTO−0.0400.00110.0040.0240.95
A1 (S.Sidera)SANF1−0.0430.00110.1150.0250.93
F1 (S.Sidera)DRTO−0.0420.00110.0830.0250.95
F1 (S.Sidera)SANF1−0.0460.00110.2210.0270.93
B3 (M. faveolata)DRTO−0.0290.0019.9550.0280.87
B3 (M. faveolata)SANF1−0.0310.00110.0310.0270.85
$^a$ SE: standard error
\n", "\n", "
\n", " " ], "text/plain": [ "GT(_tbl_data= Coral ID SST Slope Slope SE$^a$ Intercept \\\n", "0 A1 (S.Sidera) DRTO -0.039834 0.000899 10.004214 \n", "1 A1 (S.Sidera) SANF1 -0.043351 0.000953 10.115004 \n", "2 F1 (S.Sidera) DRTO -0.041691 0.000943 10.083337 \n", "3 F1 (S.Sidera) SANF1 -0.046175 0.001011 10.221017 \n", "4 B3 (M. faveolata) DRTO -0.028845 0.001062 9.954502 \n", "5 B3 (M. faveolata) SANF1 -0.031252 0.001026 10.031300 \n", "\n", " Intercept SE$^a$ R$^2$ \n", "0 0.023605 0.945576 \n", "1 0.025447 0.925744 \n", "2 0.024668 0.946745 \n", "3 0.026993 0.926313 \n", "4 0.027877 0.867231 \n", "5 0.027401 0.848212 , _body=, _boxhead=Boxhead([ColInfo(var='Coral ID', type=, column_label='Coral ID', column_align='left', column_width=None), ColInfo(var='SST', type=, column_label='SST', column_align='left', column_width=None), ColInfo(var='Slope', type=, column_label='Slope', column_align='right', column_width=None), ColInfo(var='Slope SE$^a$', type=, column_label='Slope SE$^a$', column_align='right', column_width=None), ColInfo(var='Intercept', type=, column_label='Intercept', column_align='right', column_width=None), ColInfo(var='Intercept SE$^a$', type=, column_label='Intercept SE$^a$', column_align='right', column_width=None), ColInfo(var='R$^2$', type=, column_label='R$^2$', column_align='right', column_width=None)]), _stub=, _spanners=Spanners([]), _heading=Heading(title='Calibration of coral Sr/Ca to SST, Ordinary Least Square', subtitle=None, preheader=None), _stubhead=None, _source_notes=['$^a$ SE: standard error'], _footnotes=[], _styles=[], _locale=, _formats=[, ], _substitutions=[], _options=Options(table_id=OptionsInfo(scss=False, category='table', type='value', value=None), table_caption=OptionsInfo(scss=False, category='table', type='value', value=None), table_width=OptionsInfo(scss=True, category='table', type='px', value='auto'), table_layout=OptionsInfo(scss=True, category='table', type='value', value='fixed'), table_margin_left=OptionsInfo(scss=True, category='table', type='px', value='auto'), table_margin_right=OptionsInfo(scss=True, category='table', type='px', value='auto'), table_background_color=OptionsInfo(scss=True, category='table', type='value', value='#FFFFFF'), table_font_names=OptionsInfo(scss=False, category='table', type='values', value=['-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', 'Fira Sans', 'Droid Sans', 'Arial', 'sans-serif']), table_font_size=OptionsInfo(scss=True, category='table', type='px', value='16px'), table_font_weight=OptionsInfo(scss=True, category='table', type='value', value='normal'), table_font_style=OptionsInfo(scss=True, category='table', type='value', value='normal'), table_font_color=OptionsInfo(scss=True, category='table', type='value', value='#333333'), table_font_color_light=OptionsInfo(scss=True, category='table', type='value', value='#FFFFFF'), table_border_top_include=OptionsInfo(scss=False, category='table', type='boolean', value=True), table_border_top_style=OptionsInfo(scss=True, category='table', type='value', value='solid'), table_border_top_width=OptionsInfo(scss=True, category='table', type='px', value='2px'), table_border_top_color=OptionsInfo(scss=True, category='table', type='value', value='#A8A8A8'), table_border_right_style=OptionsInfo(scss=True, category='table', type='value', value='none'), table_border_right_width=OptionsInfo(scss=True, category='table', type='px', value='2px'), table_border_right_color=OptionsInfo(scss=True, category='table', type='value', value='#D3D3D3'), table_border_bottom_include=OptionsInfo(scss=False, category='table', type='boolean', value=True), table_border_bottom_style=OptionsInfo(scss=True, category='table', type='value', value='solid'), table_border_bottom_width=OptionsInfo(scss=True, category='table', type='px', value='2px'), table_border_bottom_color=OptionsInfo(scss=True, category='table', type='value', value='#A8A8A8'), table_border_left_style=OptionsInfo(scss=True, category='table', type='value', value='none'), table_border_left_width=OptionsInfo(scss=True, category='table', type='px', value='2px'), table_border_left_color=OptionsInfo(scss=True, category='table', type='value', value='#D3D3D3'), heading_background_color=OptionsInfo(scss=True, category='heading', type='value', value=None), heading_align=OptionsInfo(scss=True, category='heading', type='value', value='center'), heading_title_font_size=OptionsInfo(scss=True, category='heading', type='px', value='125%'), heading_title_font_weight=OptionsInfo(scss=True, category='heading', type='value', value='initial'), heading_subtitle_font_size=OptionsInfo(scss=True, category='heading', type='px', value='85%'), heading_subtitle_font_weight=OptionsInfo(scss=True, category='heading', type='value', value='initial'), heading_padding=OptionsInfo(scss=True, category='heading', type='px', value='4px'), heading_padding_horizontal=OptionsInfo(scss=True, category='heading', type='px', value='5px'), heading_border_bottom_style=OptionsInfo(scss=True, category='heading', type='value', value='solid'), heading_border_bottom_width=OptionsInfo(scss=True, category='heading', type='px', value='2px'), heading_border_bottom_color=OptionsInfo(scss=True, category='heading', type='value', value='#D3D3D3'), heading_border_lr_style=OptionsInfo(scss=True, category='heading', type='value', value='none'), heading_border_lr_width=OptionsInfo(scss=True, category='heading', type='px', value='1px'), heading_border_lr_color=OptionsInfo(scss=True, category='heading', type='value', value='#D3D3D3'), column_labels_background_color=OptionsInfo(scss=True, category='column_labels', type='value', value='darkgrey'), column_labels_font_size=OptionsInfo(scss=True, category='column_labels', type='px', value='100%'), column_labels_font_weight=OptionsInfo(scss=True, category='column_labels', type='value', value='normal'), column_labels_text_transform=OptionsInfo(scss=True, category='column_labels', type='value', value='inherit'), column_labels_padding=OptionsInfo(scss=True, category='column_labels', type='px', value='5px'), column_labels_padding_horizontal=OptionsInfo(scss=True, category='column_labels', type='px', value='5px'), column_labels_vlines_style=OptionsInfo(scss=True, category='table_body', type='value', value='none'), column_labels_vlines_width=OptionsInfo(scss=True, category='table_body', type='px', value='1px'), column_labels_vlines_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), column_labels_border_top_style=OptionsInfo(scss=True, category='column_labels', type='value', value='solid'), column_labels_border_top_width=OptionsInfo(scss=True, category='column_labels', type='px', value='2px'), column_labels_border_top_color=OptionsInfo(scss=True, category='column_labels', type='value', value='#D3D3D3'), column_labels_border_bottom_style=OptionsInfo(scss=True, category='column_labels', type='value', value='solid'), column_labels_border_bottom_width=OptionsInfo(scss=True, category='column_labels', type='px', value='2px'), column_labels_border_bottom_color=OptionsInfo(scss=True, category='column_labels', type='value', value='#D3D3D3'), column_labels_border_lr_style=OptionsInfo(scss=True, category='column_labels', type='value', value='none'), column_labels_border_lr_width=OptionsInfo(scss=True, category='column_labels', type='px', value='1px'), column_labels_border_lr_color=OptionsInfo(scss=True, category='column_labels', type='value', value='#D3D3D3'), column_labels_hidden=OptionsInfo(scss=False, category='column_labels', type='boolean', value=False), row_group_background_color=OptionsInfo(scss=True, category='row_group', type='value', value=None), row_group_font_size=OptionsInfo(scss=True, category='row_group', type='px', value='100%'), row_group_font_weight=OptionsInfo(scss=True, category='row_group', type='value', value='initial'), row_group_text_transform=OptionsInfo(scss=True, category='row_group', type='value', value='inherit'), row_group_padding=OptionsInfo(scss=True, category='row_group', type='px', value='8px'), row_group_padding_horizontal=OptionsInfo(scss=True, category='row_group', type='px', value='5px'), row_group_border_top_style=OptionsInfo(scss=True, category='row_group', type='value', value='solid'), row_group_border_top_width=OptionsInfo(scss=True, category='row_group', type='px', value='2px'), row_group_border_top_color=OptionsInfo(scss=True, category='row_group', type='value', value='#D3D3D3'), row_group_border_right_style=OptionsInfo(scss=True, category='row_group', type='value', value='none'), row_group_border_right_width=OptionsInfo(scss=True, category='row_group', type='px', value='1px'), row_group_border_right_color=OptionsInfo(scss=True, category='row_group', type='value', value='#D3D3D3'), row_group_border_bottom_style=OptionsInfo(scss=True, category='row_group', type='value', value='solid'), row_group_border_bottom_width=OptionsInfo(scss=True, category='row_group', type='px', value='2px'), row_group_border_bottom_color=OptionsInfo(scss=True, category='row_group', type='value', value='#D3D3D3'), row_group_border_left_style=OptionsInfo(scss=True, category='row_group', type='value', value='none'), row_group_border_left_width=OptionsInfo(scss=True, category='row_group', type='px', value='1px'), row_group_border_left_color=OptionsInfo(scss=True, category='row_group', type='value', value='#D3D3D3'), row_group_as_column=OptionsInfo(scss=False, category='row_group', type='boolean', value=False), table_body_hlines_style=OptionsInfo(scss=True, category='table_body', type='value', value='solid'), table_body_hlines_width=OptionsInfo(scss=True, category='table_body', type='px', value='1px'), table_body_hlines_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), table_body_vlines_style=OptionsInfo(scss=True, category='table_body', type='value', value='none'), table_body_vlines_width=OptionsInfo(scss=True, category='table_body', type='px', value='1px'), table_body_vlines_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), table_body_border_top_style=OptionsInfo(scss=True, category='table_body', type='value', value='solid'), table_body_border_top_width=OptionsInfo(scss=True, category='table_body', type='px', value='2px'), table_body_border_top_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), table_body_border_bottom_style=OptionsInfo(scss=True, category='table_body', type='value', value='solid'), table_body_border_bottom_width=OptionsInfo(scss=True, category='table_body', type='px', value='2px'), table_body_border_bottom_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), data_row_padding=OptionsInfo(scss=True, category='data_row', type='px', value='8px'), data_row_padding_horizontal=OptionsInfo(scss=True, category='data_row', type='px', value='5px'), stub_background_color=OptionsInfo(scss=True, category='stub', type='value', value=None), stub_font_size=OptionsInfo(scss=True, category='stub', type='px', value='100%'), stub_font_weight=OptionsInfo(scss=True, category='stub', type='value', value='initial'), stub_text_transform=OptionsInfo(scss=True, category='stub', type='value', value='inherit'), stub_border_style=OptionsInfo(scss=True, category='stub', type='value', value='solid'), stub_border_width=OptionsInfo(scss=True, category='stub', type='px', value='2px'), stub_border_color=OptionsInfo(scss=True, category='stub', type='value', value='#D3D3D3'), stub_row_group_background_color=OptionsInfo(scss=True, category='stub', type='value', value=None), stub_row_group_font_size=OptionsInfo(scss=True, category='stub', type='px', value='100%'), stub_row_group_font_weight=OptionsInfo(scss=True, category='stub', type='value', value='initial'), stub_row_group_text_transform=OptionsInfo(scss=True, category='stub', type='value', value='inherit'), stub_row_group_border_style=OptionsInfo(scss=True, category='stub', type='value', value='solid'), stub_row_group_border_width=OptionsInfo(scss=True, category='stub', type='px', value='2px'), stub_row_group_border_color=OptionsInfo(scss=True, category='stub', type='value', value='#D3D3D3'), source_notes_padding=OptionsInfo(scss=True, category='source_notes', type='px', value='4px'), source_notes_padding_horizontal=OptionsInfo(scss=True, category='source_notes', type='px', value='5px'), source_notes_background_color=OptionsInfo(scss=True, category='source_notes', type='value', value='OldLace'), source_notes_font_size=OptionsInfo(scss=True, category='source_notes', type='px', value='90%'), source_notes_border_bottom_style=OptionsInfo(scss=True, category='source_notes', type='value', value='none'), source_notes_border_bottom_width=OptionsInfo(scss=True, category='source_notes', type='px', value='2px'), source_notes_border_bottom_color=OptionsInfo(scss=True, category='source_notes', type='value', value='#D3D3D3'), source_notes_border_lr_style=OptionsInfo(scss=True, category='source_notes', type='value', value='none'), source_notes_border_lr_width=OptionsInfo(scss=True, category='source_notes', type='px', value='2px'), source_notes_border_lr_color=OptionsInfo(scss=True, category='source_notes', type='value', value='#D3D3D3'), source_notes_multiline=OptionsInfo(scss=False, category='source_notes', type='boolean', value=True), source_notes_sep=OptionsInfo(scss=False, category='source_notes', type='value', value=' '), container_width=OptionsInfo(scss=False, category='container', type='px', value='auto'), container_height=OptionsInfo(scss=False, category='container', type='px', value='auto'), container_padding_x=OptionsInfo(scss=False, category='container', type='px', value='0px'), container_padding_y=OptionsInfo(scss=False, category='container', type='px', value='10px'), container_overflow_x=OptionsInfo(scss=False, category='container', type='overflow', value='auto'), container_overflow_y=OptionsInfo(scss=False, category='container', type='overflow', value='auto'), quarto_disable_processing=OptionsInfo(scss=False, category='quarto', type='logical', value=False), quarto_use_bootstrap=OptionsInfo(scss=False, category='quarto', type='logical', value=False)), _has_built=False)" ] }, "execution_count": 79, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#from great_tables.data import islands\n", "\n", "gt_tbl = (GT(ols_df)\n", " .tab_header(title='Calibration of coral Sr/Ca to SST, Ordinary Least Square')\n", " .fmt_number(['Slope','Slope SE$^a$','Intercept','Intercept SE$^a$'], decimals=3)\n", " .fmt_number('R$^2$',decimals=2)\n", " .tab_source_note(source_note = \"$^a$ SE: standard error\")\n", " .tab_options(column_labels_background_color=\"darkgrey\",source_notes_background_color=\"OldLace\")\n", " ) \n", "\n", "gt_tbl" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The calibration equations for *S. sidera* are vert similar between the two cores and SST products, which is not surprising given the good agreement among these datasets. The calibration slope of *M.faveolata* is lower, suggesting separate calibrations would be needed for these two species if used as paleothermometers.\n", "\n", "## Weighted least square regression\n", "\n", "Following the original approach in Delong et al., let's use a weighted least square regression. The method of ordinary least squares, which we used previously, assumes that there is constant variance in the errors. The method of weighted least squares can be used when the ordinary least squares assumption of constant variance in the errors is violated, which is the case here. The weights applied to the regression are inversely proportional to the error variance and reflects the information we have about each observation. Here, we will take into consideration the error in both the Sr/Ca measurements (estimated as repeated measurements on the same sample) and SST:\n", "\n", "$$\n", " w_i = \\frac{1}{\\sigma^{2}_{i,\\mathrm{Sr/Ca}} + \\sigma^{2}_{i,\\mathrm{SST}}}\n", "$$\n", "\n", "where $\\sigma$ represents the standard error on the Sr/Ca measurements and SST\n", "\n", "### *Siderastrea sidera*\n", "\n", "Let's start with the calibration for *Siderastrea sidera*, using one core at a time as per the original study. \n", "\n", "#### Core A1\n", "\n", "Let's start with the calibration to the DRTO SST data. But first, let's remove NaNs:" ] }, { "cell_type": "code", "execution_count": 80, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Intercept: 10.043\n", "Slope: -0.041\n", "Intercept Standard Error: 0.023\n", "Slope Standard Error: 0.001\n", "R_squared: 0.95\n" ] } ], "source": [ "cleaned_df = df.dropna(subset=['Mean Sr/Ca (mmol/mol)','DRTO SST (ºC)'])\n", "\n", "X = cleaned_df.iloc[:,10]\n", "Y = cleaned_df.iloc[:,1]\n", "X = sm.add_constant(X)\n", "weights = 1/(cleaned_df.iloc[:,3]**2+cleaned_df.iloc[:,11]**2)\n", "\n", "wls = sm.WLS(Y,X, weights=weights)\n", "results = wls.fit()\n", "\n", "#get the parameters\n", "intercept, slope = results.params\n", "\n", "#get the standard error\n", "intercept_se, slope_se = results.bse\n", "\n", "#R_squared\n", "r_squared = results.rsquared\n", "\n", "print(\"Intercept:\", f\"{intercept:.3f}\")\n", "print(\"Slope:\", f\"{slope:.3f}\")\n", "print(\"Intercept Standard Error:\", f\"{intercept_se:.3f}\")\n", "print(\"Slope Standard Error:\", f\"{slope_se:.3f}\")\n", "print(\"R_squared:\", f\"{r_squared :.2f}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's save the results:" ] }, { "cell_type": "code", "execution_count": 81, "metadata": {}, "outputs": [], "source": [ "coral_id = ['A1 (S.Sidera)']\n", "SST_p = ['DRTO']\n", "m = [slope]\n", "p = [intercept]\n", "m_se = [slope_se]\n", "p_se = [intercept_se]\n", "r2 = [r_squared]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And let's regress against Sand Key SST:" ] }, { "cell_type": "code", "execution_count": 82, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Intercept: 10.124\n", "Slope: -0.044\n", "Intercept Standard Error: 0.028\n", "Slope Standard Error: 0.001\n", "R_squared: 0.92\n" ] } ], "source": [ "cleaned_df = df.dropna(subset=['Mean Sr/Ca (mmol/mol)','Sand Key SST (ºC)'])\n", "\n", "X = cleaned_df.iloc[:,12]\n", "Y = cleaned_df.iloc[:,1]\n", "X = sm.add_constant(X)\n", "weights = 1/(cleaned_df.iloc[:,3]**2+cleaned_df.iloc[:,13]**2)\n", "\n", "wls = sm.WLS(Y,X, weights=weights)\n", "results = wls.fit()\n", "\n", "#get the parameters\n", "intercept, slope = results.params\n", "\n", "#get the standard error\n", "intercept_se, slope_se = results.bse\n", "#R_squared\n", "r_squared = results.rsquared\n", "\n", "print(\"Intercept:\", f\"{intercept:.3f}\")\n", "print(\"Slope:\", f\"{slope:.3f}\")\n", "print(\"Intercept Standard Error:\", f\"{intercept_se:.3f}\")\n", "print(\"Slope Standard Error:\", f\"{slope_se:.3f}\")\n", "print(\"R_squared:\", f\"{r_squared :.2f}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And let's save the results:" ] }, { "cell_type": "code", "execution_count": 83, "metadata": {}, "outputs": [], "source": [ "coral_id.append('A1 (S.Sidera)')\n", "SST_p.append('SANF1')\n", "m.append(slope)\n", "p.append(intercept)\n", "m_se.append(slope_se)\n", "p_se.append(intercept_se)\n", "r2.append(r_squared)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Core F1" ] }, { "cell_type": "code", "execution_count": 84, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Intercept: 10.091\n", "Slope: -0.042\n", "Intercept Standard Error: 0.026\n", "Slope Standard Error: 0.001\n", "R_squared: 0.95\n" ] } ], "source": [ "cleaned_df = df.dropna(subset=['Mean Sr/Ca (mmol/mol).1','DRTO SST (ºC)'])\n", "\n", "X = cleaned_df.iloc[:,10]\n", "Y = cleaned_df.iloc[:,4]\n", "X = sm.add_constant(X)\n", "weights = 1/(cleaned_df.iloc[:,6]**2+cleaned_df.iloc[:,11]**2)\n", "\n", "wls = sm.WLS(Y,X,weights=weights)\n", "results = wls.fit()\n", "\n", "#get the parameters\n", "intercept, slope = results.params\n", "\n", "#get the standard error\n", "intercept_se, slope_se = results.bse\n", "#R_squared\n", "r_squared = results.rsquared\n", "\n", "print(\"Intercept:\", f\"{intercept:.3f}\")\n", "print(\"Slope:\", f\"{slope:.3f}\")\n", "print(\"Intercept Standard Error:\", f\"{intercept_se:.3f}\")\n", "print(\"Slope Standard Error:\", f\"{slope_se:.3f}\")\n", "print(\"R_squared:\", f\"{r_squared :.2f}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And let's append our results!" ] }, { "cell_type": "code", "execution_count": 85, "metadata": {}, "outputs": [], "source": [ "coral_id.append('F1 (S.Sidera)')\n", "SST_p.append('DRTO')\n", "m.append(slope)\n", "p.append(intercept)\n", "m_se.append(slope_se)\n", "p_se.append(intercept_se)\n", "r2.append(r_squared)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's move on to Sand Key SST!" ] }, { "cell_type": "code", "execution_count": 86, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Intercept: 10.219\n", "Slope: -0.046\n", "Intercept Standard Error: 0.029\n", "Slope Standard Error: 0.001\n", "R_squared: 0.92\n" ] } ], "source": [ "cleaned_df = df.dropna(subset=['Mean Sr/Ca (mmol/mol).1','Sand Key SST (ºC)'])\n", "\n", "X = cleaned_df.iloc[:,12]\n", "Y = cleaned_df.iloc[:,4]\n", "X = sm.add_constant(X)\n", "weights = 1/(cleaned_df.iloc[:,6]**2+cleaned_df.iloc[:,13]**2)\n", "\n", "wls = sm.WLS(Y,X, weights=weights)\n", "results = wls.fit()\n", "\n", "#get the parameters\n", "intercept, slope = results.params\n", "\n", "#get the standard error\n", "intercept_se, slope_se = results.bse\n", "\n", "#R_squared\n", "r_squared = results.rsquared\n", "\n", "print(\"Intercept:\", f\"{intercept:.3f}\")\n", "print(\"Slope:\", f\"{slope:.3f}\")\n", "print(\"Intercept Standard Error:\", f\"{intercept_se:.3f}\")\n", "print(\"Slope Standard Error:\", f\"{slope_se:.3f}\")\n", "print(\"R_squared:\", f\"{r_squared :.2f}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's append to the results!" ] }, { "cell_type": "code", "execution_count": 87, "metadata": {}, "outputs": [], "source": [ "coral_id.append('F1 (S.Sidera)')\n", "SST_p.append('SANF1')\n", "m.append(slope)\n", "p.append(intercept)\n", "m_se.append(slope_se)\n", "p_se.append(intercept_se)\n", "r2.append(r_squared)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### *Montastraea faveolata*" ] }, { "cell_type": "code", "execution_count": 89, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Intercept: 9.956\n", "Slope: -0.029\n", "Intercept Standard Error: 0.030\n", "Slope Standard Error: 0.001\n", "R_squared: 0.86\n" ] } ], "source": [ "cleaned_df = df.dropna(subset=['Mean Sr/Ca (mmol/mol).2','DRTO SST (ºC)'])\n", "\n", "X = cleaned_df.iloc[:,10]\n", "Y = cleaned_df.iloc[:,7]\n", "X = sm.add_constant(X)\n", "weights = 1/(cleaned_df.iloc[:,9]**2+cleaned_df.iloc[:,11]**2)\n", "\n", "wls = sm.WLS(Y,X, weights=weights)\n", "results = wls.fit()\n", "\n", "#get the parameters\n", "intercept, slope = results.params\n", "\n", "#get the standard error\n", "intercept_se, slope_se = results.bse\n", "\n", "#R_squared\n", "r_squared = results.rsquared\n", "\n", "print(\"Intercept:\", f\"{intercept:.3f}\")\n", "print(\"Slope:\", f\"{slope:.3f}\")\n", "print(\"Intercept Standard Error:\", f\"{intercept_se:.3f}\")\n", "print(\"Slope Standard Error:\", f\"{slope_se:.3f}\")\n", "print(\"R_squared:\", f\"{r_squared :.2f}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's append the results to the list:" ] }, { "cell_type": "code", "execution_count": 90, "metadata": {}, "outputs": [], "source": [ "coral_id.append('B3 (M. faveolata)')\n", "SST_p.append('DRTO')\n", "m.append(slope)\n", "p.append(intercept)\n", "m_se.append(slope_se)\n", "p_se.append(intercept_se)\n", "r2.append(r_squared)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally, let's do the regression against Sand Key SST data:" ] }, { "cell_type": "code", "execution_count": 91, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Intercept: 10.047\n", "Slope: -0.032\n", "Intercept Standard Error: 0.030\n", "Slope Standard Error: 0.001\n", "R_squared: 0.84\n" ] } ], "source": [ "cleaned_df = df.dropna(subset=['Mean Sr/Ca (mmol/mol).2','Sand Key SST (ºC)'])\n", "\n", "X = cleaned_df.iloc[:,12]\n", "Y = cleaned_df.iloc[:,7]\n", "X = sm.add_constant(X)\n", "weights = 1/(cleaned_df.iloc[:,9]**2+cleaned_df.iloc[:,13]**2)\n", "\n", "wls = sm.WLS(Y,X, weights = weights)\n", "results = wls.fit()\n", "\n", "#get the parameters\n", "intercept, slope = results.params\n", "\n", "#get the standard error\n", "intercept_se, slope_se = results.bse\n", "\n", "#R_squared\n", "r_squared = results.rsquared\n", "\n", "print(\"Intercept:\", f\"{intercept:.3f}\")\n", "print(\"Slope:\", f\"{slope:.3f}\")\n", "print(\"Intercept Standard Error:\", f\"{intercept_se:.3f}\")\n", "print(\"Slope Standard Error:\", f\"{slope_se:.3f}\")\n", "print(\"R_squared:\", f\"{r_squared :.2f}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And append the results!" ] }, { "cell_type": "code", "execution_count": 92, "metadata": {}, "outputs": [], "source": [ "coral_id.append('B3 (M. faveolata)')\n", "SST_p.append('SANF1')\n", "m.append(slope)\n", "p.append(intercept)\n", "m_se.append(slope_se)\n", "p_se.append(intercept_se)\n", "r2.append(r_squared)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Summary\n", "\n", "Let's summarize our results into a table as we have done for the ordinary least square:" ] }, { "cell_type": "code", "execution_count": 93, "metadata": {}, "outputs": [], "source": [ "wls_df = pd.DataFrame({'Coral ID':coral_id,\n", " 'SST':SST_p,\n", " 'Slope':m,\n", " 'Slope SE$^a$':m_se,\n", " 'Intercept':p,\n", " 'Intercept SE$^a$':p_se,\n", " 'R$^2$':r2})" ] }, { "cell_type": "code", "execution_count": 95, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", "
Calibration of coral Sr/Ca to SST, Weighted Least Square
Coral IDSSTSlopeSlope SE$^a$InterceptIntercept SE$^a$R$^2$
A1 (S.Sidera)DRTO−0.0410.00110.0430.0230.95
A1 (S.Sidera)SANF1−0.0440.00110.1240.0280.92
F1 (S.Sidera)DRTO−0.0420.00110.0910.0260.95
F1 (S.Sidera)SANF1−0.0460.00110.2190.0290.92
B3 (M. faveolata)DRTO−0.0290.0019.9560.0300.86
B3 (M. faveolata)SANF1−0.0320.00110.0470.0300.84
$^a$ SE: standard error
\n", "\n", "
\n", " " ], "text/plain": [ "GT(_tbl_data= Coral ID SST Slope Slope SE$^a$ Intercept \\\n", "0 A1 (S.Sidera) DRTO -0.041494 0.000859 10.042699 \n", "1 A1 (S.Sidera) SANF1 -0.043805 0.001011 10.124427 \n", "2 F1 (S.Sidera) DRTO -0.042130 0.000967 10.090973 \n", "3 F1 (S.Sidera) SANF1 -0.046215 0.001041 10.218770 \n", "4 B3 (M. faveolata) DRTO -0.029156 0.001091 9.956096 \n", "5 B3 (M. faveolata) SANF1 -0.032008 0.001096 10.047260 \n", "\n", " Intercept SE$^a$ R$^2$ \n", "0 0.023434 0.953843 \n", "1 0.027869 0.918758 \n", "2 0.026174 0.945272 \n", "3 0.028569 0.922348 \n", "4 0.029617 0.863468 \n", "5 0.030076 0.837150 , _body=, _boxhead=Boxhead([ColInfo(var='Coral ID', type=, column_label='Coral ID', column_align='left', column_width=None), ColInfo(var='SST', type=, column_label='SST', column_align='left', column_width=None), ColInfo(var='Slope', type=, column_label='Slope', column_align='right', column_width=None), ColInfo(var='Slope SE$^a$', type=, column_label='Slope SE$^a$', column_align='right', column_width=None), ColInfo(var='Intercept', type=, column_label='Intercept', column_align='right', column_width=None), ColInfo(var='Intercept SE$^a$', type=, column_label='Intercept SE$^a$', column_align='right', column_width=None), ColInfo(var='R$^2$', type=, column_label='R$^2$', column_align='right', column_width=None)]), _stub=, _spanners=Spanners([]), _heading=Heading(title='Calibration of coral Sr/Ca to SST, Weighted Least Square', subtitle=None, preheader=None), _stubhead=None, _source_notes=['$^a$ SE: standard error'], _footnotes=[], _styles=[], _locale=, _formats=[, ], _substitutions=[], _options=Options(table_id=OptionsInfo(scss=False, category='table', type='value', value=None), table_caption=OptionsInfo(scss=False, category='table', type='value', value=None), table_width=OptionsInfo(scss=True, category='table', type='px', value='auto'), table_layout=OptionsInfo(scss=True, category='table', type='value', value='fixed'), table_margin_left=OptionsInfo(scss=True, category='table', type='px', value='auto'), table_margin_right=OptionsInfo(scss=True, category='table', type='px', value='auto'), table_background_color=OptionsInfo(scss=True, category='table', type='value', value='#FFFFFF'), table_font_names=OptionsInfo(scss=False, category='table', type='values', value=['-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', 'Fira Sans', 'Droid Sans', 'Arial', 'sans-serif']), table_font_size=OptionsInfo(scss=True, category='table', type='px', value='16px'), table_font_weight=OptionsInfo(scss=True, category='table', type='value', value='normal'), table_font_style=OptionsInfo(scss=True, category='table', type='value', value='normal'), table_font_color=OptionsInfo(scss=True, category='table', type='value', value='#333333'), table_font_color_light=OptionsInfo(scss=True, category='table', type='value', value='#FFFFFF'), table_border_top_include=OptionsInfo(scss=False, category='table', type='boolean', value=True), table_border_top_style=OptionsInfo(scss=True, category='table', type='value', value='solid'), table_border_top_width=OptionsInfo(scss=True, category='table', type='px', value='2px'), table_border_top_color=OptionsInfo(scss=True, category='table', type='value', value='#A8A8A8'), table_border_right_style=OptionsInfo(scss=True, category='table', type='value', value='none'), table_border_right_width=OptionsInfo(scss=True, category='table', type='px', value='2px'), table_border_right_color=OptionsInfo(scss=True, category='table', type='value', value='#D3D3D3'), table_border_bottom_include=OptionsInfo(scss=False, category='table', type='boolean', value=True), table_border_bottom_style=OptionsInfo(scss=True, category='table', type='value', value='solid'), table_border_bottom_width=OptionsInfo(scss=True, category='table', type='px', value='2px'), table_border_bottom_color=OptionsInfo(scss=True, category='table', type='value', value='#A8A8A8'), table_border_left_style=OptionsInfo(scss=True, category='table', type='value', value='none'), table_border_left_width=OptionsInfo(scss=True, category='table', type='px', value='2px'), table_border_left_color=OptionsInfo(scss=True, category='table', type='value', value='#D3D3D3'), heading_background_color=OptionsInfo(scss=True, category='heading', type='value', value=None), heading_align=OptionsInfo(scss=True, category='heading', type='value', value='center'), heading_title_font_size=OptionsInfo(scss=True, category='heading', type='px', value='125%'), heading_title_font_weight=OptionsInfo(scss=True, category='heading', type='value', value='initial'), heading_subtitle_font_size=OptionsInfo(scss=True, category='heading', type='px', value='85%'), heading_subtitle_font_weight=OptionsInfo(scss=True, category='heading', type='value', value='initial'), heading_padding=OptionsInfo(scss=True, category='heading', type='px', value='4px'), heading_padding_horizontal=OptionsInfo(scss=True, category='heading', type='px', value='5px'), heading_border_bottom_style=OptionsInfo(scss=True, category='heading', type='value', value='solid'), heading_border_bottom_width=OptionsInfo(scss=True, category='heading', type='px', value='2px'), heading_border_bottom_color=OptionsInfo(scss=True, category='heading', type='value', value='#D3D3D3'), heading_border_lr_style=OptionsInfo(scss=True, category='heading', type='value', value='none'), heading_border_lr_width=OptionsInfo(scss=True, category='heading', type='px', value='1px'), heading_border_lr_color=OptionsInfo(scss=True, category='heading', type='value', value='#D3D3D3'), column_labels_background_color=OptionsInfo(scss=True, category='column_labels', type='value', value='darkgrey'), column_labels_font_size=OptionsInfo(scss=True, category='column_labels', type='px', value='100%'), column_labels_font_weight=OptionsInfo(scss=True, category='column_labels', type='value', value='normal'), column_labels_text_transform=OptionsInfo(scss=True, category='column_labels', type='value', value='inherit'), column_labels_padding=OptionsInfo(scss=True, category='column_labels', type='px', value='5px'), column_labels_padding_horizontal=OptionsInfo(scss=True, category='column_labels', type='px', value='5px'), column_labels_vlines_style=OptionsInfo(scss=True, category='table_body', type='value', value='none'), column_labels_vlines_width=OptionsInfo(scss=True, category='table_body', type='px', value='1px'), column_labels_vlines_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), column_labels_border_top_style=OptionsInfo(scss=True, category='column_labels', type='value', value='solid'), column_labels_border_top_width=OptionsInfo(scss=True, category='column_labels', type='px', value='2px'), column_labels_border_top_color=OptionsInfo(scss=True, category='column_labels', type='value', value='#D3D3D3'), column_labels_border_bottom_style=OptionsInfo(scss=True, category='column_labels', type='value', value='solid'), column_labels_border_bottom_width=OptionsInfo(scss=True, category='column_labels', type='px', value='2px'), column_labels_border_bottom_color=OptionsInfo(scss=True, category='column_labels', type='value', value='#D3D3D3'), column_labels_border_lr_style=OptionsInfo(scss=True, category='column_labels', type='value', value='none'), column_labels_border_lr_width=OptionsInfo(scss=True, category='column_labels', type='px', value='1px'), column_labels_border_lr_color=OptionsInfo(scss=True, category='column_labels', type='value', value='#D3D3D3'), column_labels_hidden=OptionsInfo(scss=False, category='column_labels', type='boolean', value=False), row_group_background_color=OptionsInfo(scss=True, category='row_group', type='value', value=None), row_group_font_size=OptionsInfo(scss=True, category='row_group', type='px', value='100%'), row_group_font_weight=OptionsInfo(scss=True, category='row_group', type='value', value='initial'), row_group_text_transform=OptionsInfo(scss=True, category='row_group', type='value', value='inherit'), row_group_padding=OptionsInfo(scss=True, category='row_group', type='px', value='8px'), row_group_padding_horizontal=OptionsInfo(scss=True, category='row_group', type='px', value='5px'), row_group_border_top_style=OptionsInfo(scss=True, category='row_group', type='value', value='solid'), row_group_border_top_width=OptionsInfo(scss=True, category='row_group', type='px', value='2px'), row_group_border_top_color=OptionsInfo(scss=True, category='row_group', type='value', value='#D3D3D3'), row_group_border_right_style=OptionsInfo(scss=True, category='row_group', type='value', value='none'), row_group_border_right_width=OptionsInfo(scss=True, category='row_group', type='px', value='1px'), row_group_border_right_color=OptionsInfo(scss=True, category='row_group', type='value', value='#D3D3D3'), row_group_border_bottom_style=OptionsInfo(scss=True, category='row_group', type='value', value='solid'), row_group_border_bottom_width=OptionsInfo(scss=True, category='row_group', type='px', value='2px'), row_group_border_bottom_color=OptionsInfo(scss=True, category='row_group', type='value', value='#D3D3D3'), row_group_border_left_style=OptionsInfo(scss=True, category='row_group', type='value', value='none'), row_group_border_left_width=OptionsInfo(scss=True, category='row_group', type='px', value='1px'), row_group_border_left_color=OptionsInfo(scss=True, category='row_group', type='value', value='#D3D3D3'), row_group_as_column=OptionsInfo(scss=False, category='row_group', type='boolean', value=False), table_body_hlines_style=OptionsInfo(scss=True, category='table_body', type='value', value='solid'), table_body_hlines_width=OptionsInfo(scss=True, category='table_body', type='px', value='1px'), table_body_hlines_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), table_body_vlines_style=OptionsInfo(scss=True, category='table_body', type='value', value='none'), table_body_vlines_width=OptionsInfo(scss=True, category='table_body', type='px', value='1px'), table_body_vlines_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), table_body_border_top_style=OptionsInfo(scss=True, category='table_body', type='value', value='solid'), table_body_border_top_width=OptionsInfo(scss=True, category='table_body', type='px', value='2px'), table_body_border_top_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), table_body_border_bottom_style=OptionsInfo(scss=True, category='table_body', type='value', value='solid'), table_body_border_bottom_width=OptionsInfo(scss=True, category='table_body', type='px', value='2px'), table_body_border_bottom_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), data_row_padding=OptionsInfo(scss=True, category='data_row', type='px', value='8px'), data_row_padding_horizontal=OptionsInfo(scss=True, category='data_row', type='px', value='5px'), stub_background_color=OptionsInfo(scss=True, category='stub', type='value', value=None), stub_font_size=OptionsInfo(scss=True, category='stub', type='px', value='100%'), stub_font_weight=OptionsInfo(scss=True, category='stub', type='value', value='initial'), stub_text_transform=OptionsInfo(scss=True, category='stub', type='value', value='inherit'), stub_border_style=OptionsInfo(scss=True, category='stub', type='value', value='solid'), stub_border_width=OptionsInfo(scss=True, category='stub', type='px', value='2px'), stub_border_color=OptionsInfo(scss=True, category='stub', type='value', value='#D3D3D3'), stub_row_group_background_color=OptionsInfo(scss=True, category='stub', type='value', value=None), stub_row_group_font_size=OptionsInfo(scss=True, category='stub', type='px', value='100%'), stub_row_group_font_weight=OptionsInfo(scss=True, category='stub', type='value', value='initial'), stub_row_group_text_transform=OptionsInfo(scss=True, category='stub', type='value', value='inherit'), stub_row_group_border_style=OptionsInfo(scss=True, category='stub', type='value', value='solid'), stub_row_group_border_width=OptionsInfo(scss=True, category='stub', type='px', value='2px'), stub_row_group_border_color=OptionsInfo(scss=True, category='stub', type='value', value='#D3D3D3'), source_notes_padding=OptionsInfo(scss=True, category='source_notes', type='px', value='4px'), source_notes_padding_horizontal=OptionsInfo(scss=True, category='source_notes', type='px', value='5px'), source_notes_background_color=OptionsInfo(scss=True, category='source_notes', type='value', value='OldLace'), source_notes_font_size=OptionsInfo(scss=True, category='source_notes', type='px', value='90%'), source_notes_border_bottom_style=OptionsInfo(scss=True, category='source_notes', type='value', value='none'), source_notes_border_bottom_width=OptionsInfo(scss=True, category='source_notes', type='px', value='2px'), source_notes_border_bottom_color=OptionsInfo(scss=True, category='source_notes', type='value', value='#D3D3D3'), source_notes_border_lr_style=OptionsInfo(scss=True, category='source_notes', type='value', value='none'), source_notes_border_lr_width=OptionsInfo(scss=True, category='source_notes', type='px', value='2px'), source_notes_border_lr_color=OptionsInfo(scss=True, category='source_notes', type='value', value='#D3D3D3'), source_notes_multiline=OptionsInfo(scss=False, category='source_notes', type='boolean', value=True), source_notes_sep=OptionsInfo(scss=False, category='source_notes', type='value', value=' '), container_width=OptionsInfo(scss=False, category='container', type='px', value='auto'), container_height=OptionsInfo(scss=False, category='container', type='px', value='auto'), container_padding_x=OptionsInfo(scss=False, category='container', type='px', value='0px'), container_padding_y=OptionsInfo(scss=False, category='container', type='px', value='10px'), container_overflow_x=OptionsInfo(scss=False, category='container', type='overflow', value='auto'), container_overflow_y=OptionsInfo(scss=False, category='container', type='overflow', value='auto'), quarto_disable_processing=OptionsInfo(scss=False, category='quarto', type='logical', value=False), quarto_use_bootstrap=OptionsInfo(scss=False, category='quarto', type='logical', value=False)), _has_built=False)" ] }, "execution_count": 95, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gt_tbl_wls = (GT(wls_df)\n", " .tab_header(title='Calibration of coral Sr/Ca to SST, Weighted Least Square')\n", " .fmt_number(['Slope','Slope SE$^a$','Intercept','Intercept SE$^a$'], decimals=3)\n", " .fmt_number('R$^2$',decimals=2)\n", " .tab_source_note(source_note = \"$^a$ SE: standard error\")\n", " .tab_options(column_labels_background_color=\"darkgrey\",source_notes_background_color=\"OldLace\")\n", " ) \n", "\n", "gt_tbl_wls" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For easy comparsion, let's bring back the ordinary least square results:" ] }, { "cell_type": "code", "execution_count": 96, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", "
Calibration of coral Sr/Ca to SST, Ordinary Least Square
Coral IDSSTSlopeSlope SE$^a$InterceptIntercept SE$^a$R$^2$
A1 (S.Sidera)DRTO−0.0400.00110.0040.0240.95
A1 (S.Sidera)SANF1−0.0430.00110.1150.0250.93
F1 (S.Sidera)DRTO−0.0420.00110.0830.0250.95
F1 (S.Sidera)SANF1−0.0460.00110.2210.0270.93
B3 (M. faveolata)DRTO−0.0290.0019.9550.0280.87
B3 (M. faveolata)SANF1−0.0310.00110.0310.0270.85
$^a$ SE: standard error
\n", "\n", "
\n", " " ], "text/plain": [ "GT(_tbl_data= Coral ID SST Slope Slope SE$^a$ Intercept \\\n", "0 A1 (S.Sidera) DRTO -0.039834 0.000899 10.004214 \n", "1 A1 (S.Sidera) SANF1 -0.043351 0.000953 10.115004 \n", "2 F1 (S.Sidera) DRTO -0.041691 0.000943 10.083337 \n", "3 F1 (S.Sidera) SANF1 -0.046175 0.001011 10.221017 \n", "4 B3 (M. faveolata) DRTO -0.028845 0.001062 9.954502 \n", "5 B3 (M. faveolata) SANF1 -0.031252 0.001026 10.031300 \n", "\n", " Intercept SE$^a$ R$^2$ \n", "0 0.023605 0.945576 \n", "1 0.025447 0.925744 \n", "2 0.024668 0.946745 \n", "3 0.026993 0.926313 \n", "4 0.027877 0.867231 \n", "5 0.027401 0.848212 , _body=, _boxhead=Boxhead([ColInfo(var='Coral ID', type=, column_label='Coral ID', column_align='left', column_width=None), ColInfo(var='SST', type=, column_label='SST', column_align='left', column_width=None), ColInfo(var='Slope', type=, column_label='Slope', column_align='right', column_width=None), ColInfo(var='Slope SE$^a$', type=, column_label='Slope SE$^a$', column_align='right', column_width=None), ColInfo(var='Intercept', type=, column_label='Intercept', column_align='right', column_width=None), ColInfo(var='Intercept SE$^a$', type=, column_label='Intercept SE$^a$', column_align='right', column_width=None), ColInfo(var='R$^2$', type=, column_label='R$^2$', column_align='right', column_width=None)]), _stub=, _spanners=Spanners([]), _heading=Heading(title='Calibration of coral Sr/Ca to SST, Ordinary Least Square', subtitle=None, preheader=None), _stubhead=None, _source_notes=['$^a$ SE: standard error'], _footnotes=[], _styles=[], _locale=, _formats=[, ], _substitutions=[], _options=Options(table_id=OptionsInfo(scss=False, category='table', type='value', value=None), table_caption=OptionsInfo(scss=False, category='table', type='value', value=None), table_width=OptionsInfo(scss=True, category='table', type='px', value='auto'), table_layout=OptionsInfo(scss=True, category='table', type='value', value='fixed'), table_margin_left=OptionsInfo(scss=True, category='table', type='px', value='auto'), table_margin_right=OptionsInfo(scss=True, category='table', type='px', value='auto'), table_background_color=OptionsInfo(scss=True, category='table', type='value', value='#FFFFFF'), table_font_names=OptionsInfo(scss=False, category='table', type='values', value=['-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', 'Fira Sans', 'Droid Sans', 'Arial', 'sans-serif']), table_font_size=OptionsInfo(scss=True, category='table', type='px', value='16px'), table_font_weight=OptionsInfo(scss=True, category='table', type='value', value='normal'), table_font_style=OptionsInfo(scss=True, category='table', type='value', value='normal'), table_font_color=OptionsInfo(scss=True, category='table', type='value', value='#333333'), table_font_color_light=OptionsInfo(scss=True, category='table', type='value', value='#FFFFFF'), table_border_top_include=OptionsInfo(scss=False, category='table', type='boolean', value=True), table_border_top_style=OptionsInfo(scss=True, category='table', type='value', value='solid'), table_border_top_width=OptionsInfo(scss=True, category='table', type='px', value='2px'), table_border_top_color=OptionsInfo(scss=True, category='table', type='value', value='#A8A8A8'), table_border_right_style=OptionsInfo(scss=True, category='table', type='value', value='none'), table_border_right_width=OptionsInfo(scss=True, category='table', type='px', value='2px'), table_border_right_color=OptionsInfo(scss=True, category='table', type='value', value='#D3D3D3'), table_border_bottom_include=OptionsInfo(scss=False, category='table', type='boolean', value=True), table_border_bottom_style=OptionsInfo(scss=True, category='table', type='value', value='solid'), table_border_bottom_width=OptionsInfo(scss=True, category='table', type='px', value='2px'), table_border_bottom_color=OptionsInfo(scss=True, category='table', type='value', value='#A8A8A8'), table_border_left_style=OptionsInfo(scss=True, category='table', type='value', value='none'), table_border_left_width=OptionsInfo(scss=True, category='table', type='px', value='2px'), table_border_left_color=OptionsInfo(scss=True, category='table', type='value', value='#D3D3D3'), heading_background_color=OptionsInfo(scss=True, category='heading', type='value', value=None), heading_align=OptionsInfo(scss=True, category='heading', type='value', value='center'), heading_title_font_size=OptionsInfo(scss=True, category='heading', type='px', value='125%'), heading_title_font_weight=OptionsInfo(scss=True, category='heading', type='value', value='initial'), heading_subtitle_font_size=OptionsInfo(scss=True, category='heading', type='px', value='85%'), heading_subtitle_font_weight=OptionsInfo(scss=True, category='heading', type='value', value='initial'), heading_padding=OptionsInfo(scss=True, category='heading', type='px', value='4px'), heading_padding_horizontal=OptionsInfo(scss=True, category='heading', type='px', value='5px'), heading_border_bottom_style=OptionsInfo(scss=True, category='heading', type='value', value='solid'), heading_border_bottom_width=OptionsInfo(scss=True, category='heading', type='px', value='2px'), heading_border_bottom_color=OptionsInfo(scss=True, category='heading', type='value', value='#D3D3D3'), heading_border_lr_style=OptionsInfo(scss=True, category='heading', type='value', value='none'), heading_border_lr_width=OptionsInfo(scss=True, category='heading', type='px', value='1px'), heading_border_lr_color=OptionsInfo(scss=True, category='heading', type='value', value='#D3D3D3'), column_labels_background_color=OptionsInfo(scss=True, category='column_labels', type='value', value='darkgrey'), column_labels_font_size=OptionsInfo(scss=True, category='column_labels', type='px', value='100%'), column_labels_font_weight=OptionsInfo(scss=True, category='column_labels', type='value', value='normal'), column_labels_text_transform=OptionsInfo(scss=True, category='column_labels', type='value', value='inherit'), column_labels_padding=OptionsInfo(scss=True, category='column_labels', type='px', value='5px'), column_labels_padding_horizontal=OptionsInfo(scss=True, category='column_labels', type='px', value='5px'), column_labels_vlines_style=OptionsInfo(scss=True, category='table_body', type='value', value='none'), column_labels_vlines_width=OptionsInfo(scss=True, category='table_body', type='px', value='1px'), column_labels_vlines_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), column_labels_border_top_style=OptionsInfo(scss=True, category='column_labels', type='value', value='solid'), column_labels_border_top_width=OptionsInfo(scss=True, category='column_labels', type='px', value='2px'), column_labels_border_top_color=OptionsInfo(scss=True, category='column_labels', type='value', value='#D3D3D3'), column_labels_border_bottom_style=OptionsInfo(scss=True, category='column_labels', type='value', value='solid'), column_labels_border_bottom_width=OptionsInfo(scss=True, category='column_labels', type='px', value='2px'), column_labels_border_bottom_color=OptionsInfo(scss=True, category='column_labels', type='value', value='#D3D3D3'), column_labels_border_lr_style=OptionsInfo(scss=True, category='column_labels', type='value', value='none'), column_labels_border_lr_width=OptionsInfo(scss=True, category='column_labels', type='px', value='1px'), column_labels_border_lr_color=OptionsInfo(scss=True, category='column_labels', type='value', value='#D3D3D3'), column_labels_hidden=OptionsInfo(scss=False, category='column_labels', type='boolean', value=False), row_group_background_color=OptionsInfo(scss=True, category='row_group', type='value', value=None), row_group_font_size=OptionsInfo(scss=True, category='row_group', type='px', value='100%'), row_group_font_weight=OptionsInfo(scss=True, category='row_group', type='value', value='initial'), row_group_text_transform=OptionsInfo(scss=True, category='row_group', type='value', value='inherit'), row_group_padding=OptionsInfo(scss=True, category='row_group', type='px', value='8px'), row_group_padding_horizontal=OptionsInfo(scss=True, category='row_group', type='px', value='5px'), row_group_border_top_style=OptionsInfo(scss=True, category='row_group', type='value', value='solid'), row_group_border_top_width=OptionsInfo(scss=True, category='row_group', type='px', value='2px'), row_group_border_top_color=OptionsInfo(scss=True, category='row_group', type='value', value='#D3D3D3'), row_group_border_right_style=OptionsInfo(scss=True, category='row_group', type='value', value='none'), row_group_border_right_width=OptionsInfo(scss=True, category='row_group', type='px', value='1px'), row_group_border_right_color=OptionsInfo(scss=True, category='row_group', type='value', value='#D3D3D3'), row_group_border_bottom_style=OptionsInfo(scss=True, category='row_group', type='value', value='solid'), row_group_border_bottom_width=OptionsInfo(scss=True, category='row_group', type='px', value='2px'), row_group_border_bottom_color=OptionsInfo(scss=True, category='row_group', type='value', value='#D3D3D3'), row_group_border_left_style=OptionsInfo(scss=True, category='row_group', type='value', value='none'), row_group_border_left_width=OptionsInfo(scss=True, category='row_group', type='px', value='1px'), row_group_border_left_color=OptionsInfo(scss=True, category='row_group', type='value', value='#D3D3D3'), row_group_as_column=OptionsInfo(scss=False, category='row_group', type='boolean', value=False), table_body_hlines_style=OptionsInfo(scss=True, category='table_body', type='value', value='solid'), table_body_hlines_width=OptionsInfo(scss=True, category='table_body', type='px', value='1px'), table_body_hlines_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), table_body_vlines_style=OptionsInfo(scss=True, category='table_body', type='value', value='none'), table_body_vlines_width=OptionsInfo(scss=True, category='table_body', type='px', value='1px'), table_body_vlines_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), table_body_border_top_style=OptionsInfo(scss=True, category='table_body', type='value', value='solid'), table_body_border_top_width=OptionsInfo(scss=True, category='table_body', type='px', value='2px'), table_body_border_top_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), table_body_border_bottom_style=OptionsInfo(scss=True, category='table_body', type='value', value='solid'), table_body_border_bottom_width=OptionsInfo(scss=True, category='table_body', type='px', value='2px'), table_body_border_bottom_color=OptionsInfo(scss=True, category='table_body', type='value', value='#D3D3D3'), data_row_padding=OptionsInfo(scss=True, category='data_row', type='px', value='8px'), data_row_padding_horizontal=OptionsInfo(scss=True, category='data_row', type='px', value='5px'), stub_background_color=OptionsInfo(scss=True, category='stub', type='value', value=None), stub_font_size=OptionsInfo(scss=True, category='stub', type='px', value='100%'), stub_font_weight=OptionsInfo(scss=True, category='stub', type='value', value='initial'), stub_text_transform=OptionsInfo(scss=True, category='stub', type='value', value='inherit'), stub_border_style=OptionsInfo(scss=True, category='stub', type='value', value='solid'), stub_border_width=OptionsInfo(scss=True, category='stub', type='px', value='2px'), stub_border_color=OptionsInfo(scss=True, category='stub', type='value', value='#D3D3D3'), stub_row_group_background_color=OptionsInfo(scss=True, category='stub', type='value', value=None), stub_row_group_font_size=OptionsInfo(scss=True, category='stub', type='px', value='100%'), stub_row_group_font_weight=OptionsInfo(scss=True, category='stub', type='value', value='initial'), stub_row_group_text_transform=OptionsInfo(scss=True, category='stub', type='value', value='inherit'), stub_row_group_border_style=OptionsInfo(scss=True, category='stub', type='value', value='solid'), stub_row_group_border_width=OptionsInfo(scss=True, category='stub', type='px', value='2px'), stub_row_group_border_color=OptionsInfo(scss=True, category='stub', type='value', value='#D3D3D3'), source_notes_padding=OptionsInfo(scss=True, category='source_notes', type='px', value='4px'), source_notes_padding_horizontal=OptionsInfo(scss=True, category='source_notes', type='px', value='5px'), source_notes_background_color=OptionsInfo(scss=True, category='source_notes', type='value', value='OldLace'), source_notes_font_size=OptionsInfo(scss=True, category='source_notes', type='px', value='90%'), source_notes_border_bottom_style=OptionsInfo(scss=True, category='source_notes', type='value', value='none'), source_notes_border_bottom_width=OptionsInfo(scss=True, category='source_notes', type='px', value='2px'), source_notes_border_bottom_color=OptionsInfo(scss=True, category='source_notes', type='value', value='#D3D3D3'), source_notes_border_lr_style=OptionsInfo(scss=True, category='source_notes', type='value', value='none'), source_notes_border_lr_width=OptionsInfo(scss=True, category='source_notes', type='px', value='2px'), source_notes_border_lr_color=OptionsInfo(scss=True, category='source_notes', type='value', value='#D3D3D3'), source_notes_multiline=OptionsInfo(scss=False, category='source_notes', type='boolean', value=True), source_notes_sep=OptionsInfo(scss=False, category='source_notes', type='value', value=' '), container_width=OptionsInfo(scss=False, category='container', type='px', value='auto'), container_height=OptionsInfo(scss=False, category='container', type='px', value='auto'), container_padding_x=OptionsInfo(scss=False, category='container', type='px', value='0px'), container_padding_y=OptionsInfo(scss=False, category='container', type='px', value='10px'), container_overflow_x=OptionsInfo(scss=False, category='container', type='overflow', value='auto'), container_overflow_y=OptionsInfo(scss=False, category='container', type='overflow', value='auto'), quarto_disable_processing=OptionsInfo(scss=False, category='quarto', type='logical', value=False), quarto_use_bootstrap=OptionsInfo(scss=False, category='quarto', type='logical', value=False)), _has_built=False)" ] }, "execution_count": 96, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gt_tbl" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The coefficients are very similar to each other, which is not surprising. WLS resulted in slightly lower standard error on the intercept." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## References\n", "\n", "DeLong, K.L., J.A. Flannery, C.R. Maupin, R.Z. Poore, and T.M. Quinn. 2011. A coral Sr/Ca calibration and replication study of two massive corals from the Gulf of Mexico. Palaeogeography, Palaeoclimatology, Palaeoecology, 307(1-4), 117-128. doi: 10.1016/j.palaeo.2011.05.005" ] } ], "metadata": { "colab": { "collapsed_sections": [], "name": "Coral thermometer calibration.ipynb", "provenance": [] }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "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.12.3" } }, "nbformat": 4, "nbformat_minor": 4 }