<commit_before><!DOCTYPE HTML>
<html>
    <head>
        <title>General Linear Models</title>

        <script src="js/jquery.min.js"></script>
        <script src="js/jquery.scrolly.min.js"></script>
        <script src="js/jquery.scrollgress.min.js"></script>
        <script src="js/skel.min.js"></script>
        <script src="js/skel-layers.min.js"></script>
        <script src="js/init.js"></script>
        <script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>

        <noscript>
            <link rel="stylesheet" href="css/skel.css" />
            <link rel="stylesheet" href="css/style.css" />
            <link rel="stylesheet" href="css/style-wide.css" />
            <link rel="stylesheet" href="css/style-noscript.css" />
        </noscript>

        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script src="js/smoothscroll.js"></script>

        <link rel="stylesheet" type="text/css" media="screen"
        href="http://cdnjs.cloudflare.com/ajax/libs/fancybox/1.3.4/jquery.fancybox-1.3.4.css" />
        <style type="text/css">
            a.fancybox img {
                border: none;
            }
        </style>

        <script>
            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
            })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

            ga('create', 'UA-68428630-1', 'auto');
            ga('send', 'pageview');

        </script>

    </head>


    <body class="index">

       <!-- Header -->
        <header id="header" style="position: fixed; top: 0px; left: 0px; right: 0px; z-index: 1030;">
            <h1 id="logo"><a href="index.html">Home</a></h1>
            <nav id="nav">
                <ul>
                    <li><a href="#top" class="smoothScroll">^</a></li>
                    <li><a href="#contact" class="smoothScroll">Contact</a></li>
                </ul>
            </nav>
        </header>

        <!-- Main -->
        <article id="main">

            <!-- Emoji -->
            <div id="top">
                <section class="wrapper style3 container">

                    <header>
                        <h2><center>General Linear Models</center></h2>
                    </header>

                    <!-- Text -->
                    <p>
                        A <em>general linear model</em> describes a dependent
                        variable in terms of a linear combination of independent
                        variables and an error term.
                    </p>
                    <h3>Simple Linear Regression</h3>
                    <p>
                        A line can be described by the equation \(y = mx + b\),
                        where \(b\) is the \(y\)-intercept and \(m\) is the
                        slope. Simple linear regression uses this idea to
                        describe the <em>relationship</em> between two
                        variables&mdash;one dependent, the \(y\), and one
                        independent, the \(x\). Dependent variables are also
                        sometimes referred to as "response variables,"
                        "regressands," or "targets." The corresponding terms for
                        independent variables are "predictor variables,"
                        "regressors," or "features."
                    </p>
                    <p>
                        The objective is to specify a model that explains \(y\)
                        in terms of \(x\) in the <em>population</em> of
                        interest. A simple model can be specified as follows.
                    </p>
                    <p>
                        \[y = \beta_0 + \beta_1 x + \epsilon\]
                    </p>
                    <p>
                        In this specification&mdash;called the scalar
                        form&mdash;\(\beta_0\) represents the \(y\)-intercept
                        and \(\beta_1\) represents the slope. The \(\epsilon\),
                        which is called the error term, represents
                        <em>other</em> factors that affect \(y\). If the error
                        term is excluded, the implication is that the
                        relationship is exact or <em>deterministic</em>.
                        On the other hand, if we include the error term, we
                        imply that the relationship also contains a
                        <em>stochastic</em> component. For most, if not all,
                        applications of regression, the relationship between
                        the dependent and independent variables includes both
                        deterministic and stochastic parts.
                    </p>
                    <p>
                        The actual \(\beta\) values in the population are
                        unknown. However, they can be estimated using
                        data&mdash;preferrably a random sample from the
                        population. We use this data to find the line that
                        "best" fits it. Because each observation in our sample
                        has its own values, we use subscripts to denote them.
                    </p>
                    <p>
                        \[y_i = \beta_0 + \beta_1 x_i + \epsilon_i\]
                    </p>
                    <p>
                        Notice that the \(y\), \(x\), and \(\epsilon\) terms
                        have subscripts, but the \(\beta\)s do not. This implies
                        that there is a <em>single</em> \(y\)-intercept and
                        slope&mdash;the one from the population equation that
                        represents the "true" line.
                    </p>

                    <h3>Multiple Regression</h3>
                    <p>
                        Often, outcomes for our variable of interest, \(y\),
                        depend on two or more predictors. This is referred to as
                        a <em>multiple</em> linear regression model, which, for
                        the case of two variables, can be written as:
                    </p>
                    <p>
                        \[y_i = \beta_0 + \beta_1 x_{1i} + \beta_2 x_{2i} + \epsilon_i\]
                    </p>
                    <p>
                        As you might imagine, the scalar form gets unwiedly as
                        the number of independent variables increases. To deal
                        with this, we introduce an alternative way to express
                        our model.
                    </p>
                    <h3>Matrix Form</h3>
                    <p>
                        While the scalar form allows us to be explicit about
                        the regressors included in the model, it is often more
                        efficient to write the equation in matrix form. To
                        motivate the reasons why, consider the case where, for
                        our equation above, \(i = 1, 2, \ldots,n\).
                    </p>
                    <p>
                        \[y_1 = \beta_0 + \beta_1 x_{11} + \beta_2 x_{21} + \epsilon_1\]
                        \[y_2 = \beta_0 + \beta_1 x_{12} + \beta_2 x_{22} + \epsilon_2\]
                        \[\vdots\]
                        \[y_n = \beta_0 + \beta_1 x_{1n} + \beta_2 x_{2n} + \epsilon_n\]
                    </p>
                    <p>
                        Our <em>system</em> of \(n\) equations can, instead, be
                        represented in terms of matrix addition. Note that we've<commit_msg>Spelling<commit_after><!DOCTYPE HTML>
<html>
    <head>
        <title>General Linear Models</title>

        <script src="js/jquery.min.js"></script>
        <script src="js/jquery.scrolly.min.js"></script>
        <script src="js/jquery.scrollgress.min.js"></script>
        <script src="js/skel.min.js"></script>
        <script src="js/skel-layers.min.js"></script>
        <script src="js/init.js"></script>
        <script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>

        <noscript>
            <link rel="stylesheet" href="css/skel.css" />
            <link rel="stylesheet" href="css/style.css" />
            <link rel="stylesheet" href="css/style-wide.css" />
            <link rel="stylesheet" href="css/style-noscript.css" />
        </noscript>

        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script src="js/smoothscroll.js"></script>

        <link rel="stylesheet" type="text/css" media="screen"
        href="http://cdnjs.cloudflare.com/ajax/libs/fancybox/1.3.4/jquery.fancybox-1.3.4.css" />
        <style type="text/css">
            a.fancybox img {
                border: none;
            }
        </style>

        <script>
            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
            })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

            ga('create', 'UA-68428630-1', 'auto');
            ga('send', 'pageview');

        </script>

    </head>


    <body class="index">

       <!-- Header -->
        <header id="header" style="position: fixed; top: 0px; left: 0px; right: 0px; z-index: 1030;">
            <h1 id="logo"><a href="index.html">Home</a></h1>
            <nav id="nav">
                <ul>
                    <li><a href="#top" class="smoothScroll">^</a></li>
                    <li><a href="#contact" class="smoothScroll">Contact</a></li>
                </ul>
            </nav>
        </header>

        <!-- Main -->
        <article id="main">

            <!-- Emoji -->
            <div id="top">
                <section class="wrapper style3 container">

                    <header>
                        <h2><center>General Linear Models</center></h2>
                    </header>

                    <!-- Text -->
                    <p>
                        A <em>general linear model</em> describes a dependent
                        variable in terms of a linear combination of independent
                        variables and an error term.
                    </p>
                    <h3>Simple Linear Regression</h3>
                    <p>
                        A line can be described by the equation \(y = mx + b\),
                        where \(b\) is the \(y\)-intercept and \(m\) is the
                        slope. Simple linear regression uses this idea to
                        describe the <em>relationship</em> between two
                        variables&mdash;one dependent, the \(y\), and one
                        independent, the \(x\). Dependent variables are also
                        sometimes referred to as "response variables,"
                        "regressands," or "targets." The corresponding terms for
                        independent variables are "predictor variables,"
                        "regressors," or "features."
                    </p>
                    <p>
                        The objective is to specify a model that explains \(y\)
                        in terms of \(x\) in the <em>population</em> of
                        interest. A simple model can be specified as follows.
                    </p>
                    <p>
                        \[y = \beta_0 + \beta_1 x + \epsilon\]
                    </p>
                    <p>
                        In this specification&mdash;called the scalar
                        form&mdash;\(\beta_0\) represents the \(y\)-intercept
                        and \(\beta_1\) represents the slope. The \(\epsilon\),
                        which is called the error term, represents
                        <em>other</em> factors that affect \(y\). If the error
                        term is excluded, the implication is that the
                        relationship is exact or <em>deterministic</em>.
                        On the other hand, if we include the error term, we
                        imply that the relationship also contains a
                        <em>stochastic</em> component. For most, if not all,
                        applications of regression, the relationship between
                        the dependent and independent variables includes both
                        deterministic and stochastic parts.
                    </p>
                    <p>
                        The actual \(\beta\) values in the population are
                        unknown. However, they can be estimated using
                        data&mdash;preferably a random sample from the
                        population. We use this data to find the line that
                        "best" fits it. Because each observation in our sample
                        has its own values, we use subscripts to denote them.
                    </p>
                    <p>
                        \[y_i = \beta_0 + \beta_1 x_i + \epsilon_i\]
                    </p>
                    <p>
                        Notice that the \(y\), \(x\), and \(\epsilon\) terms
                        have subscripts, but the \(\beta\)s do not. This implies
                        that there is a <em>single</em> \(y\)-intercept and
                        slope&mdash;the one from the population equation that
                        represents the "true" line.
                    </p>

                    <h3>Multiple Regression</h3>
                    <p>
                        Often, outcomes for our variable of interest, \(y\),
                        depend on two or more predictors. This is referred to as
                        a <em>multiple</em> linear regression model, which, for
                        the case of two variables, can be written as:
                    </p>
                    <p>
                        \[y_i = \beta_0 + \beta_1 x_{1i} + \beta_2 x_{2i} + \epsilon_i\]
                    </p>
                    <p>
                        As you might imagine, the scalar form gets unwieldy as
                        the number of independent variables increases. To deal
                        with this, we introduce an alternative way to express
                        our model.
                    </p>
                    <h3>Matrix Form</h3>
                    <p>
                        While the scalar form allows us to be explicit about
                        the regressors included in the model, it is often more
                        efficient to write the equation in matrix form. To
                        motivate the reasons why, consider the case where, for
                        our equation above, \(i = 1, 2, \ldots,n\).
                    </p>
                    <p>
                        \[y_1 = \beta_0 + \beta_1 x_{11} + \beta_2 x_{21} + \epsilon_1\]
                        \[y_2 = \beta_0 + \beta_1 x_{12} + \beta_2 x_{22} + \epsilon_2\]
                        \[\vdots\]
                        \[y_n = \beta_0 + \beta_1 x_{1n} + \beta_2 x_{2n} + \epsilon_n\]
                    </p>
                    <p>
                        Our <em>system</em> of \(n\) equations can, instead, be
                        represented in terms of matrix addition. Note that we've
{'fraction_non_alphanumeric': 0.11560766515380737, 'fraction_numerical': 0.009455370650529501, 'mean_word_length': 1.198891198891199, 'pattern_counts': {'":': 0, '<': 239, '<?xml version=': 0, '>': 239, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3915646', 'n_tokens_mistral': 4239, 'n_tokens_neox': 3898, 'n_words': 1189}