Linear Correlation Coefficient and Linear Regression Fit
2020-05-25 01:02
This applet demonstrates calculating and visualizing the Pearson linear correlation coefficient. It displays data points in a scatter plot and draws the line of best fit using the FitLineY command. Users can intuitively observe the relationship between data clustering and the correlation coefficient, understanding linear correlation and its geometric meaning in statistics.
Loading the GeoGebra board and drawing, please wait…
<?xml version="1.0" encoding="utf-8"?>
<geogebra format="5.0" version="5.0.580.0" app="classic" platform="w" id="f8cc78ab-4210-440d-9543-b7e0a2109a92" xsi:noNamespaceSchemaLocation="https://ggb123.cn/apps/xsd/ggb.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<gui>
<window width="1334" height="536" />
<perspectives>
<perspective id="tmp">
<panes>
<pane location="" divider="0.01424287856071964" orientation="1" />
</panes>
<views>
<view id="4097" visible="false" inframe="false" stylebar="true" location="1,1,1,1" size="400" window="-156,231,770,529" />
<view id="4" toolbar="0 || 2020 , 2021 , 2022 , 66 || 2001 , 2003 , 2002 , 2004 , 2005 || 2040 , 2041 , 2042 , 2044 , 2043" visible="false" inframe="false" stylebar="true" location="1,1" size="300" window="100,100,600,400" />
<view id="8" toolbar="1001 | 1002 | 1003 || 1005 | 1004 || 1006 | 1007 | 1010 || 1008 1009 || 66 68 || 6" visible="false" inframe="false" stylebar="false" location="1,3" size="300" window="100,100,600,400" />
<view id="512" toolbar="0 | 1 501 5 19 , 67 | 2 15 45 18 , 7 37 | 514 3 9 , 13 44 , 47 | 16 | 551 550 11 , 20 22 21 23 , 55 56 57 , 12 | 69 | 510 511 , 512 513 | 533 531 , 534 532 , 522 523 , 537 536 , 535 | 521 520 | 36 , 38 49 560 | 571 30 29 570 31 33 | 17 | 540 40 41 42 , 27 28 35 , 6 , 502 | 100013 100015" visible="false" inframe="false" stylebar="false" location="1,1" size="800" window="100,100,600,400" />
<view id="1" visible="true" inframe="false" stylebar="true" location="1" size="1307" window="100,100,600,400" />
<view id="2" visible="true" inframe="false" stylebar="true" location="3" size="19" window="100,100,600,400" />
<view id="16" visible="false" inframe="false" stylebar="false" location="1" size="150" window="50,50,500,500" />
<view id="32" visible="false" inframe="false" stylebar="true" location="1" size="712" window="50,50,500,500" />
<view id="64" toolbar="0" visible="false" inframe="false" stylebar="true" location="1" size="150" window="50,50,500,500" />
<view id="128" visible="false" inframe="false" stylebar="false" location="1" size="480" window="50,50,500,500" />
<view id="70" toolbar="0 || 2020 || 2021 || 2022" visible="false" inframe="false" stylebar="true" location="1" size="150" window="50,50,500,500" />
<view id="43" visible="false" inframe="false" stylebar="false" location="1" size="450" window="50,50,500,500" />
</views>
<toolbar show="false" items="0 39 73 62 | 1 501 67 , 5 19 , 72 75 76 | 2 15 45 , 18 65 , 7 37 | 4 3 8 9 , 13 44 , 58 , 47 | 16 51 64 , 70 | 10 34 53 11 , 24 20 22 , 21 23 | 55 56 57 , 12 | 36 46 , 38 49 50 , 71 14 68 | 30 29 54 32 31 33 | 25 17 26 60 52 61 | 40 41 42 , 27 28 35 , 6 | | 100015 100014 100014 100013 100012 100010 100009 100010 100002 100003 100004 100005" position="1" help="false" />
<input show="false" cmd="true" top="true" />
<dockBar show="false" east="false" />
</perspective>
</perspectives>
<labelingStyle val="3"/>
<font size="12"/>
<consProtColumns col0="true" col1="true" col2="false" col3="false" col4="true" col5="true" col6="true" col7="false"/>
<consProtocol useColors="false" addIcons="false" showOnlyBreakpoints="false"/>
<consProtNavigationBar id="32" playButton="true" playDelay="2" protButton="true" consStep="18"/>
</gui>
<euclidianView>
<viewNumber viewNo="1"/>
<size width="1307" height="536"/>
<coordSystem xZero="471.1261829186328" yZero="356.8209726441344" scale="59.6769096181069" yscale="59.676899065771444"/>
<evSettings axes="false" grid="false" gridIsBold="false" pointCapturing="3" rightAngleStyle="1" checkboxSize="26" gridType="3"/>
<bgColor r="224" g="224" b="224"/>
<axesColor r="0" g="0" b="0"/>
<gridColor r="192" g="192" b="192"/>
<lineStyle axes="1" grid="0"/>
<labelStyle axes="0" serif="true"/>
<axis id="0" show="false" label="" unitLabel="" tickStyle="1" showNumbers="true"/>
<axis id="1" show="false" label="" unitLabel="" tickStyle="1" showNumbers="true"/>
</euclidianView>
<algebraView>
<mode val="1"/>
<auxiliary show="true"/>
</algebraView>
<kernel>
<continuous val="false"/>
<usePathAndRegionParameters val="true"/>
<decimals val="2"/>
<angleUnit val="degree"/>
<algebraStyle val="0" spreadsheet="0"/>
<coordStyle val="0"/>
</kernel>
<tableview min="-2" max="2" step="1"/>
<scripting blocked="true" disabled="false"/>
<construction title="" author="" date="">
<element type="point" label="A">
<show object="true" label="true" ev="4"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="1" playing="false"/>
<coords x="-1.8986755972223233" y="2.840478900509091" z="1"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
<element type="point" label="B">
<show object="true" label="true" ev="4"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="1" playing="false"/>
<coords x="2.6256873721040557" y="0.06797315633170316" z="1"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
<element type="point" label="C">
<show object="true" label="true" ev="4"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="1" playing="false"/>
<coords x="-0.12840556663325192" y="1.8629280181952765" z="1"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
<element type="point" label="D">
<show object="true" label="true"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="1" playing="false"/>
<coords x="0.6529038578684361" y="1.366858454603971" z="1"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
<element type="point" label="E">
<show object="true" label="true" ev="4"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="1" playing="false"/>
<coords x="1.0993663861551148" y="1.056814977359405" z="1"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
<element type="point" label="F">
<show object="true" label="true" ev="4"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="1" playing="false"/>
<coords x="1.496221966854385" y="0.8335836737433177" z="1"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
<element type="point" label="G">
<show object="true" label="true" ev="4"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="1" playing="false"/>
<coords x="0.8513316482180711" y="1.2056358464367969" z="1"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
<element type="point" label="H">
<show object="true" label="true" ev="4"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="1" playing="false"/>
<coords x="1.9674879689347682" y="0.5731471528578823" z="1"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
<element type="point" label="I">
<show object="true" label="true" ev="4"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="1" playing="false"/>
<coords x="-1.2893337831716325" y="2.6119756798351306" z="1"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
<element type="point" label="J">
<show object="true" label="true" ev="4"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="1" playing="false"/>
<coords x="-0.8323274226336144" y="2.139735690442279" z="1"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
<expression label="l1" exp="{A, B, C, D, E, F, G, H, I, J}" />
<element type="list" label="l1">
<show object="true" label="false"/>
<objColor r="0" g="100" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<lineStyle thickness="5" type="0" typeHidden="1"/>
<pointSize val="5"/>
<angleStyle val="0"/>
</element>
<command name="PMCC">
<input a0="l1"/>
<output a0="a"/>
</command>
<element type="numeric" label="a">
<value val="-0.9978527950580695"/>
<objColor r="0" g="0" b="0" alpha="0.10000000149011612"/>
</element>
<expression label="text1" exp=""相关系数r=" + (LaTeX[a]) + """ />
<element type="text" label="text1">
<show object="true" label="false" ev="40"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="4" size="36" style="0"/>
<absoluteScreenLocation x="7" y="6"/>
</element>
<command name="FitLineY">
<input a0="l1"/>
<output a0="f"/>
</command>
<element type="line" label="f">
<show object="true" label="false"/>
<condition showObject="b"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<coords x="-0.735191138398277" y="-1.20469745460668" z="2.0880246072318442"/>
<lineStyle thickness="9" type="0" typeHidden="1" opacity="178"/>
<eqnStyle style="explicit"/>
</element>
<element type="boolean" label="b">
<value val="false"/>
<show object="true" label="true"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelOffset x="25" y="95"/>
<labelMode val="3"/>
<checkbox fixed="true"/>
<caption val="$\huge 线性回归直线$"/>
</element>
<element type="point" label="K">
<show object="false" label="false" ev="4"/>
<objColor r="77" g="77" b="255" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<fixed val="true"/>
<coords x="5.337630627839916" y="2.9951340348652424" z="1"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
<element type="point" label="L">
<show object="false" label="false" ev="4"/>
<objColor r="77" g="77" b="255" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<fixed val="true"/>
<coords x="14.185533430560797" y="2.9951340348652424" z="1"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
<element type="image" label="pic1">
<file name="1ff02eecb63ed45288a557fc20651b2d/12.png"/>
<inBackground val="false"/>
<absoluteScreenLocation x="380" y="414"/> <show object="true" label="false"/>
<condition showObject="c"/>
<objColor r="0" g="0" b="0" alpha="1"/>
<layer val="0"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="0" playing="false"/>
</element>
<element type="boolean" label="c">
<value val="false"/>
<show object="true" label="true"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelOffset x="25" y="145"/>
<labelMode val="0"/>
<checkbox fixed="true"/>
<caption val="相关系数公式"/>
</element>
</construction>
</geogebra>