Skip to content
Snippets Groups Projects
Commit ea1baf09 authored by Eduardo E. R. Junior's avatar Eduardo E. R. Junior
Browse files

Adiciona app de regressão elaborado na feira de cursos 2015

parent 994c4f48
No related branches found
No related tags found
1 merge request!5Issue#5
##-------------------------------------------
## global.R
## Armazena os cinco conjuntos de dados e serem utilziados na aplicação.
da1 <- structure(list(x = c(2.26951294421792, 2.31386722036915, 2.19865708695442,
2.2718416065365, 2.06818586174616, 2.34242268082221, 2.13033376849501,
1.98227123303957, 1.93951925261862, 2.18943416340103, 2.12385164096709,
2.48855071650044, 2.12710479836481, 1.98227123303957, 2.19865708695442,
1.97772360528885, 1.96848294855394, 2.20980980578538, 1.98677173426624,
2.25767857486918, 1.79239168949825, 2.09691001300806, 2.26951294421792,
2.31806333496276, 2.07554696139253, 2.12385164096709, 2.25042000230889,
1.92941892571429, 2.38381536598043, 2.64542226934909, 2.17318626841227,
2.27875360095283, 1.90308998699194, 2.15271631110641, 1.95424250943932,
2.25297432534792, 1.79934054945358, 2.48945221029981, 2.34242268082221,
1.98227123303957, 2.05690485133647, 1.93282876690085, 2.38381536598043,
1.8750612633917, 2.00860017176192, 2.41830129131975, 1.89762709129044,
2.28564730890073, 2.35793484700045, 2.07918124604762, 2.41979058610636,
2.0899051114394, 2.31806333496276, 2.17609125905568, 2.07834804955536,
1.93449845124357, 2, 2.65224634100332, 1.85901814388889, 2.37657695705651,
2, 2.13033376849501, 1.95904139232109, 1.9731278535997, 2.25527250510331,
2.22530928172586, 2.11058971029925, 2.30535136944662, 2.2148438480477,
2.20139712432045, 2.37106786227174, 2.05717144154727, 2.23044892137827,
1.88326385958497, 2.39619934709574, 2.12385164096709, 2.13033376849501,
2.14597290280218, 2, 2.02530586526477, 1.99122607569249, 2.37839790094814,
2.18184358794477, 2.06445798922692, 2.02118929906994, 2.03342375548695,
2.26717172840301, 1.99563519459755, 2.30319605742049, 2.49415459401844,
2.02118929906994, 1.8750612633917, 2.20411998265593, 1.78532983501077,
2.14612803567824, 1.9731278535997, 1.97570746353718, 2.43136376415899,
2.11058971029925, 2.12710479836481, 1.79934054945358, 2.38560627359831,
2.07188200730613, 2.228272002124, 2.00432137378264, 1.81954393554187,
1.88649072517248, 1.88649072517248, 2.32221929473392, 1.97607473161987,
1.92941892571429, 2.11394335230684, 2.29666519026153, 1.99563519459755,
2.02530586526477, 2.16731733474818, 2.25527250510331, 1.98677173426624,
2.26481782300954, 2.24797326636181, 2.14301480025409, 2.6232492903979,
2.07554696139253, 2.07554696139253, 2.20411998265593, 1.98227123303957,
2.07918124604762, 2.15228834438306, 2.34242268082221, 2.34242268082221,
1.82607480270083, 2.07918124604762, 2.22530928172586, 2.39967372148104,
2.54406804435028, 2.07704069834246, 1.98227123303957, 2.59988307207369,
2.34242268082221, 2.38021124171161, 2.07554696139253, 2.06069784035361,
2.72916478969277, 2.30102999566398, 2.34242268082221, 2.52633927738984,
2.07554696139253, 2.78816837114117, 2.10037054511756, 1.79239168949825,
2.39794000867204, 2.00860017176192, 1.95904139232109, 1.97772360528885,
1.98227123303957, 1.79934054945358, 1.88649072517248, 2.23719173657514,
2.34194864641251, 2.00860017176192, 2.28555730900777, 2.28555730900777,
2.25767857486918, 2.54032947479087, 2.51587384371168, 2.11058971029925,
2.0899051114394, 2.29225607135648, 1.8926510338773, 2.19904173446148
), y = c(5.8750612633917, 6.31175386105575, 5.83884909073726,
5.8750612633917, 5.80277372529198, 5.9912260756925, 5.94448267215017,
5.89359533381988, 5.64345267648619, 5.84503599351341, 6.05557287924696,
6.44337252540488, 5.64345267648619, 5.87800447026803, 6.07371835034612,
5.7160033436348, 5.79934054945358, 5.99782308074573, 5.54406804435028,
6.15182934013187, 5.5854607295085, 5.78958071216443, 5.84509804001426,
6.25527250510331, 5.70757017609794, 6.07162061587781, 5.95424250943933,
5.64246452024212, 6.39794000867204, 6.62838893005031, 5.8750612633917,
5.8750612633917, 5.60042832573213, 5.89762709129044, 5.73239375982297,
5.95424250943933, 5.40654018043396, 6.45409142974485, 6.04139268515823,
5.87806773197336, 5.75579865697383, 5.72427586960079, 6.09691001300806,
5.66275783168157, 5.70757017609794, 6.10380372095596, 5.81291335664286,
6.11706901982914, 6.17609125905568, 5.74036268949424, 6.06069784035361,
5.62736585659273, 6.17026171539496, 5.63346845557959, 5.82077269664988,
5.65321251377534, 5.75141229799872, 6.39794000867204, 5.66275783168157,
5.97543180850926, 5.75659427401299, 5.74036268949424, 5.57401968638712,
5.71591981743358, 5.8750612633917, 6.03758584282662, 5.9030356967885,
5.91487181754005, 5.99782308074573, 5.82607480270083, 6.56818998621967,
5.63144376901317, 6.06069784035361, 5.857947311556, 6.29003461136252,
5.98677173426625, 5.80617997398389, 6.08545470125041, 5.66275783168157,
5.81291335664286, 5.73878055848437, 5.9912260756925, 5.90036712865647,
5.78532983501077, 5.74741180788642, 5.81291335664286, 5.8750612633917,
5.69897000433602, 6.04139268515823, 5.92941892571429, 5.84503599351341,
5.59659709562646, 5.96378782734556, 5.63346845557959, 5.83884909073726,
5.81291335664286, 5.68124123737559, 5.93951925261862, 5.50514997831991,
5.90036712865647, 5.53147891704226, 6.03342375548695, 5.76342799356294,
5.97772360528885, 5.72427586960079, 5.59659709562646, 5.64779359503524,
5.64788642066577, 6.01283722470517, 5.83569057149243, 5.75676538858497,
5.54282542695918, 6.13033376849501, 5.61909333062674, 5.63346845557959,
5.81291335664286, 6.04139268515823, 5.69897000433602, 6.04921802267018,
6, 5.90308998699194, 6.32221929473392, 5.81167284514892, 5.99564089741694,
6.11394335230684, 5.88081359228079, 5.77085201164214, 5.8750612633917,
6.04139229034488, 6.29666519026153, 5.47421626407626, 6.11394335230684,
5.89209460269048, 6.07918124604763, 6.14612803567824, 5.77627757665637,
5.60745502321467, 6.73431968085901, 5.9912260756925, 6.34242268082221,
5.8521749044203, 5.80896139026791, 6.19033169817029, 5.8750612633917,
6.04139229034488, 6.02118929906994, 5.80949237693734, 6.26717172840301,
5.86332286012046, 5.53147891704226, 6.03342375548695, 5.77815125038364,
5.57401968638712, 5.67209785793572, 5.87806773197336, 5.5910646070265,
5.74429298312268, 6.04139268515823, 6.29885307640971, 5.81291335664286,
6.14432507840049, 6.19423674872383, 6.15182934013187, 6.21748394421391,
6.39792263654532, 5.95065688250451, 5.77451696572855, 5.65321251377534,
5.56702636615906, 6.07408468902824)), .Names = c("x", "y"), row.names = c(NA,
-170L), class = "data.frame")
da2 <- structure(list(x = c(4.59814682255627, 4.97096953789867, 7.82927702219041,
7.14576871072934, 8.88560804899388, 9.25843076433627, 5.34379225324107,
8.57492245287521, 12.4895609639704, 5.34379225324107, 4.2874612264376,
6.02730056470214, 5.71661496858347, 6.77294599538694, 8.20209973753281,
7.14576871072934, 7.45645430684801, 11.4332299371669, 7.14576871072934,
6.02730056470214, 6.02730056470214, 10.3147617911397, 6.02730056470214,
7.45645430684801, 10.3147617911397, 9.25843076433627, 4.97096953789867,
7.45645430684801, 9.25843076433627, 3.5418157957528, 4.59814682255627,
5.34379225324107, 6.02730056470214, 10.0040761950211, 5.71661496858347,
5.34379225324107, 8.88560804899388, 6.02730056470214, 4.2874612264376,
8.57492245287521, 7.14576871072934, 6.77294599538694, 5.71661496858347,
4.97096953789867, 8.57492245287521, 7.14576871072934, 9.25843076433627,
12.8623836793128, 5.71661496858347, 7.14576871072934, 6.40012328004454,
3.9146385110952, 1.05633102680347, 2.85830748429174, 3.9146385110952,
4.97096953789867, 4.97096953789867, 6.40012328004454, 7.14576871072934,
9.25843076433627, 4.97096953789867, 2.54762188817307, 5.71661496858347,
5.71661496858347, 6.77294599538694, 2.85830748429174, 6.77294599538694,
3.1689930804104, 3.9146385110952, 3.5418157957528, 4.59814682255627,
5.34379225324107, 8.88560804899388, 9.25843076433627, 9.25843076433627,
8.88560804899388, 4.2874612264376, 6.40012328004454, 3.9146385110952,
3.1689930804104, 7.14576871072934, 4.2874612264376, 6.02730056470214,
7.14576871072934, 5.34379225324107, 4.97096953789867, 5.34379225324107,
7.45645430684801, 4.59814682255627, 4.59814682255627, 4.59814682255627,
5.71661496858347, 4.2874612264376, 8.57492245287521, 4.59814682255627,
4.2874612264376, 4.59814682255627, 2.85830748429174, 2.48548476894934,
6.40012328004454, 4.97096953789867, 5.34379225324107, 7.14576871072934,
7.14576871072934, 7.14576871072934, 6.02730056470214, 7.14576871072934,
6.40012328004454, 3.9146385110952, 4.59814682255627, 6.77294599538694,
6.40012328004454, 9.63125347967868, 8.88560804899388, 7.82927702219041,
6.02730056470214, 2.11266205360694, 4.97096953789867, 3.5418157957528,
6.02730056470214, 1.42915374214587, 3.9146385110952, 3.9146385110952,
4.2874612264376, 3.1689930804104, 1.73983933826453, 2.85830748429174,
4.59814682255627, 9.63125347967868, 6.77294599538694, 6.40012328004454,
6.77294599538694, 6.02730056470214, 9.25843076433627, 9.63125347967868,
3.9146385110952, 6.77294599538694, 7.14576871072934, 4.2874612264376,
8.57492245287521, 6.40012328004454, 6.40012328004454, 4.97096953789867,
7.82927702219041, 5.71661496858347, 6.40012328004454, 6.40012328004454,
10.3147617911397, 4.2874612264376, 8.20209973753281, 8.88560804899388,
4.97096953789867, 7.14576871072934), y = c(19.4444444444444,
22.2222222222222, 23.3333333333333, 16.6666666666667, 13.3333333333333,
18.8888888888889, 18.3333333333333, 15, 16.1111111111111, 20.5555555555556,
23.3333333333333, 20.5555555555556, 18.8888888888889, 20, 14.4444444444444,
17.7777777777778, 18.8888888888889, 13.8888888888889, 20, 16.6666666666667,
15, 22.7777777777778, 16.1111111111111, 16.1111111111111, 13.8888888888889,
14.4444444444444, 13.8888888888889, 19.4444444444444, 27.2222222222222,
26.1111111111111, 24.4444444444444, 25.5555555555556, 23.3333333333333,
19.4444444444444, 28.8888888888889, 29.4444444444444, 26.1111111111111,
27.7777777777778, 30.5555555555556, 32.2222222222222, 30.5555555555556,
33.8888888888889, 33.3333333333333, 27.7777777777778, 26.6666666666667,
26.1111111111111, 25, 22.2222222222222, 18.3333333333333, 22.7777777777778,
24.4444444444444, 25, 24.4444444444444, 24.4444444444444, 24.4444444444444,
23.8888888888889, 25.5555555555556, 22.7777777777778, 26.6666666666667,
25, 28.3333333333333, 28.8888888888889, 29.4444444444444, 27.2222222222222,
28.8888888888889, 28.3333333333333, 28.3333333333333, 31.1111111111111,
33.3333333333333, 33.3333333333333, 31.6666666666667, 27.7777777777778,
22.7777777777778, 27.2222222222222, 32.7777777777778, 26.6666666666667,
27.2222222222222, 27.7777777777778, 28.8888888888889, 30.5555555555556,
29.4444444444444, 23.3333333333333, 27.2222222222222, 27.7777777777778,
30, 29.4444444444444, 27.7777777777778, 30, 31.1111111111111,
30, 28.3333333333333, 27.2222222222222, 27.2222222222222, 27.2222222222222,
27.7777777777778, 30, 29.4444444444444, 30.5555555555556, 31.6666666666667,
32.2222222222222, 32.2222222222222, 33.3333333333333, 30, 30,
27.7777777777778, 26.6666666666667, 26.1111111111111, 25, 26.1111111111111,
24.4444444444444, 25.5555555555556, 25.5555555555556, 25, 22.2222222222222,
23.8888888888889, 26.1111111111111, 27.2222222222222, 30, 31.1111111111111,
36.1111111111111, 34.4444444444444, 35.5555555555556, 34.4444444444444,
32.7777777777778, 33.3333333333333, 33.8888888888889, 33.8888888888889,
30.5555555555556, 28.8888888888889, 26.6666666666667, 25.5555555555556,
23.8888888888889, 22.7777777777778, 27.2222222222222, 24.4444444444444,
25, 21.6666666666667, 21.6666666666667, 25.5555555555556, 19.4444444444444,
24.4444444444444, 20, 27.7777777777778, 17.7777777777778, 21.6666666666667,
27.2222222222222, 20.5555555555556, 17.2222222222222, 21.1111111111111,
25, 23.8888888888889, 24.4444444444444, 20)), .Names = c("x",
"y"), row.names = c(NA, -153L), class = "data.frame")
da3 <- structure(list(x = c(2.48548476894934, 2.48548476894934, 4.34959834566134,
4.34959834566134, 4.97096953789867, 5.59234073013601, 6.21371192237334,
6.21371192237334, 6.21371192237334, 6.83508311461067, 6.83508311461067,
7.45645430684801, 7.45645430684801, 7.45645430684801, 7.45645430684801,
8.07782549908534, 8.07782549908534, 8.07782549908534, 8.07782549908534,
8.69919669132267, 8.69919669132267, 8.69919669132267, 8.69919669132267,
9.32056788356001, 9.32056788356001, 9.32056788356001, 9.94193907579734,
9.94193907579734, 10.5633102680347, 10.5633102680347, 10.5633102680347,
11.184681460272, 11.184681460272, 11.184681460272, 11.184681460272,
11.8060526525093, 11.8060526525093, 11.8060526525093, 12.4274238447467,
12.4274238447467, 12.4274238447467, 12.4274238447467, 12.4274238447467,
13.6701662292213, 14.2915374214587, 14.912908613696, 14.912908613696,
14.912908613696, 14.912908613696, 15.5342798059333), y = c(0.60960741282614,
3.0480370641307, 1.21921482565228, 6.70568154108754, 4.87685930260912,
3.0480370641307, 5.48646671543526, 7.92489636673982, 10.3633260180444,
5.18166300902219, 8.53450377956596, 4.26725188978298, 6.0960741282614,
7.31528895391368, 8.53450377956596, 7.92489636673982, 10.3633260180444,
10.3633260180444, 14.0209704950012, 7.92489636673982, 10.9729334308705,
18.2882223847842, 24.3842965130456, 6.0960741282614, 7.92489636673982,
16.4594001463058, 9.75371860521824, 12.1921482565228, 9.75371860521824,
12.1921482565228, 15.2401853206535, 12.8017556693489, 17.0690075591319,
23.1650816873933, 25.6035113386979, 10.9729334308705, 14.0209704950012,
20.7266520360888, 9.75371860521824, 14.6305779078274, 15.8497927334796,
17.0690075591319, 19.5074372104365, 20.1170446232626, 16.4594001463058,
21.3362594489149, 28.0419409900024, 28.3467446964155, 36.5764447695684,
25.9083150451109)), .Names = c("x", "y"), row.names = c(NA, -50L
), class = "data.frame")
da4 <- structure(list(x = c(4.749, 5.298, 4.377, 5.382, 5.406, 4.443,
5.462, 3.738, 4.514, 6.459, 3.589, 3.676, 3.846, 4.296, 3.133,
3.708, 5.295, 4.376, 4.151, 3.924, 4.666, 4.293, 3.317, 5.333,
3.914, 6.423, 4.232, 4.517, 4.849, 4.168, 5.232, 5.505, 4.727,
4.254, 4.159, 4.649, 4.031, 5.939, 3.695, 3.867, 5.604, 4.447,
4.525, 5.419, 4.761, 3.234, 4.867, 3.657, 4.652, 4.963, 4.469,
4.237, 4.206, 3.428, 4.261, 6.124, 3.57, 4.664, 4.584, 3.765,
5.976, 4.073, 4.906, 7.208, 4.178, 5.152, 3.969, 4.997, 4.455,
4.428, 5.134, 4.757, 5.096, 5.117, 5.013, 3.781, 4.296, 3.256,
2.721, 3.665, 3.364, 5.092, 4.885, 5.063, 5.325, 3.417, 3.733,
4.207, 4.088, 4.825, 5.046, 5.306, 5.489, 5.165, 5.834, 3.677,
4.294, 5.048, 4.762, 4.736, 4.397, 3.961, 3.692, 3.878, 4.159,
3.784, 4.825, 4.35, 4.634, 5.447, 3.684, 5.969, 5.614, 3.644,
5.37, 4.238, 4.854, 7.53, 3.183, 4.807, 5.081, 3.838, 4.922,
4.376, 4.786, 4.161, 6.639, 4.06, 4.18, 4.647, 2.976, 2.987,
4.316, 3.971, 3.288, 4.567, 5.406, 3.703, 4.412, 4.832, 4.988,
4.651, 4.931, 4.885, 4.907, 4.699, 3.671, 3.77, 5.109, 4.829,
3.179, 4.359, 5.099, 6.108, 4.636, 3.854, 4.827, 4.151, 3.964,
3.998, 4.564, 8.474, 3.656, 5.482, 4.666, 4.007, 3.79, 4.248,
4.463, 5.022), y = c(177.66, 273.623, 152.141, 268.79, 258.82,
199.126, 256.809, 155.142, 172.367, 268.695, 182.056, 165.451,
150.73, 139.938, 119.783, 154.89, 194.313, 203.051, 188.663,
170.913, 234.613, 183.346, 129.969, 276.057, 131.436, 285.771,
218.135, 187.686, 226.665, 179.516, 208.887, 236.158, 204.963,
178.954, 125.223, 172.024, 147.621, 304.072, 129.926, 160.714,
276.228, 193.014, 208.782, 275.6, 206.015, 121.515, 226.497,
148.148, 217.927, 243.897, 165.849, 135.8, 155.137, 116.831,
168.413, 294.642, 127.929, 185.704, 200.031, 110.78, 263.552,
135.371, 222.464, 439.345, 167.322, 241.098, 174.917, 216.96,
148.013, 179.336, 225.51, 187.134, 307.732, 256.811, 197.645,
115.001, 164.899, 123.825, 105.857, 115.595, 133.364, 215.073,
223.675, 219.519, 213.039, 129.134, 107.812, 178.026, 181.053,
233.775, 196.799, 184.675, 308.038, 237.208, 337.951, 132.054,
229.359, 246.795, 205.043, 187.541, 218.836, 159.568, 153.635,
153.211, 165.946, 159.605, 187.834, 185.606, 168.155, 250.682,
168.216, 288.47, 265.26, 151.391, 281.669, 162.575, 205.184,
465.371, 122.746, 258.667, 231.459, 189.646, 209.919, 172.165,
194.849, 176.711, 367.002, 162.191, 158.602, 195.351, 103.886,
122.486, 195.615, 170.872, 109.449, 208.601, 312.63, 154.414,
164.949, 214.373, 234.006, 196.793, 195.08, 224.451, 205.889,
191.309, 145.515, 133.473, 217.992, 197.319, 140.406, 206.67,
204.657, 311.289, 209.255, 150.665, 264.649, 184.543, 142.504,
153.621, 206.345, 619.822, 145.07, 262.244, 213.188, 180.135,
149.802, 154.582, 190.411, 225.564)), .Names = c("x", "y"), row.names = c(NA,
-170L), class = "data.frame")
da5 <- structure(list(x = c(31.442, 40.8, 56, 45, 50, 44, 30, 41, 55,
60, 42, 44.5, 38, 32, 32, 29, 33, 46, 44, 35.5, 37, 45.67, 50.149,
34.291, 20.457, 30.672, 17.866, 80, 31, 69.331, 54, 36.371, 61.8,
34, 34, 28.02, 24, 48.676, 58, 31.846, 40, 14.5, 19.854, 41,
26.1, 15.5, 39.5, 6, 46.5, 25, 43, 43.079, 10.5, 47, 24, 20,
9, 24, 50.4, 36.4, 44.31, 60, 20.7, 13.5, 33.387, 15.909, 42,
41, 16, 26, 19, 0.801, 7.4, 8.9, 29, 14.4, 23, 21.748, 14.376,
27, 1, 40, 20.5, 15, 4.1, 11.9, 10, 16, 20, 49.5, 53, 39, 64,
43, 57, 25, 40, 29.825, 36, 40, 29, 30.166, 30, 55.678, 43, 39,
19, 42.5, 27, 55, 10, 0.1, 40.112, 26, 11, 42.6, 45, 34, 31.5,
24, 39.074, 40, 37.5, 42.688, 19.158, 22, 19.6, 32.7, 13.8, 11,
30, 42, 58, 34.924, 39, 23.314, 24.71, 35.736, 37.046, 25.478,
54, 45.035, 61.1, 29, 37.747, 26, 20, 10, 50, 32.18, 31, 47,
0.1, 33, 22.401, 44.5, 32, 23, 10, 8, 12, 37, 31, 12.081, 17,
37.747, 51.661, 29, 34, 20, 17, 30, 66.9, 10.943, 15, 20.756,
10, 26.554, 0.5, 27, 34.006, 30, 11, 28.65, 28, 9.5, 4.9, 31.63,
10, 0.542, 27.67, 29, 21.78, 26, 15, 8, 11, 6, 8, 30.85, 23,
1.9, 3.9, 13.5, 8, 8, 12.5, 1.85, 18, 1.56, 4.65, 1.9, 35, 38.5,
43.5, 32, 34.5, 17.569, 30.3, 38, 25, 42, 32, 32.961, 61.5, 34.723,
39, 48.2, 40, 46.784, 28, 39.7, 38, 35, 27, 54, 64.4, 21, 25,
38.5, 40, 7, 22, 14, 39.1, 16, 41, 18, 25.673, 34.25, 35, 86,
19.6, 40, 38, 16.5, 34.183, 60.4, 19, 35, 32, 25, 24, 74, 29.27,
3.15, 39, 10, 30, 15, 22, 29.775, 16, 19, 28, 39, 16, 35, 51,
0.1, 13, 38, 25, 13, 5.8, 42.93, 30.584, 46, 38.5, 38.1, 13,
30, 54, 0.1, 48, 8, 45, 19.453, 15, 24.2, 35, 32, 27, 25, 41,
29, 44, 18.219, 20.208, 37, 22, 37, 0.1, 40.663, 28, 31, 55.5,
40, 16.333, 18, 13.224, 5, 46, 10.5, 35.092, 42, 15, 46, 30.642,
2, 9, 14.393, 6, 4.6, 0.1, 8.3, 9.6, 45, 0.1, 4, 5.8, 13, 0.1,
29, 16.034, 2, 8, 6.5, 4.567, 11.2, 0.9, 3.139, 6, 0.1, 35, 45,
33, 78, 26.84, 15, 27.557, 19.5, 1.74, 6.6), y = c(41.99, 42.5,
42.9, 43.8, 43.999, 44.9, 45, 45.3, 45.5, 45.99, 46.2, 46.7,
46.9, 46.9, 46.99, 46.99, 46.999, 47, 47.49, 47.5, 47.7, 47.9,
47.99, 47.99, 47.99, 47.99, 48.49, 48.49, 48.5, 48.69, 48.9,
48.9, 49, 49.5, 49.7, 49.8, 49.8, 49.89, 49.9, 49.9, 49.9, 49.9,
49.99, 50, 50.3, 50.45, 50.5, 50.8, 50.89, 50.9, 50.99, 50.99,
50.999, 51, 51, 51.45, 51.5, 51.5, 51.7, 51.7, 51.9, 52.9, 52.9,
53, 53.9, 54.89, 54.899, 54.9, 54.99, 55, 55.9, 56.49, 56.8,
56.89, 56.9, 57, 57, 57.89, 57.89, 58, 58.8, 58.9, 58.9, 58.99,
59.8, 59.9, 59.999, 60, 68.5, 38, 42.5, 42.99, 42.99, 43.9, 45.7,
45.9, 46.5, 46.5, 46.59, 46.9, 46.9, 46.99, 46.99, 46.99, 47.5,
47.8, 47.9, 47.9, 47.9, 47.9, 47.9, 47.9, 47.99, 48, 48, 48.5,
48.8, 48.89, 48.9, 48.9, 48.99, 48.99, 48.99, 48.999, 49, 49.8,
49.8, 49.9, 49.9, 49.9, 49.9, 49.97, 49.99, 49.99, 49.99, 49.99,
49.99, 49.99, 49.99, 49.99, 50, 50.89, 50.9, 50.9, 50.99, 51,
51.8, 51.9, 51.9, 51.9, 51.9, 51.9, 51.9, 51.99, 51.99, 51.99,
52, 52, 52.49, 52.5, 52.8, 52.9, 52.9, 52.9, 52.9, 52.99, 52.99,
52.999, 53, 53.9, 53.9, 53.9, 53.9, 53.9, 53.99, 54, 54.49, 54.9,
54.9, 54.9, 54.99, 54.999, 55, 55, 55.5, 55.5, 55.9, 55.999,
56, 56.49, 56.5, 56.9, 56.9, 56.9, 56.9, 56.99, 57.9, 57.9, 58,
58.8, 58.9, 59, 59.9, 59.95, 60, 61.5, 61.8, 61.99, 62.9, 62.99,
63, 67.9, 38.9, 41.1, 41.5, 41.9, 43.5, 43.5, 43.5, 43.89, 43.9,
43.9, 44, 44.49, 44.5, 44.9, 44.9, 45.69, 45.9, 45.99, 46, 46.5,
46.5, 46.8, 46.9, 46.9, 46.9, 46.9, 46.99, 46.99, 46.99999, 47.5,
47.5, 47.5, 47.8, 47.9, 47.9, 47.99, 47.99, 47.99, 48, 48, 48.5,
48.5, 48.5, 48.5, 48.59, 48.799, 48.9, 48.9, 48.9, 48.9, 48.9,
48.9, 48.99, 49, 49.8, 49.8, 49.8, 49.8, 49.9, 49.9, 49.9, 49.9,
49.9, 49.9, 49.9, 49.9, 49.9, 49.9, 49.9, 49.9, 49.9, 49.98,
49.99, 49.99, 49.99, 50.49, 50.5, 50.99, 50.99, 51, 51.6, 51.8,
51.8, 51.8, 51.9, 51.9, 51.9, 51.9, 51.9, 52, 52.8, 52.9, 52.9,
52.9, 52.99, 52.99, 53, 53, 53, 53, 53.499, 53.9, 53.99, 54,
54.5, 54.9, 54.9, 54.9, 54.9, 54.99, 54.99, 55, 55, 55, 55, 55.9,
55.9, 56, 56, 56, 56.8, 56.99, 56.999, 57, 57.5, 57.8, 57.9,
57.9, 58.5, 58.8, 58.9, 59.9, 59.9, 59.9, 59.9, 59.99, 60, 61.2,
61.9, 61.9, 62.5, 62.999, 46.8, 48.9, 48.99, 49.9, 52.9, 54.9,
55, 59.2, 61.9, 65)), .Names = c("x", "y"), row.names = c(NA,
-364L), class = "data.frame")
##-------------------------------------------
## server.R
library(shiny)
## Carrega template das aplicações elaboradas pelo projeto iguiR2
source("../template.R")
shinyServer(
function(input, output){
## Cabeçalho IGUIR2
output$header <- renderPrint({
template("TEMA")
})
## Objetos para armazenar as coordenadas
val <- reactiveValues(x = NULL, y = NULL, z = FALSE)
## Salva a posição dos dois pontos
observe({
if (is.null(input$plot_click)){
return()
}
isolate({
val$x <- c(val$x, input$plot_click$x)
val$y <- c(val$y, input$plot_click$y)
})
})
## Limpa os objetos reativos estimulado pelo `input$clear`
observe({
if (input$clear > 0){
val$x <- NULL
val$y <- NULL
val$z <- FALSE
}
})
## Habilita exibição estimulado pelo `input$result`
observe({
if (input$result > 0){
val$z <- TRUE
}
})
## Limpa o gráfico quando se troca de area em `input$area`
observeEvent(input$area, {
val$x <- NULL
val$y <- NULL
val$z <- FALSE
})
## Escolha do intervalo de confiança exibido
output$interval <- renderUI({
if(val$z) {
radioButtons("inter", "Intervalo de confiança",
c("Para a média" = "confidence",
"Para os dados" = "prediction"))
}
})
## Gráfico de dispersão
output$plot <- renderPlot({
## Conjunto de dados pré-definido
da <- switch(
input$area,
"Mercado Imobiliário" = da1,
"Meteorologia" = da2,
"Segurança Veicular" = da3,
"Relação Salarial" = da4,
"Mercado Automobilístico" = da5
)
## Labels definidos para cada conjunto
opt <- switch(
input$area,
"Mercado Imobiliário" =
list(ylab = "Preço de Venda Imovéis em log(R$)",
xlab = "Área dos Imóveis em log(m²)",
main = "Preço de Imovéis em Curitiba-PR"),
"Meteorologia" =
list(ylab = "Temperatura Máxima em °C",
xlab = "Velocidade Média do Vento em km/h",
main = "Temperatura Máxima em Nova York"),
"Segurança Veicular" = list(
ylab = "Distância Percorrida em metros",
xlab = "Velocidade do Veículo em km/h",
main = "Distância Para a Frenagem de um Veículo"),
"Relação Salarial" = list(
ylab = "Renda Familiar Per Capita Média em R$",
xlab = "Média de Anos Estudados de Pessoas a Partir de 25 anos",
main = "Renda Familiar per capita de Curitiba em 2000"),
"Mercado Automobilístico" = list(
ylab = "Preço dos Veículos em 1.000 R$",
xlab = "Quilometragem do Veículo em 1.000 Km",
main = "Preço de Carros Renault Duster")
)
## Gráfico de dispesão com linhas em azul nas extremidades
## dos dados
par(mar = c(4, 4, 1, 2), family = "Palatino")
plot(y ~ x, data = da, type = "n", main = opt$main,
xlab = opt$xlab, ylab = opt$ylab,
ylim = extendrange(da$y, f = 0.1)); grid()
points(y ~ x, data = da, pch = 19,
col = rgb(0.5, 0.5, 0.5, 0.5))
abline(v = extendrange(da$x, f = 0.015),
col = rgb(0, 0, 1, 0.15),
lwd = 10)
if(length(val$x) > 0){
points(x = val$x[1:2],
y = val$y[1:2],
pch = 19,
col = "red",
cex = 1.2)
segments(val$x[1], val$y[1],
val$x[2], val$y[2],
lwd = 2, col = "red")
}
if(val$z){
rg <- extendrange(da$x, f = 0.2)
pred <- expand.grid(
x = seq(rg[1], rg[2], length.out = 50))
model <- lm(y ~ x, data = da)
aux1 <- predict(model, newdata = pred,
interval = input$inter)
pred1 <- cbind(pred, aux1)
lines(fit ~ x, data = pred1, col = "blue", lwd = 2)
lines(lwr ~ x, data = pred1, lty=3, col = "blue")
lines(upr ~ x, data = pred1, lty = 3, col = "blue")
with(pred1,
polygon(c(x, rev(x)), c(lwr, rev(upr)),
col=rgb(0.1, 0.1, 0.1, 0.2), border = NA)
)
}
}, height = 500)
}
)
##-------------------------------------------
## ui.R
library(shiny)
text <- "<div style=\"text-align:justify;
padding-left: 20px; padding-right: 20px\">
<p> Este aplicativo exemplifica uma das técnicas mais utilizadas em
Estatística, a regressão linear simples.
</p>
<p>
O jogo consiste no objetivo traçar um reta, clicando em dois pontos
(um em cada extremidade em azul), que passe o mais perto possível de
todos os pontos. São apresentados exemplos de 5 áreas diferentes onde
esta técnica pode ser aplicada.
</p></div>
"
shinyUI(
fluidPage(
## Cabeçalho IGUIR2
htmlOutput("header"),
titlePanel("Regressão Simples"),
sidebarLayout(
sidebarPanel(
## Texto de apoio
HTML(text),
hr(),
## Grandes áreas paara escolha
selectInput(
"area", "Áreas",
c("Mercado Imobiliário",
"Meteorologia",
"Segurança Veicular",
"Relação Salarial",
"Mercado Automobilístico"),
multiple = FALSE,
selectize = FALSE,
selected = "Financeiro"),
hr(),
## Botões para visualizar o modelo e recomeçar o jogo
actionButton(inputId = "result",
label = "Ver Resultado",
class = "btn btn-info"),
actionButton(inputId = "clear",
label = "Recomeçar",
class = "btn btn-warning"),
hr(),
## Escolha do tipo de intervalo de confiança
uiOutput("interval")
),
mainPanel(
plotOutput("plot", click = "plot_click")
)
)
)
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment