Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Rundmus committed Apr 25, 2024
2 parents 15ecbb9 + acef32c commit 3ca8fd0
Show file tree
Hide file tree
Showing 22 changed files with 37 additions and 45 deletions.
4 changes: 2 additions & 2 deletions session-lm/.quarto/_freeze/lm-coeff/execute-results/html.json

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion session-lm/.quarto/cites/index.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"lm-lasso-exercises.qmd":[],"lm-intro-exercises.qmd":[],"lm-intro.qmd":[],"lm-diagn-exercises.qmd":[],"lm-diagn.qmd":[],"lm-glm.qmd":[],"lm-reg-cls.qmd":[],"lm-coeff-exercises.qmd":[],"lm-coeff.qmd":[],"index.qmd":[],"lm-ml.qmd":[]}
{"lm-ml.qmd":[],"lm-lasso-exercises.qmd":[],"lm-diagn.qmd":[],"lm-coeff.qmd":[],"lm-intro.qmd":[],"lm-diagn-exercises.qmd":[],"lm-glm.qmd":[],"lm-intro-exercises.qmd":[],"lm-reg-cls.qmd":[],"index.qmd":[],"lm-coeff-exercises.qmd":[]}
2 changes: 1 addition & 1 deletion session-lm/.quarto/idx/lm-coeff.qmd.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion session-lm/.quarto/xref/28d59191
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"entries":[],"options":{"chapters":true},"headings":["preface"]}
{"options":{"chapters":true},"entries":[],"headings":["preface"]}
2 changes: 1 addition & 1 deletion session-lm/.quarto/xref/295884aa
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"headings":["fitting-linear-model","hypothesis-testing","evaluate-model-fit"],"entries":[{"key":"exr-lm-assess-fit","caption":"Evaluate model fit","order":{"number":3,"section":[0,0,0,0,0,0,0]}},{"key":"exr-lm-fit","caption":"Fitting linear model","order":{"number":1,"section":[0,0,0,0,0,0,0]}},{"key":"exr-lm-hypothesis","caption":"Hypothesis testing","order":{"number":2,"section":[0,0,0,0,0,0,0]}}],"options":{"chapters":true}}
{"entries":[{"key":"exr-lm-fit","caption":"Fitting linear model","order":{"number":1,"section":[0,0,0,0,0,0,0]}},{"key":"exr-lm-hypothesis","caption":"Hypothesis testing","order":{"number":2,"section":[0,0,0,0,0,0,0]}},{"key":"exr-lm-assess-fit","caption":"Evaluate model fit","order":{"number":3,"section":[0,0,0,0,0,0,0]}}],"headings":["fitting-linear-model","hypothesis-testing","evaluate-model-fit"],"options":{"chapters":true}}
2 changes: 1 addition & 1 deletion session-lm/.quarto/xref/4d506fc9
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"entries":[{"caption":"Brozek score","key":"exr-brozek","order":{"section":[0,0,0,0,0,0,0],"number":1}}],"options":{"chapters":true},"headings":["brozek-score","answers-to-selected-exercises"]}
{"headings":["brozek-score","answers-to-selected-exercises"],"entries":[{"caption":"Brozek score","key":"exr-brozek","order":{"section":[0,0,0,0,0,0,0],"number":1}}],"options":{"chapters":true}}
2 changes: 1 addition & 1 deletion session-lm/.quarto/xref/5b28360f
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"entries":[{"order":{"number":2,"section":[0,0,0,0,0,0,0]},"caption":"Trout","key":"exr-trout"},{"order":{"number":1,"section":[0,0,0,0,0,0,0]},"caption":"Height-weight-gender","key":"exr-rerun"},{"order":{"number":3,"section":[0,0,0,0,0,0,0]},"caption":"Lowering blood pressure","key":"exr-drug"}],"options":{"chapters":true},"headings":["height-weight-gender","trout","lowering-blood-pressure","answers-to-selected-exercises"]}
{"headings":["height-weight-gender","trout","lowering-blood-pressure","answers-to-selected-exercises"],"entries":[{"caption":"Trout","key":"exr-trout","order":{"section":[0,0,0,0,0,0,0],"number":2}},{"caption":"Height-weight-gender","key":"exr-rerun","order":{"section":[0,0,0,0,0,0,0],"number":1}},{"caption":"Lowering blood pressure","key":"exr-drug","order":{"section":[0,0,0,0,0,0,0],"number":3}}],"options":{"chapters":true}}
2 changes: 1 addition & 1 deletion session-lm/.quarto/xref/691de0dc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"options":{"chapters":true},"entries":[{"order":{"number":1,"section":[3,1,0,0,0,0,0]},"caption":"Scatter plot showing BMI values given waist measurments with a fitted simple linear regression model.","key":"fig-simple-1"}],"headings":["example-simple-linear-regression","example-multiple-regression","example-categorical-variable","example-categorical-numerical-variables","example-interactions","example-logistic-regression-with-categorical-variable"]}
{"options":{"chapters":true},"headings":["example-simple-linear-regression","example-multiple-regression","example-categorical-variable","example-categorical-numerical-variables","example-interactions","example-logistic-regression-with-categorical-variable"],"entries":[{"key":"fig-simple-1","caption":"Scatter plot showing BMI values given waist measurments with a fitted simple linear regression model.","order":{"number":1,"section":[3,1,0,0,0,0,0]}}]}
2 changes: 1 addition & 1 deletion session-lm/.quarto/xref/9e3bf041
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"options":{"chapters":true},"entries":[{"caption":"Scatter plot of the data shows that high plasma volume tends to be associated with high weight and vice verca. Linear regression gives the equation of the straight line (red) that best describes how the outcome changes (increase or decreases) with a change of exposure variable","key":"fig-lm-example-reg","order":{"section":[1,5,0,0,0,0,0],"number":5}},{"caption":"vector-matrix-notation","key":"exm-vector-matrix-notation","order":{"section":[1,9,0,0,0,0,0],"number":4}},{"caption":"Scatter plot of the data shows that high plasma volume tends to be associated with high weight and vice verca. Linear regrssion gives the equation of the straight line (red) that best describes how the outcome changes with a change of exposure variable. Blue lines represent error terms, the vertical distances to the regression line","key":"fig-reg-errors","order":{"section":[1,6,0,0,0,0,0],"number":6}},{"caption":"Prediction and intervals","key":"exm-prediction-and-intervals","order":{"section":[1,10,0,0,0,0,0],"number":5}},{"caption":"Least squares in vector-matrix notation","key":"thm-lss-vector-matrix","order":{"section":[1,9,0,0,0,0,0],"number":2}},{"caption":"vector matrix form of the linear model","key":"def-vector-matrix-lm","order":{"section":[1,9,0,0,0,0,0],"number":1}},{"caption":"Hypothesis testing","key":"exm-hypothesis-testing","order":{"section":[1,8,0,0,0,0,0],"number":3}},{"caption":"Scatter plot of weight vs. height for the 130 study participants based on the diabetes data set collected to understand the prevalence of obesity, diabetes, and other cardiovascular risk factors in central Virginia, USA.","key":"fig-scatter","order":{"section":[1,1,0,0,0,0,0],"number":1}},{"caption":"Scatter plot of the data shows that high plasma volume tends to be associated with high weight and vice verca.","key":"fig-lm-intro-example","order":{"section":[1,5,0,0,0,0,0],"number":4}},{"caption":"Least squares","key":"exm-lss","order":{"section":[1,6,0,0,0,0,0],"number":2}},{"caption":"Weight and plasma volume","key":"exm-simple-lm","order":{"section":[1,5,0,0,0,0,0],"number":1}},{"caption":"Deterministic vs. statistical relationship: a) deterministic: equation exactly describes the relationship between the two variables e.g. Ferenheit and Celcius relationship, b) statistical relationship between x and y is not perfect (increasing relationship), c) statistical relationship between x and y is not perfect (decreasing relationship), d) random signal","key":"fig-relationship","order":{"section":[1,2,0,0,0,0,0],"number":2}},{"caption":"Scatter plot of the data shows that high plasma volume tends to be associated with high weight and vice verca. Linear regression gives the equation of the straight line that best describes how the outcome changes (increase or decreases) with a change of exposure variable (in red)","key":"fig-lm-parameters","order":{"section":[1,7,0,0,0,0,0],"number":7}},{"caption":"R^2(adj)","key":"thm-r2adj","order":{"section":[1,11,0,0,0,0,0],"number":4}},{"caption":"R^2","key":"def-r2","order":{"section":[1,11,0,0,0,0,0],"number":2}},{"caption":"Least squares estimates for a simple linear regression","key":"thm-lss","order":{"section":[1,6,0,0,0,0,0],"number":1}},{"caption":"R^2","key":"thm-r2","order":{"section":[1,11,0,0,0,0,0],"number":3}},{"caption":"Examples of a linear models: A) y_i = x_1 + e_i, B) x_1 + I_{x_i} + e_i C) y_i = x_i^2 + e_i, D) y_i = x + x_i^3 + e_i showing that linear models can get more complex and/or capture more than a straight line relationship.","key":"fig-linear-adv","order":{"section":[1,3,0,0,0,0,0],"number":3}},{"caption":"","key":"eq-lm","order":{"section":[1,5,0,0,0,0,0],"number":1}}],"headings":["why-linear-models","statistical-vs.-deterministic-relationship","what-linear-models-are-and-are-not","terminology","simple-linear-regression","weight-and-plasma-volume","least-squares","least-squares-estimates-for-a-simple-linear-regression","least-squares-1","intercept-and-slope","hypothesis-testing","hypothesis-testing-1","vector-matrix-notations","vector-matrix-form-of-the-linear-model","least-squares-in-vector-matrix-notation","vector-matrix-notation","confidence-intervals-and-prediction-intervals","prediction-and-intervals","assessing-model-fit","r2-summary-of-the-fitted-model","r2","r2-and-correlation-coefficient","r2-1","r2adj","r2adj-1","the-assumptions-of-a-linear-model","checking-assumptions","influential-observations"]}
{"options":{"chapters":true},"headings":["why-linear-models","statistical-vs.-deterministic-relationship","what-linear-models-are-and-are-not","terminology","simple-linear-regression","weight-and-plasma-volume","least-squares","least-squares-estimates-for-a-simple-linear-regression","least-squares-1","intercept-and-slope","hypothesis-testing","hypothesis-testing-1","vector-matrix-notations","vector-matrix-form-of-the-linear-model","least-squares-in-vector-matrix-notation","vector-matrix-notation","confidence-intervals-and-prediction-intervals","prediction-and-intervals","assessing-model-fit","r2-summary-of-the-fitted-model","r2","r2-and-correlation-coefficient","r2-1","r2adj","r2adj-1","the-assumptions-of-a-linear-model","checking-assumptions","influential-observations"],"entries":[{"key":"def-r2","caption":"R^2","order":{"section":[1,11,0,0,0,0,0],"number":2}},{"key":"eq-lm","caption":"","order":{"section":[1,5,0,0,0,0,0],"number":1}},{"key":"exm-lss","caption":"Least squares","order":{"section":[1,6,0,0,0,0,0],"number":2}},{"key":"thm-lss","caption":"Least squares estimates for a simple linear regression","order":{"section":[1,6,0,0,0,0,0],"number":1}},{"key":"fig-scatter","caption":"Scatter plot of weight vs. height for the 130 study participants based on the diabetes data set collected to understand the prevalence of obesity, diabetes, and other cardiovascular risk factors in central Virginia, USA.","order":{"section":[1,1,0,0,0,0,0],"number":1}},{"key":"fig-linear-adv","caption":"Examples of a linear models: A) y_i = x_1 + e_i, B) x_1 + I_{x_i} + e_i C) y_i = x_i^2 + e_i, D) y_i = x + x_i^3 + e_i showing that linear models can get more complex and/or capture more than a straight line relationship.","order":{"section":[1,3,0,0,0,0,0],"number":3}},{"key":"exm-vector-matrix-notation","caption":"vector-matrix-notation","order":{"section":[1,9,0,0,0,0,0],"number":4}},{"key":"thm-r2adj","caption":"R^2(adj)","order":{"section":[1,11,0,0,0,0,0],"number":4}},{"key":"exm-prediction-and-intervals","caption":"Prediction and intervals","order":{"section":[1,10,0,0,0,0,0],"number":5}},{"key":"thm-r2","caption":"R^2","order":{"section":[1,11,0,0,0,0,0],"number":3}},{"key":"fig-reg-errors","caption":"Scatter plot of the data shows that high plasma volume tends to be associated with high weight and vice verca. Linear regrssion gives the equation of the straight line (red) that best describes how the outcome changes with a change of exposure variable. Blue lines represent error terms, the vertical distances to the regression line","order":{"section":[1,6,0,0,0,0,0],"number":6}},{"key":"exm-simple-lm","caption":"Weight and plasma volume","order":{"section":[1,5,0,0,0,0,0],"number":1}},{"key":"fig-lm-parameters","caption":"Scatter plot of the data shows that high plasma volume tends to be associated with high weight and vice verca. Linear regression gives the equation of the straight line that best describes how the outcome changes (increase or decreases) with a change of exposure variable (in red)","order":{"section":[1,7,0,0,0,0,0],"number":7}},{"key":"thm-lss-vector-matrix","caption":"Least squares in vector-matrix notation","order":{"section":[1,9,0,0,0,0,0],"number":2}},{"key":"def-vector-matrix-lm","caption":"vector matrix form of the linear model","order":{"section":[1,9,0,0,0,0,0],"number":1}},{"key":"fig-lm-example-reg","caption":"Scatter plot of the data shows that high plasma volume tends to be associated with high weight and vice verca. Linear regression gives the equation of the straight line (red) that best describes how the outcome changes (increase or decreases) with a change of exposure variable","order":{"section":[1,5,0,0,0,0,0],"number":5}},{"key":"fig-lm-intro-example","caption":"Scatter plot of the data shows that high plasma volume tends to be associated with high weight and vice verca.","order":{"section":[1,5,0,0,0,0,0],"number":4}},{"key":"fig-relationship","caption":"Deterministic vs. statistical relationship: a) deterministic: equation exactly describes the relationship between the two variables e.g. Ferenheit and Celcius relationship, b) statistical relationship between x and y is not perfect (increasing relationship), c) statistical relationship between x and y is not perfect (decreasing relationship), d) random signal","order":{"section":[1,2,0,0,0,0,0],"number":2}},{"key":"exm-hypothesis-testing","caption":"Hypothesis testing","order":{"section":[1,8,0,0,0,0,0],"number":3}}]}
4 changes: 2 additions & 2 deletions session-lm/docs/lm-coeff.html
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ <h2 data-number="3.2" class="anchored" data-anchor-id="example-multiple-regressi
</ul>
<p><strong>Specific interpretation</strong></p>
<ul>
<li>Obviously there is difference between decrease of 0.9 BMI and decrease of 0.9 in BMI (alternative model).</li>
<li>Obviously there is difference between decrease of 0.9 BMI and decrease of 0.06 in BMI (alternative model).</li>
<li>Our interpretations need to be more specific and we say that <strong>a unit increase in <span class="math inline">\(x\)</span> with other predictors held constant will produce a change equal to <span class="math inline">\(\hat{\beta}\)</span> in the response <span class="math inline">\(y\)</span></strong></li>
<li>Often it may be quite unrealistic to be able to control other variables and keep them constant and for our alternative model, a change in <code>hdl</code> would also imply a change in total cholesterol <code>chol</code>.</li>
<li>Further, our explanation contains <strong>no notation of causation</strong>.</li>
Expand Down Expand Up @@ -590,7 +590,7 @@ <h2 data-number="3.4" class="anchored" data-anchor-id="example-categorical-numer
\end{array}
\right.
\end{equation}\]</span></p>
<p>and <span class="math inline">\(x_{2,i}\)</span> is the <code>heigth</code> of person <span class="math inline">\(i\)</span>.</p>
<p>and <span class="math inline">\(x_{2,i}\)</span> is the <code>height</code> of person <span class="math inline">\(i\)</span>.</p>
<p>In <code>R</code> we write:</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="co"># fit linear model and print model summary</span></span>
Expand Down
Binary file modified session-lm/docs/lm-coeff_files/figure-html/unnamed-chunk-17-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified session-lm/docs/lm-intro_files/figure-html/fig-linear-adv-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified session-lm/docs/lm-intro_files/figure-html/fig-relationship-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified session-lm/docs/lm-reg-cls_files/figure-html/unnamed-chunk-9-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3ca8fd0

Please sign in to comment.