MATHHX A

MATHHX A

\(\newcommand{\footnotename}{footnote}\) \(\def \LWRfootnote {1}\) \(\newcommand {\footnote }[2][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\newcommand {\footnotemark }[1][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\let \LWRorighspace \hspace \) \(\renewcommand {\hspace }{\ifstar \LWRorighspace \LWRorighspace }\) \(\newcommand {\TextOrMath }[2]{#2}\) \(\newcommand {\mathnormal }[1]{{#1}}\) \(\newcommand \ensuremath [1]{#1}\) \(\newcommand {\LWRframebox }[2][]{\fbox {#2}} \newcommand {\framebox }[1][]{\LWRframebox } \) \(\newcommand {\setlength }[2]{}\) \(\newcommand {\addtolength }[2]{}\) \(\newcommand {\setcounter }[2]{}\) \(\newcommand {\addtocounter }[2]{}\) \(\newcommand {\arabic }[1]{}\) \(\newcommand {\number }[1]{}\) \(\newcommand {\noalign }[1]{\text {#1}\notag \\}\) \(\newcommand {\cline }[1]{}\) \(\newcommand {\directlua }[1]{\text {(directlua)}}\) \(\newcommand {\luatexdirectlua }[1]{\text {(directlua)}}\) \(\newcommand {\protect }{}\) \(\def \LWRabsorbnumber #1 {}\) \(\def \LWRabsorbquotenumber "#1 {}\) \(\newcommand {\LWRabsorboption }[1][]{}\) \(\newcommand {\LWRabsorbtwooptions }[1][]{\LWRabsorboption }\) \(\def \mathchar {\ifnextchar "\LWRabsorbquotenumber \LWRabsorbnumber }\) \(\def \mathcode #1={\mathchar }\) \(\let \delcode \mathcode \) \(\let \delimiter \mathchar \) \(\def \oe {\unicode {x0153}}\) \(\def \OE {\unicode {x0152}}\) \(\def \ae {\unicode {x00E6}}\) \(\def \AE {\unicode {x00C6}}\) \(\def \aa {\unicode {x00E5}}\) \(\def \AA {\unicode {x00C5}}\) \(\def \o {\unicode {x00F8}}\) \(\def \O {\unicode {x00D8}}\) \(\def \l {\unicode {x0142}}\) \(\def \L {\unicode {x0141}}\) \(\def \ss {\unicode {x00DF}}\) \(\def \SS {\unicode {x1E9E}}\) \(\def \dag {\unicode {x2020}}\) \(\def \ddag {\unicode {x2021}}\) \(\def \P {\unicode {x00B6}}\) \(\def \copyright {\unicode {x00A9}}\) \(\def \pounds {\unicode {x00A3}}\) \(\let \LWRref \ref \) \(\renewcommand {\ref }{\ifstar \LWRref \LWRref }\) \( \newcommand {\multicolumn }[3]{#3}\) \(\require {textcomp}\) \(\require {colortbl}\) \(\let \LWRorigcolumncolor \columncolor \) \(\renewcommand {\columncolor }[2][named]{\LWRorigcolumncolor [#1]{#2}\LWRabsorbtwooptions }\) \(\let \LWRorigrowcolor \rowcolor \) \(\renewcommand {\rowcolor }[2][named]{\LWRorigrowcolor [#1]{#2}\LWRabsorbtwooptions }\) \(\let \LWRorigcellcolor \cellcolor \) \(\renewcommand {\cellcolor }[2][named]{\LWRorigcellcolor [#1]{#2}\LWRabsorbtwooptions }\) \(\newcommand {\tothe }[1]{^{#1}}\) \(\newcommand {\raiseto }[2]{{#2}^{#1}}\) \(\newcommand {\LWRsiunitxEND }{}\) \(\def \LWRsiunitxang #1;#2;#3;#4\LWRsiunitxEND {\ifblank {#1}{}{\num {#1}\degree }\ifblank {#2}{}{\num {#2}^{\unicode {x2032}}}\ifblank {#3}{}{\num {#3}^{\unicode {x2033}}}}\) \(\newcommand {\ang }[2][]{\LWRsiunitxang #2;;;\LWRsiunitxEND }\) \(\def \LWRsiunitxdistribunit {}\) \(\newcommand {\LWRsiunitxENDTWO }{}\) \(\def \LWRsiunitxprintdecimalsubtwo #1,#2,#3\LWRsiunitxENDTWO {\ifblank {#1}{0}{\mathrm {#1}}\ifblank {#2}{}{{\LWRsiunitxdecimal }\mathrm {#2}}}\) \(\def \LWRsiunitxprintdecimalsub #1.#2.#3\LWRsiunitxEND {\LWRsiunitxprintdecimalsubtwo #1,,\LWRsiunitxENDTWO \ifblank {#2}{}{{\LWRsiunitxdecimal }\LWRsiunitxprintdecimalsubtwo #2,,\LWRsiunitxENDTWO }}\) \(\newcommand {\LWRsiunitxprintdecimal }[1]{\LWRsiunitxprintdecimalsub #1...\LWRsiunitxEND }\) \(\def \LWRsiunitxnumplus #1+#2+#3\LWRsiunitxEND {\ifblank {#2}{\LWRsiunitxprintdecimal {#1}}{\ifblank {#1}{\LWRsiunitxprintdecimal {#2}}{\LWRsiunitxprintdecimal {#1}\unicode {x02B}\LWRsiunitxprintdecimal {#2}}}\LWRsiunitxdistribunit }\) \(\def \LWRsiunitxnumminus #1-#2-#3\LWRsiunitxEND {\ifblank {#2}{\LWRsiunitxnumplus #1+++\LWRsiunitxEND }{\ifblank {#1}{}{\LWRsiunitxprintdecimal {#1}}\unicode {x02212}\LWRsiunitxprintdecimal {#2}\LWRsiunitxdistribunit }}\) \(\def \LWRsiunitxnumpmmacro #1\pm #2\pm #3\LWRsiunitxEND {\ifblank {#2}{\LWRsiunitxnumminus #1---\LWRsiunitxEND }{\LWRsiunitxprintdecimal {#1}\unicode {x0B1}\LWRsiunitxprintdecimal {#2}\LWRsiunitxdistribunit }}\) \(\def \LWRsiunitxnumpm #1+-#2+-#3\LWRsiunitxEND {\ifblank {#2}{\LWRsiunitxnumpmmacro #1\pm \pm \pm \LWRsiunitxEND }{\LWRsiunitxprintdecimal {#1}\unicode {x0B1}\LWRsiunitxprintdecimal {#2}\LWRsiunitxdistribunit }}\) \(\newcommand {\LWRsiunitxnumscientific }[2]{\ifblank {#1}{}{\ifstrequal {#1}{-}{-}{\LWRsiunitxprintdecimal {#1}\times }}10^{\LWRsiunitxprintdecimal {#2}}\LWRsiunitxdistribunit }\) \(\def \LWRsiunitxnumD #1D#2D#3\LWRsiunitxEND {\ifblank {#2}{\LWRsiunitxnumpm #1+-+-\LWRsiunitxEND }{\mathrm {\LWRsiunitxnumscientific {#1}{#2}}}}\) \(\def \LWRsiunitxnumd #1d#2d#3\LWRsiunitxEND {\ifblank {#2}{\LWRsiunitxnumD #1DDD\LWRsiunitxEND }{\mathrm {\LWRsiunitxnumscientific {#1}{#2}}}}\) \(\def \LWRsiunitxnumE #1E#2E#3\LWRsiunitxEND {\ifblank {#2}{\LWRsiunitxnumd #1ddd\LWRsiunitxEND }{\mathrm {\LWRsiunitxnumscientific {#1}{#2}}}}\) \(\def \LWRsiunitxnume #1e#2e#3\LWRsiunitxEND {\ifblank {#2}{\LWRsiunitxnumE #1EEE\LWRsiunitxEND }{\mathrm {\LWRsiunitxnumscientific {#1}{#2}}}}\) \(\def \LWRsiunitxnumx #1x#2x#3x#4\LWRsiunitxEND {\ifblank {#2}{\LWRsiunitxnume #1eee\LWRsiunitxEND }{\ifblank {#3}{\LWRsiunitxnume #1eee\LWRsiunitxEND \times \LWRsiunitxnume #2eee\LWRsiunitxEND }{\LWRsiunitxnume #1eee\LWRsiunitxEND \times \LWRsiunitxnume #2eee\LWRsiunitxEND \times \LWRsiunitxnume #3eee\LWRsiunitxEND }}}\) \(\newcommand {\num }[2][]{\LWRsiunitxnumx #2xxxxx\LWRsiunitxEND }\) \(\newcommand {\si }[2][]{\mathrm {\gsubstitute {#2}{~}{\,}}}\) \(\def \LWRsiunitxSIopt #1[#2]#3{\def \LWRsiunitxdistribunit {\,\si {#3}}{#2}\num {#1}\def \LWRsiunitxdistribunit {}}\) \(\newcommand {\LWRsiunitxSI }[2]{\def \LWRsiunitxdistribunit {\,\si {#2}}\num {#1}\def \LWRsiunitxdistribunit {}}\) \(\newcommand {\SI }[2][]{\ifnextchar [{\LWRsiunitxSIopt {#2}}{\LWRsiunitxSI {#2}}}\) \(\newcommand {\numlist }[2][]{\text {#2}}\) \(\newcommand {\numrange }[3][]{\num {#2}\ \LWRsiunitxrangephrase \ \num {#3}}\) \(\newcommand {\SIlist }[3][]{\text {#2}\,\si {#3}}\) \(\newcommand {\SIrange }[4][]{\num {#2}\,#4\ \LWRsiunitxrangephrase \ \num {#3}\,#4}\) \(\newcommand {\tablenum }[2][]{\mathrm {#2}}\) \(\newcommand {\ampere }{\mathrm {A}}\) \(\newcommand {\candela }{\mathrm {cd}}\) \(\newcommand {\kelvin }{\mathrm {K}}\) \(\newcommand {\kilogram }{\mathrm {kg}}\) \(\newcommand {\metre }{\mathrm {m}}\) \(\newcommand {\mole }{\mathrm {mol}}\) \(\newcommand {\second }{\mathrm {s}}\) \(\newcommand {\becquerel }{\mathrm {Bq}}\) \(\newcommand {\degreeCelsius }{\unicode {x2103}}\) \(\newcommand {\coulomb }{\mathrm {C}}\) \(\newcommand {\farad }{\mathrm {F}}\) \(\newcommand {\gray }{\mathrm {Gy}}\) \(\newcommand {\hertz }{\mathrm {Hz}}\) \(\newcommand {\henry }{\mathrm {H}}\) \(\newcommand {\joule }{\mathrm {J}}\) \(\newcommand {\katal }{\mathrm {kat}}\) \(\newcommand {\lumen }{\mathrm {lm}}\) \(\newcommand {\lux }{\mathrm {lx}}\) \(\newcommand {\newton }{\mathrm {N}}\) \(\newcommand {\ohm }{\mathrm {\Omega }}\) \(\newcommand {\pascal }{\mathrm {Pa}}\) \(\newcommand {\radian }{\mathrm {rad}}\) \(\newcommand {\siemens }{\mathrm {S}}\) \(\newcommand {\sievert }{\mathrm {Sv}}\) \(\newcommand {\steradian }{\mathrm {sr}}\) \(\newcommand {\tesla }{\mathrm {T}}\) \(\newcommand {\volt }{\mathrm {V}}\) \(\newcommand {\watt }{\mathrm {W}}\) \(\newcommand {\weber }{\mathrm {Wb}}\) \(\newcommand {\day }{\mathrm {d}}\) \(\newcommand {\degree }{\mathrm {^\circ }}\) \(\newcommand {\hectare }{\mathrm {ha}}\) \(\newcommand {\hour }{\mathrm {h}}\) \(\newcommand {\litre }{\mathrm {l}}\) \(\newcommand {\liter }{\mathrm {L}}\) \(\newcommand {\arcminute }{^\prime }\) \(\newcommand {\minute }{\mathrm {min}}\) \(\newcommand {\arcsecond }{^{\prime \prime }}\) \(\newcommand {\tonne }{\mathrm {t}}\) \(\newcommand {\astronomicalunit }{au}\) \(\newcommand {\atomicmassunit }{u}\) \(\newcommand {\bohr }{\mathit {a}_0}\) \(\newcommand {\clight }{\mathit {c}_0}\) \(\newcommand {\dalton }{\mathrm {D}_\mathrm {a}}\) \(\newcommand {\electronmass }{\mathit {m}_{\mathrm {e}}}\) \(\newcommand {\electronvolt }{\mathrm {eV}}\) \(\newcommand {\elementarycharge }{\mathit {e}}\) \(\newcommand {\hartree }{\mathit {E}_{\mathrm {h}}}\) \(\newcommand {\planckbar }{\mathit {\unicode {x210F}}}\) \(\newcommand {\angstrom }{\mathrm {\unicode {x212B}}}\) \(\let \LWRorigbar \bar \) \(\newcommand {\barn }{\mathrm {b}}\) \(\newcommand {\bel }{\mathrm {B}}\) \(\newcommand {\decibel }{\mathrm {dB}}\) \(\newcommand {\knot }{\mathrm {kn}}\) \(\newcommand {\mmHg }{\mathrm {mmHg}}\) \(\newcommand {\nauticalmile }{\mathrm {M}}\) \(\newcommand {\neper }{\mathrm {Np}}\) \(\newcommand {\yocto }{\mathrm {y}}\) \(\newcommand {\zepto }{\mathrm {z}}\) \(\newcommand {\atto }{\mathrm {a}}\) \(\newcommand {\femto }{\mathrm {f}}\) \(\newcommand {\pico }{\mathrm {p}}\) \(\newcommand {\nano }{\mathrm {n}}\) \(\newcommand {\micro }{\mathrm {\unicode {x00B5}}}\) \(\newcommand {\milli }{\mathrm {m}}\) \(\newcommand {\centi }{\mathrm {c}}\) \(\newcommand {\deci }{\mathrm {d}}\) \(\newcommand {\deca }{\mathrm {da}}\) \(\newcommand {\hecto }{\mathrm {h}}\) \(\newcommand {\kilo }{\mathrm {k}}\) \(\newcommand {\mega }{\mathrm {M}}\) \(\newcommand {\giga }{\mathrm {G}}\) \(\newcommand {\tera }{\mathrm {T}}\) \(\newcommand {\peta }{\mathrm {P}}\) \(\newcommand {\exa }{\mathrm {E}}\) \(\newcommand {\zetta }{\mathrm {Z}}\) \(\newcommand {\yotta }{\mathrm {Y}}\) \(\newcommand {\percent }{\mathrm {\%}}\) \(\newcommand {\meter }{\mathrm {m}}\) \(\newcommand {\metre }{\mathrm {m}}\) \(\newcommand {\gram }{\mathrm {g}}\) \(\newcommand {\kg }{\kilo \gram }\) \(\newcommand {\of }[1]{_{\mathrm {#1}}}\) \(\newcommand {\squared }{^2}\) \(\newcommand {\square }[1]{\mathrm {#1}^2}\) \(\newcommand {\cubed }{^3}\) \(\newcommand {\cubic }[1]{\mathrm {#1}^3}\) \(\newcommand {\per }{\,\mathrm {/}}\) \(\newcommand {\celsius }{\unicode {x2103}}\) \(\newcommand {\fg }{\femto \gram }\) \(\newcommand {\pg }{\pico \gram }\) \(\newcommand {\ng }{\nano \gram }\) \(\newcommand {\ug }{\micro \gram }\) \(\newcommand {\mg }{\milli \gram }\) \(\newcommand {\g }{\gram }\) \(\newcommand {\kg }{\kilo \gram }\) \(\newcommand {\amu }{\mathrm {u}}\) \(\newcommand {\nm }{\nano \metre }\) \(\newcommand {\um }{\micro \metre }\) \(\newcommand {\mm }{\milli \metre }\) \(\newcommand {\cm }{\centi \metre }\) \(\newcommand {\dm }{\deci \metre }\) \(\newcommand {\m }{\metre }\) \(\newcommand {\km }{\kilo \metre }\) \(\newcommand {\as }{\atto \second }\) \(\newcommand {\fs }{\femto \second }\) \(\newcommand {\ps }{\pico \second }\) \(\newcommand {\ns }{\nano \second }\) \(\newcommand {\us }{\micro \second }\) \(\newcommand {\ms }{\milli \second }\) \(\newcommand {\s }{\second }\) \(\newcommand {\fmol }{\femto \mol }\) \(\newcommand {\pmol }{\pico \mol }\) \(\newcommand {\nmol }{\nano \mol }\) \(\newcommand {\umol }{\micro \mol }\) \(\newcommand {\mmol }{\milli \mol }\) \(\newcommand {\mol }{\mol }\) \(\newcommand {\kmol }{\kilo \mol }\) \(\newcommand {\pA }{\pico \ampere }\) \(\newcommand {\nA }{\nano \ampere }\) \(\newcommand {\uA }{\micro \ampere }\) \(\newcommand {\mA }{\milli \ampere }\) \(\newcommand {\A }{\ampere }\) \(\newcommand {\kA }{\kilo \ampere }\) \(\newcommand {\ul }{\micro \litre }\) \(\newcommand {\ml }{\milli \litre }\) \(\newcommand {\l }{\litre }\) \(\newcommand {\hl }{\hecto \litre }\) \(\newcommand {\uL }{\micro \liter }\) \(\newcommand {\mL }{\milli \liter }\) \(\newcommand {\L }{\liter }\) \(\newcommand {\hL }{\hecto \liter }\) \(\newcommand {\mHz }{\milli \hertz }\) \(\newcommand {\Hz }{\hertz }\) \(\newcommand {\kHz }{\kilo \hertz }\) \(\newcommand {\MHz }{\mega \hertz }\) \(\newcommand {\GHz }{\giga \hertz }\) \(\newcommand {\THz }{\tera \hertz }\) \(\newcommand {\mN }{\milli \newton }\) \(\newcommand {\N }{\newton }\) \(\newcommand {\kN }{\kilo \newton }\) \(\newcommand {\MN }{\mega \newton }\) \(\newcommand {\Pa }{\pascal }\) \(\newcommand {\kPa }{\kilo \pascal }\) \(\newcommand {\MPa }{\mega \pascal }\) \(\newcommand {\GPa }{\giga \pascal }\) \(\newcommand {\mohm }{\milli \ohm }\) \(\newcommand {\kohm }{\kilo \ohm }\) \(\newcommand {\Mohm }{\mega \ohm }\) \(\newcommand {\pV }{\pico \volt }\) \(\newcommand {\nV }{\nano \volt }\) \(\newcommand {\uV }{\micro \volt }\) \(\newcommand {\mV }{\milli \volt }\) \(\newcommand {\V }{\volt }\) \(\newcommand {\kV }{\kilo \volt }\) \(\newcommand {\W }{\watt }\) \(\newcommand {\uW }{\micro \watt }\) \(\newcommand {\mW }{\milli \watt }\) \(\newcommand {\kW }{\kilo \watt }\) \(\newcommand {\MW }{\mega \watt }\) \(\newcommand {\GW }{\giga \watt }\) \(\newcommand {\J }{\joule }\) \(\newcommand {\uJ }{\micro \joule }\) \(\newcommand {\mJ }{\milli \joule }\) \(\newcommand {\kJ }{\kilo \joule }\) \(\newcommand {\eV }{\electronvolt }\) \(\newcommand {\meV }{\milli \electronvolt }\) \(\newcommand {\keV }{\kilo \electronvolt }\) \(\newcommand {\MeV }{\mega \electronvolt }\) \(\newcommand {\GeV }{\giga \electronvolt }\) \(\newcommand {\TeV }{\tera \electronvolt }\) \(\newcommand {\kWh }{\kilo \watt \hour }\) \(\newcommand {\F }{\farad }\) \(\newcommand {\fF }{\femto \farad }\) \(\newcommand {\pF }{\pico \farad }\) \(\newcommand {\K }{\mathrm {K}}\) \(\newcommand {\dB }{\mathrm {dB}}\) \(\newcommand {\kibi }{\mathrm {Ki}}\) \(\newcommand {\mebi }{\mathrm {Mi}}\) \(\newcommand {\gibi }{\mathrm {Gi}}\) \(\newcommand {\tebi }{\mathrm {Ti}}\) \(\newcommand {\pebi }{\mathrm {Pi}}\) \(\newcommand {\exbi }{\mathrm {Ei}}\) \(\newcommand {\zebi }{\mathrm {Zi}}\) \(\newcommand {\yobi }{\mathrm {Yi}}\) \(\let \unit \si \) \(\let \qty \SI \) \(\let \qtylist \SIlist \) \(\let \qtyrange \SIrange \) \(\let \numproduct \num \) \(\let \qtyproduct \SI \) \(\let \complexnum \num \) \(\newcommand {\complexqty }[3][]{(\complexnum {#2})\si {#3}}\) \(\newcommand {\mleft }{\left }\) \(\newcommand {\mright }{\right }\) \(\newcommand {\mleftright }{}\) \(\newcommand {\mleftrightrestore }{}\) \(\require {gensymb}\) \(\newcommand {\intertext }[1]{\text {#1}\notag \\}\) \(\let \Hat \hat \) \(\let \Check \check \) \(\let \Tilde \tilde \) \(\let \Acute \acute \) \(\let \Grave \grave \) \(\let \Dot \dot \) \(\let \Ddot \ddot \) \(\let \Breve \breve \) \(\let \Bar \bar \) \(\let \Vec \vec \) \(\require {cancel}\) \(\newcommand {\mathred }[1]{\textcolor [rgb]{1, 0, 0}{#1}}\) \(\newcommand {\mathgreen }[1]{\textcolor [rgb]{0,0.5,0}{#1}}\) \(\newcommand {\mathblue }[1]{\textcolor [rgb]{0,0,1}{#1}}\) \(\newcommand {\mathorange }[1]{\textcolor [rgb]{1,0.5,0}{#1}}\) \(\newcommand {\mathmagenta }[1]{\textcolor [cmyk]{0, 1, 1, 0.33}{#1}}\) \( \newcommand \ccancel [2][red]{\renewcommand \CancelColor {\color {#1}}\cancel {#2}} \) \(\newcommand {\Dom }{\operatorname {Dom}}\) \(\newcommand {\Ran }{\operatorname {Ran}}\) \(\newcommand {\Dm }{\operatorname {Dm}}\) \(\newcommand {\Vm }{\operatorname {Vm}}\) \(\newcommand {\Var }{\operatorname {Var}}\) \(\newcommand {\SD }{\operatorname {SD}}\) \(\newcommand {\ExV }{\operatorname {E}}\) \(\newcommand {\opointtext }{\textcolor {blue}{\circ }}\) \(\newcommand {\cpointtext }{\textcolor {blue}{\bullet }}\) \(\newcommand {\vectwo }[2]{\begin {pmatrix} #1 \\ #2 \end {pmatrix}}\) \(\newcommand {\tcbset }[1]{}\) \(\newcommand {\tcbsetforeverylayer }[1]{}\) \(\newcommand {\tcbox }[2][]{\boxed {\text {#2}}}\) \(\newcommand {\tcboxfit }[2][]{\boxed {#2}}\) \(\newcommand {\tcblower }{}\) \(\newcommand {\tcbline }{}\) \(\newcommand {\tcbtitle }{}\) \(\newcommand {\tcbsubtitle [2][]{\mathrm {#2}}}\) \(\newcommand {\tcboxmath }[2][]{\boxed {#2}}\) \(\newcommand {\tcbhighmath }[2][]{\boxed {#2}}\) \(\newcommand {\toprule }[1][]{\hline }\) \(\let \midrule \toprule \) \(\let \bottomrule \toprule \) \(\def \LWRbooktabscmidruleparen (#1)#2{}\) \(\newcommand {\LWRbooktabscmidrulenoparen }[1]{}\) \(\newcommand {\cmidrule }[1][]{\ifnextchar (\LWRbooktabscmidruleparen \LWRbooktabscmidrulenoparen }\) \(\newcommand {\morecmidrules }{}\) \(\newcommand {\specialrule }[3]{\hline }\) \(\newcommand {\addlinespace }[1][]{}\) \(\def \LWRsiunitxrangephrase {\TextOrMath { }{\ }\protect \mbox {to (numerical range)}\TextOrMath { }{\ }}\) \(\def \LWRsiunitxdecimal {.}\)

6.5 Mindste kvadraters metode

Vi er nu kommet til den mest spændende del. Vi skal se, hvordan man kan beregne en regressionsmodel i hånden.

Vi vil tage udgangspunkt i datasættet:

\(\begin {array}{ | c | c |} \hline x_i & y_i \\ \hline 2 & 5 \\ 4 & 3 \\ 6 & 7 \\ \hline \end {array}\)

Det er et meget lille datasæt, men der skal regnes meget, så derfor holder vi det simpelt.

Der findes flere metoder til at beregne regressionsmodeller. Her skal vi se på en metode som hedder ”mindste kvadraters metode”. Vi vil først se på ideen i metoden, og derefter udføre beregningerne. Vi starter med at tegne vores punkter ind sammen med en mulig regressionslinje (det er den vi skal bestemme) og residualerne som vi kalder \(e_1\), \(e_2\) og \(e_3\):

(-tikz- diagram)

Vi tegner nu kvadrater ud fra residualerne:

(-tikz- diagram)

Mindste kvadraters metode går ud på at bestemme den forskrift \(y=ax+b\) som gør kvadraternes samlede areal mindst muligt. Hvis vi kalder det \(i'\)te residual for \(e_i\), må dets areal være \(e_i^2\), så vi skal dermed bestemme \(a\) og \(b\) så

\begin{equation} \label {eq:(1)} e_1^2+e_2^2+e_3^2 \end{equation}

bliver mindst muligt.

Vi starter med at regne det første residual. Det må være givet ved \(y_1-\hat {y_1}\), hvor \(\hat {y_1}\) er den første \(y\)-værdi regnet ved brug af modellen, som vist her:

(-tikz- diagram)

Vi regner \(\hat {y_1}\) ved at sætte \(x_1=2\) (se tabellen) ind i den endnu ukendte model \(y=ax+b\):

\begin{align*} \hat {y_1} & = a\cdot x_1 + b \\ & = a\cdot 2 + b \\ & = 2a + b \\ \end{align*} I tabellen ses, at \(y_1=5\) og vi kan nu regne residualet:

\begin{align*} e_1 & = y_1-\hat {y_1} \\ & = 5 - (2a+b) \\ & = 5 -2a-b \end{align*}

Vi regner resten af residualerne på samme måde:

.
\(x_i\) \(y_i\) \(e_i\)
2 5 \(5 -2a-b\)
4 3 \(3-4a-b\)
6 7 \(7-6a-b\)

Vi regner så nu summen af de kvadrerede residualer som vi kalder for \(S\). Den bliver en funktion, fordi \(a\) og \(b\) stadig er ukendte.

\begin{align*} S(a,b) & = e_1^2+e_2^2+e_3^2 \\ & = (5 -2a-b)^2 + (3-4a-b)^2 + (7-6a-b)^2 \end{align*}

Vi husker at vi leder efter \(a\) og \(b\) som gør de kvadrerede residualer, altså \(S(a,b)\), mindst muligt. Åhhh bare vi dog havde en metode til at minimere en funktion i to variable... nej hov vent... Det har vi jo!!! Den lærte vi i sidste afsnit. Ifølge ?? skal vi sætte de partielle afledede lig nul. Vi starter med at bestemme de partielle afledede ved at differentiere \(S\) som en sammensat funktion.

\begin{align*} S'_a(a,b) & = 2(5-2a-b)(-2) + 2(3-4a-b)(-4) + 2(7-6a-b)(-6)\\ & =-4(5-2a-b) - 8(3-4a-b) - 12(7-6a-b) \\ & = -20 +8a +4b -24 +32a +8b -84+72a+12b \\ & = 112a + 24b -128 \end{align*}

\begin{align*} S'_b(a,b) & = 2(5-2a-b)(-1) + 2(3-4a-b)(-1) + 2(7-6a-b)(-1) \\ & = -2(5-2a-b) - 2(3-4a-b) - 2(7-6a-b) \\ & = -10+4a+2b -6+8a+2b -14+12a + 2b \\ & = 24a +6b -30 \end{align*}

Vi sætter nu de partielle afledede lig med nul:

\[ 112a + 24b -128 = 0 \quad \text {og} \quad 24a + 6b -30 = 0\]

Vi kan forsimple disse ligninger. Vi dividerer med \(8\) på begge sider i den første ligning og \(6\) på begge sider i den anden. Det er bare for at gøre det lidt mere simpelt at regne med:

\[ 14a + 3b - 16 = 0 \quad \text {og} \quad 4a + b -5 = 0\]

Vi har nu to ligninger med to ubekendte. Vi isolerer \(b\) i den anden ligning:

\begin{align*} 4a + b -5 & =0\\ b & = -4a + 5 \end{align*} og sætter ind på \(b\)’s plads i den første ligning

\begin{align*} 14a + 3b -16 &= 0\\ 14a + 3(-4a + 5) -16 & = 0\\ 14a - 12a+15 & = 16 \\ 2a & = 1 \\ a & = \frac {1}{2} \end{align*} Vi kan nu finde \(b\):

\begin{align*} b & = -4a + 5\\ & = -4\cdot \frac {1}{2}+5 \\ & = 3 \end{align*} Vi har nu fundet både \(a\) og \(b\) og derfor har vi fundet forskriften

\[y=\frac {1}{2}x + 3\]

Strengt taget har vi kun vist, at \((a,b)= (\frac {1}{2},3)\) er et stationært punkt, og vi mangler derfor at vise, at det rent faktisk er et minimumssted. Men hvis man tænker over, hvad \(S\) beskriver (kvadrerede afvigelser), er det ”rimelig oplagt”, at den må have et globalt minimum. Da der kun er ét stationært punkt, må det være det globale minimumssted, vi har fundet. Lidt tyndt argument måske…hvis du er utilfreds, så tjek ekstraafsnittet.

Øvelse 6.5.1

Betragt data:

\(\begin {array}{ | c | c |} \hline x_i & y_i \\ \hline 5 & 9 \\ 8 & 3 \\ 11 & 3 \\ \hline \end {array}\)

Du skal nu bestemme en lineær model for data. Jeg har delt det op i 3 bidder, så det bliver nemmere at identificere, hvad der er gået galt, når det er gået galt (for det gør det).

  • a) Bestem funktionen \(S(a,b)\) som beskriver summen af de kvadrerede residualer.

  • b) Bestem de partielle afledte for \(S\)

  • c) Bestem den lineære model.

 6.5.1

  • a) \(S(a,b)=(9-5a-b)^2+(3-8a-b)^2+(3-11a-b)^2\)

  • b) \(S'_a(a,b)=420a + 48b - 204\)
    \(S'_b(a,b) = 48a + 6b - 30\)

  • c) \(y=-x+13\)

Øvelse 6.5.2

Betragt data:

\(\begin {array}{ | c | c |} \hline x_i & y_i \\ \hline 0 & 0 \\ 1 & 1 \\ 2 & 4 \\ 3 & 5 \\ \hline \end {array}\)

Bestem ved beregning:

  • a) Funktionen \(S(a,b)\) som beskriver summen af de kvadrerede residualer.

  • b) De partielle afledte for \(S\).

  • c) En lineær model for data.

 6.5.2

  • a) \(S(a,b)=(-b)^2+(1-a-b)^2+(-2a-b+4)^2+(5-3a-b)^2\)

  • b) \(S'_a(a,b)= 28a + 12b - 48\)
    \(S'_b(a,b) = 12a + 8b - 20\)

  • c) \(y=1{,}8x-0{,}2\)

Ekstra

Har du lavet ekstraafsnittet i sidste afsnit, kan du rent faktisk tjekke, at det er et minimum vi finder når du laver regression. For datasættet øverst i afsnittet fandt vi:

\[ S'_a(a,b) = 112a + 24b -128 \quad \text {og} \quad S'_b(a,b) = 24a +6b -30\]

Vi vil lave andenordenstesten, så vi finder først de relevante partielle afledte af anden orden:

\[ S''_{aa}(a,b)=112 \quad ,\quad S''_{bb}(a,b) = 6, \quad \text {og} \quad S'_{ab}(a,b)=24 \]

Vi regner nu \(D\) for \(a=\frac {1}{2}\) og \(b=3\), som var der, hvor de partielle afledte var nul.

\begin{align*} D\left (\frac {1}{2},3\right ) & = S''_{aa}\left (\frac {1}{2},3\right )\cdot S''_{bb}\left (\frac {1}{2},3\right ) - S''_{ab}\left (\frac {1}{2},3\right )^2 \\ & = 112\cdot 6 - (24)^2\\ & = 96 \end{align*}

Da \(D\left (\frac {1}{2},3\right )>0\) og \(S''_{aa}\left (\frac {1}{2},3\right )>0\) har \(S\) minimum i \((a,b)=\left (\frac {1}{2},3\right )\).

Øvelse 6.5.3

I øvelse 6.5.2 fandt vi et stationært punkt.

  • a) Vis ved beregning det stationære punkt er et minimumssted.

 6.5.3

  • a) \(D=328>0\) og \(S''_{aa}(1{,}8;-0{,}2)=28>0\), så andenordenstesten afslører, at \(S\) har minimum i \((1{,}8;-0{,}2)\).