Svm Multi-Classification in R - r

I am using the SVM model for the classification of the data given below, but I don't know why I am getting this error. I have tried using two methods but both are not working. Please help me I am stuck for a very long. I have seen many posts here and tried to specify my model for classification but no results.
My data:
structure(list(pCAMKII_N = c(-0.145868903106222, -0.0757245672281776,
0.23642582674556, 0.148460249143042, -0.00305230227892469, 0.0585561745843138,
-0.148682825543474, -0.21730129212525, 0.459967321113158, 0.422894418061546,
-0.0575744512697957, -0.127564153510276, -0.242697988154887,
-0.095402375827381, 0.0140296834402993, -0.0497934688280284),
pCREB_N = c(-0.0825121744625299, -0.026500034184616, 0.0674710705932882,
-0.171872159375326, 0.0599673008600893, 0.20274815322096,
-0.138321776880784, -0.179229652914255, -0.031683391484602,
-0.107073356219089, 0.0795112065683711, 0.0230878800052553,
-0.101810049763974, 0.141596706516054, 0.175052271845758,
0.0962492148671607), pMEK_N = c(-0.011827795918493, 0.0651085636651456,
0.0372073300493682, -0.0758375679929981, 0.038855171657283,
0.162735732819232, -0.129245969397597, -0.10183076411972,
-0.030313508584495, -0.0402009321267793, 0.0265091904210039,
0.0384635318143068, -0.145082961476379, -0.00383809286152744,
0.00274224616628268, 0.0325875706999738), pNR2A_N = c(-0.040694436939677,
-0.126422726919893, 0.327029496785507, 0.11289764061805,
0.00949037400844992, -0.0370143413154391, -0.0445050341199518,
-0.0875679863319538, -0.0318024269145471, -0.0990796159280345,
0.114103842731325, 0.0684955162565601, -0.0517765103296767,
0.0262937180568668, 0.0186704564656926, -0.069607116867091
), pPKCAB_N = c(-0.0732668154024626, 0.259508683035786, -0.156388727351903,
-0.128555140589917, 0.233485439385613, -0.109922421599626,
-0.230899862755971, -0.275680739843144, 0.202586893320354,
0.128569221313288, -0.187404269824716, -0.123823456903658,
-0.0510954627942524, 0.224263475958852, -0.110903224987034,
-0.0622911739357286), pRSK_N = c(-0.0830647198678661, 0.171345235902955,
-0.00771685629829743, -0.153792422272828, 0.0775638466765593,
0.0562653498716256, -0.138802407016646, -0.115702091265824,
0.161592613345935, 0.120453263851679, -0.0389173648044295,
-0.0711265266002543, -0.207578315767319, -0.0270749356104633,
0.0589442953743869, 0.0144541906539012), AKT_N = c(0.0481798874438209,
-0.0923315388558725, -0.108885641561443, -0.105416833062579,
0.144880510212411, 0.00523331467580219, 0.0328578246677392,
0.0571445022606188, -0.0209256486347021, -0.0730029998614634,
0.0440023583125468, 0.0717278333163182, 0.0196560602422922,
0.0988713938163715, 0.0527286790966814, 0.0229037502299382
), BRAF_N = c(-0.00321939692704801, 0.0962073093317588, -0.0677402898524546,
-0.067209980101031, -0.0192180601759131, 0.0499710838529006,
-0.0685860451987449, -0.0621210254646294, 0.0464452196252293,
0.0717595906404571, -0.0808646010953599, -0.070139309127312,
0.0260226905885634, 0.0307477583500104, -0.0495839406552054,
-0.0605696564634389), CREB_N = c(0.0633377024959499, 0.0719351180508572,
0.0554860017614535, -0.0754709592333137, -0.051730811130647,
0.0770585706175764, -0.119490365368989, -0.101979827161643,
0.0390935428793637, 0.0334190803939948, -0.0231648718807617,
0.175244016989004, -0.199464488371739, -0.0830526740916612,
-0.0236000029056659, -0.0555939459680455), ERK_N = c(0.113758147959477,
-0.0935376622896181, -0.194533549084613, -0.202343017546552,
0.368811506067506, 0.0211924441765911, -0.166177103411079,
-0.239377414372715, 0.0512242092661902, -0.030723497203822,
0.00664926832340125, -0.105494671248667, 0.143740808738886,
0.306473059519756, 0.068383724577022, 0.0171957013321164),
GSK3B_N = c(0.0496851372868314, 0.0965673122890421, -0.122194260011564,
-0.113614901308566, 0.147165890990766, -0.0568100186969033,
-0.150554531109297, -0.188598927874271, 0.0729314311629536,
0.0534454310403283, -0.0530979322493377, -0.108715383018256,
0.0774398337859832, 0.133178525946526, 0.00917139328707758,
0.00415362892452407), JNK_N = c(0.084671436503407, 0.091451395958942,
-0.0735719764555032, -0.128089296490928, 0.0482424225269525,
0.136559678562216, -0.0983547253737015, -0.0994914255127194,
0.00287013911408683, -0.0207264777165356, -0.0425235674499462,
-0.0328911666055918, -0.102415581508767, 0.0426548346554378,
-0.0453706640514963, 0.0837146521123543), MEK_N = c(0.0415145904202766,
0.000112891679066114, -0.0947656593375573, -0.161573116350825,
0.217458153608386, 0.132508968100251, -0.177468380610068,
-0.18842935475728, 0.00445721815704893, -0.0539245065836939,
-0.00307155552655238, 0.0116656936964918, -0.100533579935951,
0.19149971269713, 0.15252996223312, 0.0956503457831564),
RSK_N = c(0.0191395815813382, 0.0714942086955356, 0.0161998863368589,
-0.184560332102979, -0.0264979202843543, 0.298908704096619,
-0.0968942910305665, -0.0189051673871464, 0.0861641375591587,
0.0160470100470935, -0.0682290713635209, -0.0518589639648677,
-0.23241046414349, -0.0542963774080875, -0.0873418795312474,
0.0210347924349621), APP_N = c(-0.0806791681338731, -0.0704201146133004,
-0.190200351582733, -0.162718360121692, 0.0303369406177179,
-0.0860104704967967, -0.162468694656265, -0.186756215303488,
0.149403011555697, 0.0234829670280346, 0.0759128457278766,
0.0934903179979386, 0.105907786308873, 0.361038543968712,
0.0786334044736174, 0.0784404724592734), Bcatenin_N = c(-0.0609377198837611,
-0.111471497502357, -0.0866850028872295, -0.134271109042703,
0.197879694030571, -0.025717790316679, -0.114779722205815,
-0.215166874658, 0.093663448787465, -0.0106410825979063,
0.0856165346234392, -0.0915811784652404, -0.0313801262102451,
0.220238809782054, 0.13789742580927, 0.141644968613549),
SOD1_N = c(-0.123838690502292, -0.144130158837663, 0.0727560720797953,
-0.0681671745118475, -0.123567494179754, -0.117023734873497,
0.253293745880715, 0.185224720298962, -0.11802985927293,
-0.143547249900102, 0.47503997511273, 0.434217391632064,
-0.15212803487222, -0.106940962031447, 0.100783205025425,
0.363303202025603), P38_N = c(0.0135880916776172, -0.0645721208196919,
0.0948843285406695, 0.159312513843406, -0.0770493007707386,
-0.107486334544236, 0.150819778231829, 0.217491472288877,
-0.121236098381148, -0.130587965985436, 0.0116164053669351,
0.144776197754908, -0.158244000282848, -0.13848656873568,
0.0539113322660321, -0.0721957070846476), DSCR1_N = c(0.0873105225377593,
-0.0399938541478373, -0.0423959808617725, 0.0615326056646092,
-0.0290529787358271, 0.0522204008570095, -0.0475227862097225,
0.0308446987929902, -0.0305665225181376, -0.0607456490874483,
0.0279790218604084, 0.100583918291236, -0.0206748799372295,
0.010415281028328, -0.0414425004790977, -0.0489198196614915
), NR2B_N = c(0.106299550498296, -0.0381078612482542, -0.00101679889831333,
0.0267320329216243, 0.112439396399247, -0.064052196844109,
-0.00641666140192624, 0.0613191854808411, 0.0168607292707449,
-0.0487573287523953, -0.0439584530719966, 0.00809905456774659,
-0.0667726467406412, 0.0694971401183639, -0.000212905759537097,
0.0163350414150324), pNUMB_N = c(0.202564418361944, -0.00200124352888242,
-0.0998561853278869, 0.037524195854859, 0.149886434896155,
0.195128273020257, -0.195094705493063, -0.140281085662283,
0.0590093896988644, 0.00582004770130322, -0.0546687365873218,
0.0551625036706637, 0.0777195935539914, 0.036101539026412,
0.0107519309923, -0.103469871374173), TIAM1_N = c(0.058847821102376,
-0.159760016471791, -0.0979806570256097, 0.0531257042802172,
0.103564419565561, -0.0238368367628548, -0.0729210307202995,
-0.06325777516333, -0.0281144756311353, -0.0884600747007959,
0.00512281704622422, 0.0615056543435742, -0.00313409869767671,
0.0899369569840853, 0.120845861658354, -0.00443043623680605
), pP70S6_N = c(-0.217859954507296, 0.243521933127221, 0.0425412592499045,
0.0832466388027541, -0.0874992096268626, -0.14876403578688,
-0.00476984544201101, 0.0106283984338779, 0.114328759061199,
0.125171996276406, -0.0925437220067121, -0.0570200090555343,
-0.252313164764891, -0.183959220656612, 0.189234923062614,
0.179602221371295), NUMB_N = c(0.0507161136495314, -0.0428893884462266,
-0.0737803369486708, -0.125816787402445, 0.157329290628144,
-0.0618269592229841, -0.121271771020323, -0.208391773663935,
0.0398518709801874, -0.015557253715229, -0.0686033888733257,
-0.146899366608736, 0.229868831769603, 0.328004434107362,
0.262082754277244, 0.270980403077601), P70S6_N = c(-0.0467645544881666,
-0.0513422563937406, 0.0806193466797829, -0.097604174996586,
0.169381505159102, -0.10953472581413, -0.0762873839439222,
-0.137957724239911, -0.0404929923772219, -0.112679782727059,
0.0478687778434949, -0.135047834380878, 0.235505540876976,
0.101996139976229, 0.0881984401256723, 0.0308682316870565
), pGSK3B_N = c(0.0726318660370534, 0.0113934692941635, -0.0784493639363762,
-0.129201494480153, 0.157796847802845, 0.23002474684606,
-0.156189105610425, -0.139272331325838, 0.118225045060094,
0.100304800513178, -0.0300757618933809, 0.0285299986456296,
-0.0120541561865572, 0.0908216848045133, -0.0023908457607024,
0.0089400750177918), pPKCG_N = c(-0.286386712047411, 0.265957237376396,
0.0737964172058239, -0.0759384400199, -0.0177238455253068,
-0.261634570955355, -0.253741047251584, -0.256650485194398,
0.134270402692566, 0.120849091119421, -0.146949388514596,
-0.142381255596242, -0.324527167558674, 0.195095873727953,
0.208752130225386, 0.246345320116692), CDK5_N = c(0.0835756577065185,
0.00364250782584705, -0.0635878598042922, -0.0665527642492147,
0.0498548879577531, -0.0037462363944042, -0.0709716342392349,
-0.109665096982383, -0.00693856902849091, 0.0043142382793781,
-0.00379427922410826, 0.0233969910641444, -0.000723497291038827,
0.106033840892453, 0.029827781661049, 0.0297508490072604),
S6_N = c(0.168888926042562, 0.230803056253277, -0.154902829994192,
-0.269491504226569, 0.142290171760069, 0.252241256219668,
-0.23854742286132, -0.264415247456924, 0.290083441282089,
0.238143298906295, -0.198459186518937, -0.263240335960755,
0.238832926146062, 0.35530004861393, 0.427790444668465, 0.360513465094153
), ADARB1_N = c(0.224098318811728, 0.0338977810779033, 0.116024199822639,
-0.00457055801051897, 0.530704385640093, -0.178020136682188,
-0.113465216543545, -0.173452014027142, 0.00633272386184758,
-0.0237300986226981, 0.139970553648416, 0.00713778435199307,
0.356303393951797, 0.328108176871799, -0.103822560250247,
-0.160096407917707), RRP1_N = c(0.00159121579454942, -0.0299422881516384,
0.0173826784335047, 0.0386298578057867, -0.022152469642015,
0.0369774839239829, -0.0197907278638186, -0.0201116884888817,
-0.016726870724063, -0.0138128805216459, 0.00747529027834608,
0.0385018374429109, -0.0165448322480326, -0.00614007382478539,
-0.00733137421781927, 0.0183421735187617), BAX_N = c(0.0348507900184639,
-0.169715973558917, 0.0312101948023616, 0.0728175524004573,
0.179257945173096, -0.00628218585999311, -0.114699647957541,
-0.213302817321221, -0.0219721111119517, -0.0411959352332957,
0.0140823449452806, 0.00562779088047583, -0.0465748954281123,
0.166914376799791, 0.121181906942324, 0.0465930748380351),
ERBB4_N = c(0.226825268882082, -0.124939501170309, -0.0779332590062461,
-0.18657539448526, 0.186503290026721, -0.209722491963456,
-0.0376960514068148, 0.0222951541745705, -0.058799632488138,
-0.106621802599657, 0.037095159045507, -0.0713172478048624,
0.0826014680466721, 0.0644672868926184, -0.022902877277575,
0.0811348220744181), nNOS_N = c(-0.0597607386610167, 0.0694317666060796,
0.0267840157110256, -0.0466611419857235, -0.0427174888142891,
-0.312236651256378, -0.010954182164099, -0.152991551731999,
-0.0500742377998905, -0.112776761155327, -0.0702701990622843,
-0.158725995917858, -0.170582110044521, -0.195995554048211,
0.270601021309697, 0.164312802991015), Tau_N = c(-0.0295470448997678,
-0.0135843635099774, -0.0532058617661047, -0.0555870385379599,
0.0413976507530296, -0.134898190226349, -0.0588315550075754,
-0.0795207957893949, -0.00171411389248874, -0.0482028991095779,
-0.132181492884161, -0.16272346727488, 0.0684355887357164,
0.0845081538871629, 0.17928411442039, 0.399425311619017),
GFAP_N = c(0.1022369732202, -0.0375872399271431, 0.0389750353783662,
-0.0504675751546967, 0.0274358635290079, 0.1734228779599,
-0.0412006018348187, -0.0716080720004096, 0.00463136477041947,
0.0395185137074335, -0.0488608095557386, 0.133429595736969,
-0.0456410825935039, -0.0308800819276867, -0.0205041295367554,
0.00291773400108061), GluR3_N = c(-0.030610619693228, -0.0419884945813332,
-0.0215878967844794, 0.13788987742286, 0.0097421522245054,
-0.185481343626263, 0.039394235524668, -0.0423606094227236,
-0.0300386175931323, -0.0704781156851588, 0.149635559983053,
0.194784934048682, 0.0579351879333201, -0.029201096262343,
0.035471474252518, 0.0130390262499429), GluR4_N = c(-0.0645767955225773,
-0.051538941109314, -0.0313732251039657, -0.0141460065921882,
-0.00417582031288004, -0.029593478043205, -0.0337244128285424,
-0.0473718497413239, -0.0076614057457667, -0.0274641649555311,
0.0567450285050144, 0.131417882380042, 0.0167002653120917,
0.0102756570041332, 0.0589477012145904, 0.0282615479355968
), IL1B_N = c(0.0271273847003715, -0.105491449847318, 0.0437609140660753,
-0.100682647720751, -0.0220718458071589, -0.255060461104892,
0.136556106808522, 0.171611061468201, -0.107978458154497,
-0.138468912721386, 0.0906412612736424, 0.103367168201442,
-0.0471777535915392, -0.0996457367924041, -0.0253085398636734,
0.0972606458616279), P3525_N = c(0.282068129966564, -0.00165311433635766,
-0.0922619335624527, -0.153415327839175, 0.123335275814776,
-0.217141845924011, -0.0794347237762894, -0.0633312926140292,
-0.0550134841848069, -0.0335943662560428, -0.172561096964795,
-0.0591245566896425, -0.0903407471772672, 0.0672553394698634,
0.277963667780744, 0.280422376361652), pCASP9_N = c(-0.0809064432825608,
-0.0137019165208861, 0.177743120582825, -0.0475158803923548,
0.193740256728041, -0.234087587902465, -0.13810712700627,
-0.123144569174683, -0.159086554429722, -0.196839206663645,
0.272409729812092, 0.163528529740624, 0.094264422008515,
0.0323567060275672, 0.132123054461642, -0.0232714678908218
), PSD95_N = c(0.0540563342629853, -0.0442860567878406, 0.192681249153854,
-0.0499306400945902, -0.0256836260381356, -0.130320516544179,
-0.0318622026430037, -0.05550691698767, -0.0550237612521986,
-0.0975383913984803, 0.0610109420236561, -0.016528638117965,
-0.0355453200230897, 0.0361199546017388, -0.0438265148666351,
0.15961796487275), SNCA_N = c(0.10038812821577, -0.203187652543977,
0.132600250445984, 0.0870009029169576, -0.16121896139518,
0.00675222688338345, 0.201408060453561, 0.166171601944603,
-0.244202510820346, -0.184881118438059, 0.0158087569191595,
0.163733417301441, -0.19931602328197, -0.0822025824650802,
0.0270161636801945, -0.0311533368903992), Ubiquitin_N = c(0.113890598772724,
-0.0571595522614428, 0.251655448625955, 0.0290662757157521,
-0.113226757122626, -0.118822873950306, -0.0895156964787369,
-0.115101576386724, -0.0883300072975741, -0.0451690155410069,
0.0356232623609365, 0.10502000854939, -0.242738889727437,
-0.000642607498821009, 0.023342908881478, -0.000996135171924353
), pGSK3B_Tyr216_N = c(0.171426581336935, 0.21964402951554,
-0.146777292906524, -0.180066591627815, 0.0607373096178199,
-0.338285372919054, -0.192946966367207, -0.179745246639312,
-0.0202782074462171, -0.0754752662878523, -0.0458616948609926,
-0.0702022161357589, -0.0329854942199789, 0.103988666502327,
0.160536360262989, 0.130136693548004), SHH_N = c(0.167413839912217,
0.177150215231475, -0.11706030681231, -0.103724722509818,
-0.105962891517635, -0.163445660332417, 0.26057121922903,
0.323113244273389, -0.154575367677723, -0.203841975554592,
-0.196762498711561, -0.0810430316565208, -0.164628664080618,
-0.0670952384804719, 0.0701383687380666, 0.0664763199521191
), BAD_N = c(1.38627815493717e-17, 0.108885085055258, 1.38627815493717e-17,
0.204958164782363, -0.109706654809739, 1.38627815493717e-17,
-0.0384428632142642, 0.113022480455563, -0.0230560609956582,
0.00709971300305052, 0.0944175354012559, 0.258234547510358,
-0.172555989304076, -0.115571199147466, -0.0361880642339753,
0.0555296363853341), BCL2_N = c(0.174830527318015, -0.0351916650236411,
4.47594455930353e-17, 0.16122241936817, -0.153630588784925,
4.47594455930353e-17, 0.0259483341117695, 0.10217304978238,
-0.113426224559798, -0.0493655879422875, 4.47594455930353e-17,
4.47594455930353e-17, -0.176439561319639, 0.00332642384209326,
-0.112281307284837, 4.47594455930353e-17), pS6_N = c(0.0544957045743841,
-0.215498231280905, 0.176330539472927, -0.0180427806336791,
0.0405134698307664, -0.196511194503692, 0.0896380150212792,
-0.00178437398723737, -0.111094705650147, -0.164447287557879,
0.0171495879982054, 0.17357748138507, -0.0854290326165926,
-0.136862309389642, 0.0486149936008245, 0.0468734606012612
), pCFOS_N = c(-3.94541709971541e-17, 0.144688662108845,
-0.0523244997808654, 0.183632906884199, -0.0943286515483249,
-0.154870867441355, 0.0273962871834048, -0.0446413560661544,
-0.151142681858317, -0.142540841364996, -0.0409951996945863,
0.209594994520851, -0.07067492413067, -0.0951447007727713,
0.0510274910486943, -0.10813485862325), SYP_N = c(0.1699192032091,
-0.007408249850341, 0.105706192867166, 0.030169211570003,
0.264311270468507, -0.174104272666862, -0.0320510372603059,
-0.146577591364027, 0.0748281855773365, 0.0921704540339964,
0.125632959616699, 0.101821683371461, -0.0991623357830543,
0.24508774982114, -0.0514314977651764, -0.0356173972612358
), H3AcK18_N = c(0.00318526058246947, 0.030516867974744,
0.0458325444094067, 0.0823406614957822, 0.0655800040015427,
1.34928358031281e-17, -0.066090760307071, -0.0164952261270702,
0.0193438095162109, 0.0214199163861949, 1.34928358031281e-17,
1.34928358031281e-17, -0.18204363595328, 0.0122967495407723,
-0.0057641327038032, 0.315397204575443), EGR1_N = c(0.22091436521792,
-0.0418899558545117, 4.08083728048395e-18, 4.08083728048395e-18,
-0.132192787939268, 4.08083728048395e-18, 0.170088635236541,
0.14416021675064, -0.136632103055064, -0.105975572333308,
0.157046871143272, 0.390639305517813, -0.135156681648399,
-0.14858326296597, -0.0787741349821091, -0.00864723924102435
), H3MeK4_N = c(2.39945987461847e-17, 2.39945987461847e-17,
2.39945987461847e-17, 0.0613111993676987, -0.0735063751409676,
2.39945987461847e-17, -0.0518102234068636, -0.0134739460741966,
-0.0578126454640219, 0.0237615758984536, 2.39945987461847e-17,
2.39945987461847e-17, -0.176488012336739, -0.119630246017519,
-0.139100793400124, 0.159811180815282), CaNA_N = c(0.228323127723045,
0.156499372224674, -0.218869345925655, -0.347696517405393,
0.258547187716627, 0.0491641323435211, -0.275043873926982,
-0.280621847419711, 0.221404071790851, 0.213771806346338,
-0.138770962441139, -0.179432243201944, 0.104799593812621,
0.247597575511052, -0.0575169171888767, 0.0268368286591718
), class = c("c-CS-m", "c-CS-m", "c-SC-m", "c-SC-m", "c-CS-s",
"c-CS-s", "c-SC-s", "c-SC-s", "t-CS-m", "t-CS-m", "t-SC-m",
"t-SC-m", "t-CS-s", "t-CS-s", "t-SC-s", "t-SC-s")), row.names = c(NA,
-16L), class = c("tbl_df", "tbl", "data.frame"))
my code:
# Splitting the data
trainX <- createDataPartition(np_2$class ,p=0.8,list=FALSE)
train <- np_2[trainX,]
test <- np_2[-trainX,]
Model 1:
svm1 <- svm(class~., data = train, type = "C", kernal="radial",
gamma=0.1, cost=10)
Model 2:
x <- subset(np_2, select = -class)
y <- np_2$class
model <- svm(x, y, probability = TRUE)
pred_prob <- predict(model, x, decision.values = TRUE, probability = TRUE)
Error:
Error in svm.default(x, y, probability = TRUE) :
Need numeric dependent variable for regression.

Here you go. Next time try to include the libraries:
Just transform your class to a factor. In that case, the svm will convert it to numeric for you:
np_2 <- transform(np_2, class = factor(class))
trainX <- caret::createDataPartition(np_2$class ,p=0.8,list=FALSE)
train <- np_2[trainX,]
test <- np_2[-trainX,]
e1071::svm(class~.,data =train, type = "C", kernal="radial",gamma=0.1,cost=10)
which outputs:
Call:
svm(formula = class ~ ., data = train, type = "C", kernal = "radial", gamma = 0.1, cost = 10)
Parameters:
SVM-Type: C-classification
SVM-Kernel: radial
cost: 10
Number of Support Vectors: 16

Related

factoextra variable plotting and labeling subset

I've run a PCA using prcomp in R and I am trying to produce a variable plot that has 1) a subset of the variables (arrows) in a different color (black) than the rest of the variables, 2) sort those variables prior to plotting so the black arrows aren't covered up by any of the other arrows, and 3) label the black arrows with their TUXXXX number.
Here is a truncated version of my data:
structure(list(sdev = c(21.7106794138444, 15.6885074594869, 11.9124316528111,
10.155277241318, 9.31528828036412, 7.56876266263865, 7.19938201515987,
5.81620977435434, 5.00785424840699, 4.57228787327195, 4.51525494575488,
3.20601607034873, 2.91477640215067, 2.48737967730048, 2.13230488376163,
1.74923754200417, 1.32745772948038, 1.27373216417502, 0.924437474777366,
0.749074623004602, 2.499709597053e-15), rotation = structure(c(-0.0710441966458092,
0.091894514828866, -0.0892433537986534, -0.269473709517009, -0.270455466278075,
0.217492458575054, 0.104541973199297, 0.198858094257877, 0.0222680112919805,
-0.220704163347643, -0.0144913885562279, 0.191255085890651, -0.0639203495167002,
0.156262929972648, 0.184067836594737, -0.221797618857792, 0.152932751853774,
0.218733634550932, 0.213989867048259, -0.219209176045661, 0.162232843055052,
-0.182649403408074, 0.0732706002149817, -0.0636694683826245,
0.197950156891487, -0.201332798849071, -0.0908133550739104, 0.204561640782066,
0.144543461720936, 0.128722984809536, 0.152014925749702, -0.219186163224382,
0.137427869376807, -0.0385728465064452, -0.210836096156869, 0.295086522896984,
0.0791956927556792, 0.154250304318938, 0.212537035577304, 0.165554637810987,
0.0559168852882808, 0.0389301896007549, 8.50109782205011e-06,
0.0386719091643949, -0.223181316780788, 0.0201295766763838, -0.0993945550528442,
-0.0797657364873552, 0.290392094157839, -0.210104310439075, 0.190507620860241,
0.288216604566037, -0.128091623622577, 0.0523741236254804, 0.165286635170839,
0.26567738477018, 0.067304658063138, -0.185395359345644, -0.0824392053628523,
0.0232331903282599, 0.206712718290849, -0.0599454190622519, 0.0694655529225049,
0.27934713843206, 0.120105146108152, 0.276987279291797, 0.137068573563571,
0.290227550805898, 0.0299855300238849, -0.048045392789825, 0.217209812823655,
-0.245207498414819, -0.0969050397538762, 0.0152958298727508,
0.0611874790392221, 0.244015616675892, -0.341439467152496, -0.0574074669754257,
-0.187473105527714, 0.0859725296785313, -0.230526618631008, 0.164238788534203,
-0.422116092865793, -0.0847447867791298, 0.0984005915083912,
0.0400031956936472, -0.0768787993932683, -0.127305543959199,
0.174417860300221, 0.00642366483942508, -0.0644270895895563,
-0.0445557418009, -0.206781215165792, -0.398796252833277, 0.198729650467593,
0.0351312161529938, -0.149474677035792, -0.0671760700655275,
-0.0776573448858521, -0.0276268199179851, -0.0622850132226139,
-0.0133848915206553, -0.0412751078511757, -0.196695235499305,
0.035533391699955, -0.0471461480863407, -0.471887698745297, 0.385807939659813,
-0.0521508210675749, -0.106054753553622, -0.0520098951237357,
-0.328301752147492, -0.0885218905714762, -0.392528395483506,
-0.0535243088811493, -0.0012232141956296, -0.143968515821013,
0.110020791115645, 0.105789408005642, -0.0173550741395983, -0.0754711706175302,
0.105789800532602, 0.035696880367874, -0.0235700328573188, -0.086664772131814,
0.140659513401983, -0.147738109860937, 0.158253547879328, 0.096508294839766,
-0.0405645836586841, -0.0308947063294566, 0.196563611460491,
-0.163272613036823, 0.102159062108236, -0.242801481572191, 0.100060947435785,
-0.122408620775568, 0.0879253395566385, 0.0964448760240853, -0.10574290240921,
0.473324985332234, 0.237791221156891, 0.121312056042028, -0.0156952213549262,
-0.0509545579371996, -0.188663582956394, -0.0296470996543493,
0.259217775431442, -0.151966417414955, -0.0246227447960926, 0.412107323913548,
0.135772975480753, -0.0902168853917747, -0.0478519874649824,
-0.0293395316078502, 0.036873372126565, -0.0600803315985544,
0.0951569802806819, -0.174539345831377, -0.0567399129758035,
-0.0522218071944251, -0.0208963041931566, 0.15376867866167, -0.0906491458699936,
-0.13257887196968, -0.0137277293203767, -0.329880055323168, -0.227898895128165,
-0.0402178711138279, -0.191724054954671, -0.0457418642155951,
-0.113122585201102, -0.0523451728177034, -0.0619052030873901,
-0.232037793152732, -0.286608825250971, -0.337575786471338, -0.106930203013502,
-0.0488020861881439, -0.0342694484533206, -0.316010730818033,
-0.138362452107825, 0.000204654351180751, 0.34062110315846, -0.0174472565351551,
0.321216705099307, 0.109402271713093, -0.195953316697484, 0.106147314965255,
0.0965509971711528, -0.0619150877056984, 0.0823900429544073,
0.107331603831664, -0.196505739977505, -0.106531330626324, 0.083316396319378,
-0.0150328553267955, -0.131557865292901, -0.197676924192316,
-0.302438247351333, 0.0850937235677142, -0.0588088540505814,
-0.0137660099545295, 0.0981614485249126, 0.064387690302654, 0.0870877447014138,
0.115369776587117, 0.0743160202050587, -0.302341999379974, 0.0990657432090211,
-0.109416851119016, 0.0566207941620112, -0.563376445425201, 0.022987878311214,
0.00914995477596945, -0.0698458973541682, -0.339551294424273,
0.328653723240687, -0.311621856766325, 0.0451475830297207, 0.0486778657760599,
-0.203890915518391, -0.00733314039012801, 0.0302380986964549,
-0.187740946530342, 0.107505967223115, 0.0112058761308914, 0.0124189091072754,
-0.0946013978939246, -0.0108516955206006, -0.0224544300789198,
-0.200447923165361, 0.00227210575436315, -0.0230219082173417,
-0.115276809069961, 0.113599893064251, 0.0547021334782484, 0.0750295713780988,
0.0318176533771422, 0.270756307602172, 0.0158888930662066, -0.0321100878211108,
0.0137635276916354, 0.285629078757821, -0.0707869220022327, -0.196194173921016,
0.0691894805409008, 0.196425060869134, 0.0609662656649608, 0.0112726648905893,
0.0763548314916228, -0.0203154117969338, -0.154183879477363,
-0.263435512251247, 0.0904584427059006, 0.443081105454767, 0.145760707944433,
-0.124076693641366, -0.00926033658765893, 0.322008337751576,
0.038976848601001, -0.00243771729397693, 0.0682300992336678,
0.101208051579165, -0.0044801862648156, -0.0288479608546419,
0.338293188340527, -0.148520145256712, -0.114001067101895, 0.0429068793268258,
-0.0808048267081677, 0.0147906601414549, 0.00024012812721683,
-0.0245592922986743, 0.26189600932665, 0.0089069926197661, 0.102640316156789,
0.0293398861736338, 0.461748240785653, 0.0268162505216955, -0.0262617915066989,
0.128477574136056, 0.304269602566599, -0.00833894425455883, 0.0183612622798514,
-0.0694598653855358, 0.143473468921974, 0.494741840190451, 0.11710470731812,
0.0938975501248067, -0.111819356177393, 0.074487393087207, -0.236744656433776,
-0.00888263838265717, -0.0411308668141714, -0.0205247425377322,
0.00682064532990936, -0.0657589971316789, -0.0854778766938379,
-0.0446898232128541, 0.0595158665026168, -0.164975323219787,
-0.21297106776461, -0.24328292167101, -0.0421999896796148, -0.0454152302659223,
0.536798625888851, -0.107184764029374, -0.134710620292912, -0.0486878301757869,
0.0112145455041351, -0.0888773206829193, -0.0231311387150055,
0.160224502964451, 0.116642580196556, 0.132842779999407, 0.0815222556677455,
0.0846715273158058, -0.168358316697627, -0.141086214309714, -0.0812000194350307,
0.108662664398591, -0.0391921007274459, -0.231315089883372, 0.25650378734853,
-0.0459946623780035, -0.366253502200094, 0.0485143397750607,
0.0417032700002287, -0.133038776710167, -0.230298287475923, 0.0369759420468897,
-0.00906710613565646, 0.0342935061381997, -0.273232725280753,
0.0602621389601039, 0.206808600842623, -0.32050527301245, 0.0622454407253566,
-0.0606525149750042, -0.0660628546307464, -0.038482743495315,
-0.198081930190034, -0.0732284456644516, 0.405606839140943, 0.0459681574877996,
-0.0809991829793473, -0.0121246261443008, -0.326485629157016,
0.0750251561011149, -0.0511696428776832, -0.0776271119484428,
0.0114894367280979, 0.014021492503364, 0.118849898460583, -0.0350044617639092,
0.0269961041673681, 0.239744113644073, -0.233879279575839, -0.115473220682409,
-0.139126309932733, 0.11002945246376, -0.0830577400425309, -0.0642289884705754,
-0.0817307298240943, 0.0291046627888711, -0.0466920006759583,
0.256672775663942, -0.0137954035992047, 0.17957481447807, -0.0303657675236596,
0.518263963411537, 0.344005787563606, -0.0655688570898937, -0.0265294401946153,
-0.0263107898868621, 0.289506920843548, 0.118475732210224, 0.053567958881615,
0.146877133183997, -0.0549414997788912, 0.143851895777107, 0.0428308701652828,
-0.348959761946987, -0.189096210288467, -0.00385035890156567,
0.150120708161381, 0.0607203081654835, 0.000166036942981724,
-0.0397011322296128, 0.0239760961564877, -0.00913095901818713,
-0.136862964262375, 0.102111106897839, 0.0687169707815706, 0.239013538410316,
-0.39892902681439, -0.197510750116376, 0.0499804963638917, 0.128640553281137,
0.110040614593457, -0.0490679379082568, -0.234025706976098, 0.157764576030734,
0.0571664700394519, -0.074307378291659, -0.231764546118876, 0.565447067892318,
-0.21480675567977, 0.0854469138131175, -0.0976097155414531, 0.160801495571792,
-0.0624041394929365, -0.0127140410117323, 0.196633195933416,
0.0340211274197625, 0.0195595932420065, 0.0964345475133984, -0.174817763577626,
0.118153342593374, 0.225094093283825, 0.0276798513722757, -0.39244132040106,
0.0738620568768489, 0.027031867335908, 0.0584738274201628, 0.00728266929277696,
-0.200928813049723, 0.100479151028423, 0.217133686900663, 0.152350478604359,
0.0798552081200005, 0.00566909653422267, 0.15071802028838, -0.0828967915619975,
0.0689991484295119, 0.118221935665031, 0.418906970577945, 0.161468821548893,
-0.0443917405359232, 0.127346300562372, 0.0854487046042784, 0.0086243432217815,
0.0186528057922736, 0.143224492276055, -0.113522100459258, 0.365748845830972,
-0.353026210924788, 0.0928434654809545, -0.217256921150109, 0.0926292235900054,
-0.0360081503134767, -0.0761247497474667, 0.0137710983238269,
0.135604749840715, -0.366785665744512, 0.174928851514231, 0.0364877873595186,
0.0808239023932249, 0.057715463934493, 0.103601691734105, -0.109666857605533,
0.38393023627746, -0.117248332196572, 0.134270206368149, 0.0580313640704774,
0.0649484539445183, 0.215353645432973, 0.0977108936702795, 0.16612143102929,
0.152770485581267, -0.0516344648811396, -0.0620940862015108,
0.114473317921704, -0.0383202829927206, 0.0820220075422196, 0.0556449561108403,
0.0053103511581772, 0.141569483443786, 0.264761186392854, 0.231379833347928,
-0.186458908266326, -0.280612868599116, -0.0134977078164976,
-0.190682413873154, 0.103622962625572, 0.048589128670959, 0.189228510250879,
-0.267141675131746, 0.24968486643315, 0.000515248155113446, 0.0518714761513495,
-0.0123619986636973, -0.0400774164248301, 0.14696585867848, 0.00893605318819822,
-0.115310054522583, 0.0730556770081751, -0.0415182843892857,
-0.100197819082248, 0.366565649542296, -0.280217314004845, 0.0742548639941826,
-0.0598573375691124, 0.0773367591528449, 0.00440008401952238,
-0.133823453930746, 0.0129306082883093, 0.249237874757721, 0.178566150191566,
0.0236542331383419, -0.121983928027758, -0.407639692892733, 0.105625218150781,
0.0606170741355181, -0.205658012407281, 0.198411895098939, 0.314706002474467,
-0.0699572649574542, -0.256054196724344, -0.0597932960838045,
0.12552805883941, -0.0738282459049305, -0.270044343022259, -0.241030766471284,
0.101198016298546, 0.207020228203116, -0.105134856921501, -0.0677078010226698,
0.0597983546937891, -0.181549492585234, -0.0707807644693492,
-0.242992185702685, -0.164512180143508, 0.0345701932987703, -0.0663154906257285,
0.302765631613708, 0.118224308922645, 0.0673423264385151, 0.417740310978627,
0.111554431260226, 0.16022442648127, -0.25635936207313, -0.35265959952747,
0.0429263261414316, 0.140480243375922, -0.130382613873709, -0.0446328161712632,
0.120679204177165, 0.100894280068327, 0.102396715497024, 0.292226072514004,
0.0170232777619504, -0.0854499461046589, 0.150649869168952, 0.054457847943396,
-0.0755734422376126, -0.0485946974863497, -0.214957242429833,
-0.19078567042026, -0.265677083691519, 0.11169177584997, -0.0546945656068388,
-0.133918556644411, -0.0815433043760734, 0.0419081230722499,
-0.119806690064691, -0.129001645490559, 0.164330559962565, -0.494999436348284,
-0.0104711534954494, -0.151933262861035, -0.0616048245349729,
0.0510091356535412, -0.15286661063535, 0.286795952380893, -0.00227878893487643,
-0.121875652782209, -0.0463279998907995, -0.08440989195395, 0.0161463685432679,
0.283239464786081, -0.0997334879966379, -0.107077349937415, 0.0797083319878824,
-0.023817698507559, 0.0308411589066249, -0.33639040110823, -0.22283646210506,
-0.0472382156514798, -0.0383954704026199, -0.279873414947505,
-0.110928067466998, 0.0224738031700519, -0.240448693328791, -0.0234165327843327,
-0.164995870598194, 0.0704836439566211, -0.0341351365684308,
0.253109207656731, 0.0986224720533927, 0.0788051554263656, 0.0348921204456385,
0.179396594950779, 0.183681460022634, 0.165162541829685, -0.131056895026594,
-0.043658366747374, -0.164919051972395, 0.000438005379084683,
-0.203731301273092, 0.156795003278361, 0.147134057978626, 0.0674666995224469,
0.0387098969653998, 0.0780676163151537, -0.020902824954741, 0.0863172379869736,
0.0254543096586073, 0.221894385139484, 0.605679699321179, 0.00510726652451246,
0.0122597366937914, -0.177909018628657, 0.112879199323714, 0.00722763837901889,
-0.226515396833189, -0.179516219763039, 0.0427914553668244, -0.301499857490821,
0.07077374887633, 0.0684478824696676, 0.109600278015023, -0.246938356324243,
0.0361050298642269, -0.273671368850468, 0.0361740234532937, -0.0379154357295922,
-0.140858482198813, -0.210557939874765, -0.183530140411959, -0.170246755949232,
-0.153695213839514, 0.197257212733899, 0.176328880404244, 0.267335680405474,
0.0108203611164604, 0.420718967278865, 0.0610513794750232, -0.0695142190235678,
-0.0211301631659223, -0.109598478540236, 0.0168455051311258,
0.0297211637285332, 0.0641419705460361, 0.196768178957862, -0.101223881022882,
0.156790420489079, -0.248396712859248, -0.0324362090799154, 0.116497846273851,
0.206631759837322, -0.26949738606709, 0.0523825016986687, 0.273991705979531,
-0.211717836239047, 0.343025575540513, 0.123225187210276, -0.130175293604759,
0.383814266477628, -0.0425846714760806, -0.120958839664608, -0.222129739206683,
0.0129931836329733, 0.144776049791581, -0.162517014653887, -0.0859042045925978,
-0.181054333724447, 0.0216585016380889, -0.0923250223535876,
-0.103640362754872, -0.223956862384563, 0.213416939275391, -0.21381164272001,
-0.235056303853187, -0.0630316125230271, -0.105100763021652,
-0.0360147146171049, -0.0709796908578211, 0.113552355258653,
-0.00724023466942227, -0.0325253318186826, -0.0460572605581843,
0.362655177721721, -0.102542875980008, -0.0801797191999012, 0.107198034030814,
0.183373945987406, 0.0309647928318137, -0.236970374446373, 0.0520664942182686,
-0.0402703424381589, 0.0504291632173252, -0.158130484290709,
-0.112283134517499, -0.300637215703608, -0.231320162708774, 0.0785169224262154,
0.23958352054759, 0.426485005426312, -0.0815406319434192, 0.00340039424643938,
-0.0375428689912434, 0.33351700972973, -0.0800149829632403, 0.140498383489292,
0.167368656035586, -0.0844117015281891, 0.0785085162751926, 0.0489486062002369,
-0.0561511863757523, 0.234387154088994, 0.0481142285230063, 0.0705808780719704,
0.221875388986379, -0.148031374880166, -0.0894717302805895, 0.231743942045981,
-0.210616362796393, -0.0812013243962482, -0.185771800435443,
-0.0438135376399639, 0.218374086144347, 0.121623152294345, -0.170058260806661
), .Dim = c(35L, 21L), .Dimnames = list(c("TU35976", "TU38792",
"TU35975", "TU4897", "TU9262", "TU18312", "TU38793", "TU30299",
"TU38794", "TU16422", "TU32068", "TU12311", "TU18325", "TU22117",
"TU20746", "TU19660", "TU41790", "TU43092", "TU18309", "TU19659",
"TU16277", "TU34798", "TU10953", "TU18317", "TU18307", "TU9186",
"TU17864", "TU15658", "TU14030", "TU15669", "TU9890", "TU33617",
"TU16279", "TU27042", "TU17167"), c("PC1", "PC2", "PC3", "PC4",
"PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13",
"PC14", "PC15", "PC16", "PC17", "PC18", "PC19", "PC20", "PC21"
))), center = c(TU35976 = 6.61238491831215, TU38792 = 10.2487864648085,
TU35975 = 7.41959195648095, TU4897 = 10.9311685931669, TU9262 = 11.0918083964267,
TU18312 = 11.7076238975148, TU38793 = 9.74398564779285, TU30299 = 12.892315214803,
TU38794 = 9.54139631961704, TU16422 = 12.3329627148834, TU32068 = 7.97610519995008,
TU12311 = 10.3617106799956, TU18325 = 7.59060411317826, TU22117 = 9.03799676912002,
TU20746 = 9.178102720165, TU19660 = 9.87502757868133, TU41790 = 8.9943466756264,
TU43092 = 10.9585816938684, TU18309 = 10.6298994150062, TU19659 = 10.3934726050624,
TU16277 = 8.32556725898017, TU34798 = 7.02103110645297, TU10953 = 7.01860382462013,
TU18317 = 7.36244270525821, TU18307 = 11.3778296252987, TU9186 = 10.7024172065364,
TU17864 = 8.2903853475227, TU15658 = 6.58819311715545, TU14030 = 8.134641008701,
TU15669 = 7.01449935590416, TU9890 = 8.13988320730633, TU33617 = 10.6809972208427,
TU16279 = 7.9614057227348, TU27042 = 7.34221912393268, TU17167 = 11.2592403834747
), scale = FALSE, x = structure(c(24.4897868475554, 12.4416010164283,
12.3200413661576, 6.91612686789472, 30.5655787046573, 33.5373707608136,
6.7521417841798, 31.2938791704631, 29.0635289584208, -23.3354523484558,
-15.6229701200559, 6.43010789907339, -24.9147092475567, -31.0094950116289,
-28.4137928961069, -21.5926413362042, -3.97585196983663, -20.8563124842282,
-0.593920033332157, -3.64572299218967, -19.8492949360489, -9.96693484414473,
-23.5449684594658, -18.996265716943, -23.7811581634436, 3.93738430048,
9.37353195322868, -19.423648038774, 7.87596964384287, -3.13661328005585,
-7.09016527838172, 3.71259770410569, 23.247076153704, -2.03249135782906,
-3.64325919770972, -6.94450353973124, 7.55306940052889, 31.346240781817,
-3.48931847017886, 29.4056029647248, 12.4861765573918, -6.8883231131661,
-6.8786118382072, 15.8325477899497, 15.3870141654559, -11.3237572934353,
-4.49560209730399, 1.115062768913, -20.2141393532659, 9.76193925462921,
-1.15731242202584, 6.22677163564855, 14.431909276018, -13.4812455995592,
-9.58096578254001, -10.0824168036361, -10.1417065317313, 6.11246229818054,
-4.84525793168699, 14.9352609583166, 16.1272133946181, -17.0836840355263,
9.35451814718846, -6.63382933222961, 5.79244304277846, 7.73028939318989,
-6.00113726185851, -8.57575275731579, -6.70414747438031, 11.0021295692077,
7.62205208005063, -6.03281844054887, -1.59444275830952, -7.70227835025931,
-6.4184560830441, -12.3696585650364, 1.42826497938592, 8.28315195406988,
-13.8464231033084, -6.95076374785849, 5.03179685038719, 16.6482451825695,
25.4557137741208, -6.16437895161065, -0.188023057317339, 3.51919999146276,
-3.06021456766217, 12.7300628490286, 0.340348842202129, -4.18342952961951,
9.91999265542052, -6.2673275997563, -6.19445525060979, -4.89432563084305,
13.3155996092707, -17.5672684031691, -11.0570104414685, -10.1512940397755,
-2.83422832939901, 11.2933772476208, 18.438427176494, -10.6101681685668,
2.08048057352476, 5.50745324586983, -0.13719717270706, -8.9884667602456,
-2.05928444313446, -0.305773393272364, 4.86554463593651, 3.76285186780856,
6.3828926870771, -9.3655246100571, 7.43651870615979, -1.67082019758757,
10.9895599029683, -13.9919213196391, -7.47010213808747, -5.18316808251628,
3.09935494483666, 0.0636557688816208, -1.54858827353552, 5.76445544260896,
-7.0244817763404, -6.91485718432494, 6.12343812013661, 16.0347161023267,
-6.04452306419056, 0.503323158087318, 1.11905480618314, -3.32310396567328,
3.1274151532053, -1.0139189902977, -2.77210893619864, 5.73300675328722,
-2.20016077060467, 6.88733384115661, 9.29615931028018, 7.89283806484175,
-0.0231784873612931, -13.6472361241707, 8.57047305874539, 9.82836851225084,
-12.0042402273719, -9.50514572716062, -7.91330903314343, 8.52172081325052,
-3.03276814511544, -8.49580406093405, -2.33842120098311, -0.32804627167184,
-3.21259723306479, 11.1229701308803, 0.598883041283415, 5.30460923308376,
1.00174438392002, -1.97289932239362, -10.2991918599681, -3.87835358264123,
-2.25659286308468, -0.166946108131337, -4.78949081440092, 3.19183354598423,
4.8383258847991, 0.890821633270318, 14.2375666218091, -6.1498396420083,
0.00274092818159516, 2.69868755607018, -6.72994548395586, -2.87563409646143,
6.39162216555694, -1.86430696261611, 1.49349337044142, -0.729377873822674,
3.91976580406387, -4.55169784656593, 4.01470477896383, 9.45815735561592,
3.87143750044459, 2.8485319829077, -3.54554995799273, 2.1592779575771,
-10.2265407210419, -2.57734842434015, 3.85728531842232, 3.91861430861892,
-6.08938026261039, 2.90775931244037, -5.65086822564584, -7.43442226552497,
-0.28834246695089, 4.46777893840091, 1.61867182502613, -1.24379496084697,
3.09330484415506, 4.6129428255061, 4.21327794340158, -2.73480960596815,
-1.34501116390485, -4.95417459779772, -1.50853746838879, 4.27315750243976,
5.82184171959861, -3.417633941994, 9.09574374372561, -2.51371486672449,
-5.3839624715871, 4.02549123440248, -4.25205519103745, -6.14575157593085,
3.39653326861517, 2.02195972923006, 0.737129651195039, -3.82060608464456,
-5.8916049884138, -1.48103866101421, -4.15462594283813, 2.85762680978641,
8.01848063520863, -0.33318325779775, -4.11692676832453, -3.14609004733945,
-3.87716607273847, 2.15863837910027, 5.89633795035078, 6.78408908767204,
5.31335299395838, 2.26271596099398, -6.04004269690954, 0.66943773718038,
-7.25501768327073, -1.85352333808763, 0.881321761644734, -3.37300816578494,
1.72336449307423, -1.12738959732561, -1.00315691989581, 1.22856047955961,
-5.49078567616185, 7.36566150881169, 1.5098504796481, -4.40047569826546,
1.27392003732061, -1.32431052177641, -3.49056795319117, -1.81317399652518,
4.21470358856118, -3.35477920804357, 0.76847614798403, 4.53289945581295,
1.08860795433414, 2.64380516830634, -3.5282442958868, 0.44695028657078,
6.40236529107031, 1.40990912221294, -0.646731159533322, -0.886819655598922,
-0.75355529529178, -3.22681748481868, 1.14443040171423, -1.01721629940821,
-1.91406441412825, 2.79795257160194, 1.42125707801834, -3.78513731974819,
5.22015934186783, -3.11038146921718, 4.2502371748613, -2.23573426796635,
1.2890326250481, -3.2044887828359, -0.0731034485321765, 1.00689042463065,
3.10770789167095, 0.653717111815948, 2.0046773828616, -5.05502285926648,
0.670269628945531, -0.0735066911646989, 0.567378074513561, -4.12216401435608,
-1.34361612453716, -2.31031886740573, 4.81653041064168, 0.0225272846463933,
-2.29390683891735, -3.34883149458521, 1.62567523985947, 1.46413728406672,
2.19861127383831, -2.2813563892377, 1.48246659900362, 1.20813467297598,
4.19016124903691, -3.8965814643401, 3.56184752348759, -1.3878373295987,
1.21458977444305, -0.654562661488364, 0.95632241225039, -1.55232118983605,
-2.44238882925152, 1.13264815277383, -1.78862294430386, 0.991256365490394,
-3.88951966260596, 0.202107196565979, 0.551090451321218, 2.66348016156913,
-0.854309938495967, -0.232716071672556, 0.851674118269924, -0.985653498045505,
1.36933618443016, -0.586856938122795, -4.1119301713715, 1.0178280457984,
0.338189042904915, -3.94726389810293, 1.81377558126379, 1.58372328030388,
1.72308989346244, 2.19193280022478, -1.61256462530986, 1.96795000825428,
-0.618527965915178, 0.0756192601567935, -0.659358025397941, 0.0429550715360451,
-0.381324238450748, -0.652905276182954, 0.170764900323459, -0.641706794178386,
-0.0221222785810836, 2.30873232738461, 1.27649223277723, 0.0239704300112933,
1.61258498499148, -2.05589657580369, 0.0265571467877399, 1.25029287962319,
-0.571431828720408, -1.73619374916576, -0.0382088144200337, -0.321239936961026,
-0.611330806517872, -2.02090803294801, 3.14396363436869, -1.10262030332252,
-1.04168768271449, 0.37429480503427, 0.104514606536275, -0.478767952336214,
-0.192546893385304, 2.1627661920923, 0.195395664072845, -0.782469508379251,
2.08546244595102, -0.0517755897340584, -2.39907743930418, -0.211807017194547,
1.71381905614487, 0.83072521628824, -1.60469551897193, 0.245800797687136,
-1.46819802906202, 0.849407708022543, 0.917523253251796, -1.60319562494994,
1.89391093257302, 0.378604048008997, 0.14292959825461, -0.126413703865446,
-1.54645185235878, -0.749700454486876, -0.0658077625468692, 1.55140944467166,
0.302322289091245, 0.458890126236888, -0.788003883776506, -1.8522098865949,
-0.303600234099745, -0.869244048674518, 2.09285131170145, 1.13594169034256,
0.00257581110260907, 1.28821287823238, -0.603719944771219, -0.0929817189825319,
0.646083878133434, -0.997976432253114, -0.0887921104756663, -0.252335674196718,
0.885171983511843, -0.455664633944459, -0.080944547822266, -1.11153038212543,
0.684953529364659, 0.00107091275654292, -0.0523472212020604,
-0.722665903230519, 0.112695429436832, -0.431332703576418, 2.28632079906497,
0.389976510624337, -0.672770348738164, -0.710872748519771, 1.11097033239239,
-0.117525841496901, -0.38659967304807, -0.311519238694312, -0.58769206070627,
0.880912821150173, -0.223180949008615, -0.0563287542495416, 0.677577799103385,
0.174786309548343, -0.486054451272286, -0.875421020334039, -1.99840144432528e-15,
-2.19269047363468e-15, -2.80331313717852e-15, 3.39658856596259e-15,
4.44089209850063e-16, 4.44089209850063e-16, -2.44249065417534e-15,
1.11022302462516e-15, -6.66133814775094e-16, -4.44089209850063e-15,
-3.5527136788005e-15, -2.33146835171283e-15, -6.43929354282591e-15,
2.44249065417534e-15, -1.4432899320127e-15, -2.19269047363468e-15,
1.0547118733939e-15, -1.11022302462516e-15, -9.99200722162641e-16,
1.33226762955019e-15, -1.55431223447522e-15), .Dim = c(21L, 21L
), .Dimnames = list(c("EDA_01", "EDA_02", "EDA_03", "EDA_04",
"EDA_05", "EDA_06", "EDA_07", "EDA_08", "EDA_09", "NDA_01", "NDA_02",
"NDA_03", "NDA_04", "NDA_05", "NDA_06", "NDA_08", "NDA_09", "NDA_10",
"NDA_11", "NDA_12", "NDA_13"), c("PC1", "PC2", "PC3", "PC4",
"PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13",
"PC14", "PC15", "PC16", "PC17", "PC18", "PC19", "PC20", "PC21"
)))), class = "prcomp")
Here is the minimal code to reproduce this problem:
library(factoextra)
library(tidyverse)
# create a named factor for coding the coloration of the variables in the plot
markers <- facto_summarize(pca,
element = "var",
result = "contrib",
axes = c(1, 2)) %>%
mutate(candidate = ifelse(name == "TU35976" | name == "TU18317" | name == "TU12311" | name == "TU3565" | name == "TU9890" | name == "TU18316", "1", "0")) %>%
select(name, candidate)
markers_vec <- as.factor(markers$candidate)
names(markers_vec) <- markers$name
(var_cluster_PC12 <- fviz_pca_var(pca,
col.var = markers_vec,
axes = c(1,2),
select.var = list(contrib = 200),
palette = c(
"grey90",
"black"),
label = "none",
) +
theme_bw()
)
Which produces this plot:
This image doesn't quite do it justice, so here is a plot of the full data set that shows how bad the overlap is:
Probably the simplest method, given your particular colour scheme, is to make the arrows all black but use the alpha channel to make the gray ones gray. This means the black arrows will still be completely black even if other arrows are drawn over the top:
fviz_pca_var(pca,
axes = c(1,2),
select.var = list(contrib = 200),
alpha.var = ifelse(markers_vec == 0, 0.2, 1),
label = "none") +
theme_bw()

Arima model with Rolling Origin in R

I am working on a data set with 14 variables. I have used the Arima model with Rolling Origin but applying the rolling origin method on each variable every time is a bit slow and want to automate the process. I have tried to automate the process so that it gives me outputs for 14 models but it gives me an error. Please any help is appreciated.
Data:
structure(list(Date = structure(c(289094400, 297043200, 304992000,
312854400, 320716800, 328665600, 336614400, 344476800, 352252800,
360201600, 368150400, 376012800, 383788800, 391737600, 399686400,
407548800, 415324800, 423273600, 431222400, 439084800, 446947200,
454896000, 462844800, 470707200, 478483200, 486432000, 494380800,
502243200, 510019200, 517968000, 525916800, 533779200, 541555200,
549504000, 557452800, 565315200, 573177600, 581126400, 589075200,
596937600, 604713600, 612662400, 620611200, 628473600, 636249600,
644198400, 652147200, 660009600, 667785600, 675734400), tzone = "UTC", class = c("POSIXct",
"POSIXt")), NORTH = c(4.06976744186047, 5.51675977653633, 7.2799470549305,
4.75015422578655, 4.59363957597172, 3.15315315315317, 1.2008733624454,
-0.377562028047452, -0.108283703302655, 0.650406504065032, 0.969305331179318,
0.106666666666688, 3.09003729355352, 2.11886304909562, 2.32793522267207,
5.68743818001977, -1.46934955545156, 3.95611702127658, 5.19438987619354,
-0.0912012507600199, 2.81677896109541, 3.97412590369087, 1.30118326353028,
3.31553807249226, 1.32872294960955, 2.93700394923507, 0.908853875665812,
1.81241002546971, -1.3414545718222, 4.81772747317361, -3.4743890895067,
4.63823913990992, 0.857370960463727, 1.78620594713658, 0.527472527472524,
-4.05973562947765, -0.136726966764838, 3.16657890117607, 5.95161125667812,
8.01002055498458, 10.5501040737437, 13.4138468987035, 2.93371279497212,
8.84291046495554, -6.87764606265876, 2.90741287990725, 3.71548486856639,
1.23317430567388, -1.1153443739474, 4.31313207880924), YORKSANDTHEHUMBER = c(4.0121120363361,
5.45851528384282, 9.52380952380951, 6.04914933837431, 3.03030303030299,
5.42099192618225, 2.78993435448577, -0.53219797764768, 1.97966827180309,
1.15424973767052, 0.466804979253115, -1.96179659266907, 2.42232754081095,
0.719794344473031, -0.306278713629415, 3.37941628264209, 2.74393263992076,
3.91920555341303, 1.91585099967527, 0.892125625853447, 2.91888477848958,
3.78293078507868, 0.109815847271484, 6.83486625601216, 0.722691730511011,
3.56008625759656, -0.227160867754524, 2.69419041475355, -1.17134094520194,
2.78546324684064, 1.01487759630426, 1.54843356139717, 4.15602836879435,
4.43619773934357, -0.309698451507728, -1.45519947678222, -1.09839057574248,
9.08267346664877, 11.8913598474363, 13.9511229623114, 9.71243848306475,
7.66524473371739, 6.46801731884651, -2.26736490763654, -4.35729847494552,
-2.93870179974964, -7.72353426221536, -7.01127302722023, 2.02543627323513,
2.51245245873873), NORTHWEST = c(6.57894736842105, 6.95256660168939,
6.50060753341436, 5.5904164289789, 4.59211237169096, 4.70041322314051,
2.96003946719288, -1.38955438428365, 0.242954324586984, 2.18128938439167,
-0.853889943073994, -2.15311004784691, 0.929095354523226, 2.51937984496125,
0.189035916824195, 2.21698113207546, 2.51499769266268, 3.5066396578888,
1.77437592415414, 0.948636868643719, 4.60125296308836, 3.95775160859537,
-0.237455720347246, 4.218042765725, 2.79306600771276, 2.22545984338008,
0.709042970141798, 0.258269945161875, 0.663420142564747, 2.23655612423752,
1.69729803867784, 0.792339593378065, 2.82330902522246, 2.20899212700891,
1.48327338701976, -1.78151365931687, 1.8457608174996, 5.06380710500736,
7.57132625044768, 9.28561520321818, 9.51969943135663, 11.3671132539057,
10.5960954085668, -1.43026516363364, 3.55308627832826, 3.99351008518014,
-1.44138713566414, -0.165494414563527, 2.01304344107922, 1.70645628251555
), EASTMIDS = c(4.98489425981872, 8.20143884892085, 6.91489361702127,
5.22388059701494, 5.61465721040189, 4.64465584778958, 2.03208556149733,
0.314465408805028, 2.82131661442007, 0, 2.79471544715448, -0.939199209095414,
-1.14770459081835, 2.97829379101462, -0.68627450980392, 3.40572556762095,
3.42243436754175, 4.89223242719342, 0.730408764905171, 2.10107893242476,
2.31025926242835, 5.01798109893785, 0.382256908497274, 4.64894882982943,
3.04374194526571, 2.25491999264298, 0.651125980286367, 1.40105078809108,
2.87265165133409, 3.59418899472349, 1.76616504051596, 3.78627839708797,
3.9017974572556, 3.85473176612416, 0.0696479874633737, 1.45578980947134,
2.96698585107904, 12.8612275490659, 16.8142463597009, 10.6860102754148,
5.80782620275077, 2.65911542610573, -2.54295171544163, 4.66512121048756,
-3.66911045104132, -1.75382312052187, -3.61743042705271, -5.070772474025,
-1.21063610003222, 1.9530155970429), WESTMIDS = c(4.65838509316771,
4.74777448071216, 8.66855524079319, 6.56934306569344, 3.22896281800389,
3.17535545023698, 0.643086816720257, -1.36923779096303, 1.61962054604351,
2.00364298724953, -0.491071428571428, -2.78151637505608, 0, 2.39963082602676,
0.540784136998647, 1.83774092335275, 4.66989436619718, 1.82498633362771,
2.51909973157134, 0.644511581067457, 3.9503702221333, 3.15724626520867,
0.548671245147809, 4.19837410445824, 3.20983256145349, 1.12526319422872,
1.4028740144042, 0.434226470984247, -0.194389516372279, 2.32714328889485,
1.7360199527435, 3.3224734685978, 4.23339889482064, 5.79267379518974,
4.39964893406187, 0.374237288135615, 4.31199848701807, 13.9164443523531,
18.0050929925879, 6.07502745611839, 3.93976822755839, 4.07004176642259,
3.48434981192908, -1.92610381813166, 0.438451356717408, -0.103780578206083,
-3.0952145377791, -1.72381519612015, -2.02143896779759, 4.40768347678723
), EASTANGLIA = c(6.74525212835624, 8.58895705521476, 8.47457627118643,
10.7291666666667, 4.8447789275635, 4.84522207267835, -0.299529311082601,
1.45922746781116, 0.88832487309645, 0.29350104821803, -0.877926421404701,
1.64487557992411, -2.69709543568468, 3.49680170575694, 3.25504738360115,
2.39425379090184, 2.98519095869059, 4.36691137516082, 3.57868020304568,
1.66275772744776, 3.79450451070863, 4.52162951167727, 2.28203256419209,
4.17054552224914, 3.2439678284182, 4.76643873164257, 0.955633279171614,
2.91614381581101, 0.848198902642676, 5.02010671012167, 2.80551592962435,
5.64292321924145, 4.17550004608719, 9.7903026013095, 5.88709352460008,
3.07862089961185, 8.83080444493668, 14.1609281183215, 14.9330678829839,
-2.38242974223737, 1.8287757399192, 1.22633166874738, -5.71564382892894,
-5.25820956533587, -9.72515856236787, 0.957479010339489, -3.50481300299826,
-3.45549395738277, -0.828308094308001, -0.331408094033985), OUTERSEAST = c(6.7110371602884,
7.53638253638255, 9.47317544707589, 8.56512141280351, 3.82269215128102,
2.11515863689776, 1.64940544687381, -1.73584905660378, 1.34408602150539,
1.78097764304659, 0.446760982874161, -1.26019273535953, 0.150150150150159,
3.11094452773611, 1.4176663031625, 2.54480286738352, 5.56448794127927,
4.89371564797033, 3.88257575757575, 1.85961713764815, 5.54859495256845,
4.29879599796508, 2.00525702517411, 3.63679834232127, 3.44509381728699,
3.46664684309643, 1.93988743863012, 2.50440502760482, 2.96578121060713,
4.47634947134114, 4.50826657576274, 4.92742395824838, 5.38770910645244,
7.13653626341212, 6.15524925576032, 1.08283352245096, 6.66955322492704,
9.69075574665124, 11.4606033194907, 3.4233015677836, 1.10095233565968,
1.65461280649144, -3.58737650679069, -5.85546129756061, -4.98846560711691,
-2.32068359558401, -5.55914140928629, -4.66925504224286, -1.07093896112692,
2.07357059157311), OUTERMET = c(4.54545454545458, 6.58505698607005,
7.36633663366336, 7.08225746956843, 4.3747847054771, 1.68316831683168,
1.00616682895164, -1.28534704370181, 2.01822916666665, 0.797702616464613,
0.949667616334271, -0.940733772342415, 1.10794555238999, 2.19160926737633,
2.84926470588237, 2.62138814417631, 5.02467343976781, 5.65213786241397,
3.22555328833776, 3.73552294786995, 5.05948745510956, 4.28797321179426,
2.86300392436674, 2.60339894216597, 4.28031183318191, 3.43199821714381,
3.34554286721641, 3.04770569170409, 1.65167650683293, 4.62120252591965,
6.34025700005186, 6.1931790459772, 8.10781836281492, 6.14401677315165,
5.88313802952244, 0.112183931227468, 4.21036727396348, 5.85740693754756,
8.61496319123439, 2.24246818616477, 2.39678510128783, 1.57885756155336,
-2.68472955079939, -5.09925369345585, -6.23990242127901, -2.51851513733724,
-2.72874133732908, -5.45172276846427, 0.20833593462305, 2.61721355963614
), LONDON = c(8.11719500480309, 10.3065304309196, 6.32299637535239,
7.65151515151515, 1.30190007037299, 2.1535255296978, -0.204012240734436,
-0.306643952299836, 0.786056049213951, 1.18684299762631, 1.00536193029493,
-2.85335102853352, 2.76639344262296, 2.06048521103356, 1.23738196027352,
2.70183338694115, 3.30410272471031, 5.76322570865546, 4.73255747291176,
1.98428989791171, 6.03563952552197, 4.88977753030802, 2.12581135535556,
4.43247330120026, 5.42986425339366, 3.96781115879828, 3.43247538648888,
4.0668901660281, 4.09587727708534, 4.81707991010573, 7.42869193863026,
6.70069362648866, 6.67699006500675, 7.43184006668679, 5.53177257525084,
-1.06737656081638, 1.7605678920595, 5.86902048679756, 6.75919979067056,
0.943616938313976, 1.29679498499027, 1.95787891003782, -1.64030775806797,
-2.62806236080178, -2.6208912592328, -4.49717565910836, -5.18403877531433,
-5.57502752084625, -0.947552316580683, 0.978175016770521), SOUTHWEST = c(6.17577197149644,
7.71812080536912, 7.63239875389407, 9.45489628557649, 2.46804759806079,
2.19354838709679, 1.72558922558922, 0.248241621845247, 1.48576145274456,
2.03334688897925, -0.677560781187733, -2.3274478330658, 1.80772391125718,
2.42130750605327, 1.85185185185186, 0.928433268858785, 5.95247221157533,
4.38447346525341, 3.30272049904696, 2.25107353730542, 3.86823714688802,
2.04371722787289, 3.04596811639065, 4.19057346270538, 2.45646407565451,
2.17525889239081, 2.83400809716597, 1.58015962290428, 2.77894958869438,
4.08650146221331, 4.40418977202712, 2.87285774987016, 3.86424654076504,
5.69560126372535, 5.04170063334797, 1.07854257457266, 6.75066443547593,
13.56963706108, 16.2190250397843, 2.62121000419169, -0.940827274460141,
2.85066318466084, -0.886020125887025, -6.46387832699618, -3.51150320013839,
-0.306262698697259, 0.555963495227118, -7.19650681052728, -1.76899526612503,
0.528003461834023), WALES = c(6.09418282548476, 8.35509138381203,
7.40963855421687, 7.01065619742007, 1.15303983228513, 3.47150259067357,
-0.150225338007013, 0.852557673019058, 0.944803580308295, -1.13300492610835,
0.946686596910786, -2.17176702862782, 3.98587285570131, 0.485201358563789,
3.62143891839691, 1.63094128611373, 1.61852361302152, 4.32251951450617,
1.28887158859911, 0.68747598104105, 3.71925360474978, 4.66941979801284,
1.44927536231884, 1.05121293800539, 1.67663757954501, 2.9419480568152,
-0.422309596621509, 2.67987715706347, 0.0249243368346056, 2.03260714794249,
1.14433241461116, 3.01472870890965, 0.7768290641219, 3.81433365451707,
-0.140822531605095, -2.99349379827568, 4.11669475005782, 4.95668454288706,
12.973544973545, 15.3990258523792, 9.25324675324674, 6.63977924007642,
0.236872486962066, -0.381277677383487, 0.681750224259938, -2.67091690260756,
-5.39078074779283, -3.51337404317537, 0.996191624080064, 2.8524564276044
), SCOTLAND = c(5.15222482435597, 4.12026726057908, 5.40106951871658,
8.67579908675796, -0.280112044817908, 2.94943820224719, 1.04592996816735,
1.21512151215122, 1.33392618941751, 3.59806932865292, 0.974163490046604,
0.125838926174496, 1.46627565982404, 3.42691990090835, -0.838323353293421,
1.97262479871176, 3.40702724042636, 4.30649410147751, 2.44866586142527,
1.93997856377279, 2.09581887638873, 4.22573890357352, 0.833278440155458,
4.15155969296095, 2.01655899140689, 1.93980755633434, 0.325693606755129,
0.796561260069754, -0.381713535919834, 2.90974405029185, 0.802862378916138,
0.473263498109834, 1.33268231036562, 0.742609336470062, 0.427651014264418,
-2.00028015128168, -2.46419484863213, 3.18590814502184, 4.33732886439812,
3.78406337625565, 4.59302783096821, 9.65541455585091, 7.16082700576343,
2.74890619997868, -6.81926759861247, 3.2880071333036, 2.69558648969462,
-2.78454942837929, 1.79123210602768, 2.88825864878425), NIRELAND = c(4.54545454545454,
4.94752623688156, 4.42857142857145, 2.96397628818967, 6.06731620903454,
0.0835073068893502, -1.66875260742594, -2.96987696224015, -1.18058592041975,
-0.884955752212393, -1.74107142857143, -0.545206724216265, 1.96436729100047,
-0.224014336917564, -1.84104176021554, 1.6010978956999, 1.42278253039172,
1.97993429814437, 1.29287828660979, 1.61158623060724, 2.28387751649466,
1.84005954349984, 1.79057208981284, 2.22177901874749, 2.88757950598978,
-0.731975575530031, 3.07939176281808, -0.0593031875463392, -1.05696484201158,
3.40717418194087, 1.07655502392344, -1.70701093778018, -2.34959319931409,
6.56454324677751, -1.80912979454455, -4.90966221523961, 0.319176899102556,
1.67315466387184, -2.88259765121672, 2.95678544351781, -0.54123711340205,
4.15355569540591, -1.90510040874357, 0.923946519801462, 4.1035398865513,
-2.3519674449081, -5.50238389546177, 7.24670179766041, 2.75090864790844,
0.446509889559553), UK = c(5.76890543055322, 7.20302836425676,
7.39543442582184, 7.22885986848197, 3.23472252213347, 2.95766398929048,
1.20271423347285, -0.554061107319231, 0.98913965036942, 1.55113136643479,
0.373986300291293, -1.61195434757029, 1.59052858167903, 2.07573082205217,
1.17628969016684, 2.44680851063832, 2.84453345201007, 4.10010457610617,
2.88208396840793, 1.58922558922557, 3.67559326527908, 3.90013106997858,
1.36611181194425, 4.12505691303686, 2.02017257462689, 2.93167985827357,
1.54068234183715, 2.12149379408387, 0.594313861969269, 3.83755588673622,
3.33948434056075, 3.50933756603259, 3.25378570059421, 5.14920870654849,
3.36548010504709, -0.177206541696886, 1.65971553844507, 8.51865098567251,
11.0759984490113, 5.32351247098249, 3.99880682100659, 4.55095927082668,
0.864171188197283, -2.04898834977862, -3.10383660120637, -1.01415357182659,
-2.94496091613858, -4.06343734981687, -0.677156948752485, 1.59717017296902
)), row.names = c(NA, -50L), class = c("tbl_df", "tbl", "data.frame"
))
This manual code works:
y <- data2$NORTH
ourCall <- "predict(arima(x=data,order=c(1,0,0)),n.ahead=h)"
ourValue <- c("pred")
returnedValues1 <- ro(y, h=4, origins = 8,
call=ourCall, value=ourValue)
returnedValues1$actuals
returnedValues1$holdout
returnedValues1$pred
But this doesn't:
y <- data2
y %<>% dplyr::select(-Date)
ourCall <- "predict(arima(x=data,order=c(1,0,0)),n.ahead=h)"
ourValue <- c("pred")
ar_ro_model_4 = apply(y,2,function(x){
return(
list(
returnedValues1 <- ro(y, h=4, origins = 8,
call=ourCall, value=ourValue)
))
} )
ar_ro_model_4

compare multiple signals using FFT in R

I want to analyse multiple signals using Fast fourier transform and try to group the ones with similar patterns.
I'd like to know how to approach this problem.
A subset of my data:
df <- dput(tst1)
structure(list(var_1 = c(0.238942, 0.265, 0.190338, 0.245714,
0.208872, 0.266648, 0.1909, 0.291751, 0.259681, 0.270592), var_2 = c(0.236594,
0.262115, 0.188282, 0.243209, 0.206064, 0.26483, 0.187436, 0.289571,
0.256675, 0.268209), var_3 = c(0.234762, 0.260603, 0.188161,
0.240466, 0.204413, 0.262256, 0.1863, 0.288058, 0.254225, 0.266186
), var_4 = c(0.232489, 0.258214, 0.186727, 0.238468, 0.201748,
0.260584, 0.184533, 0.285398, 0.251934, 0.263722), var_5 = c(0.230015,
0.255756, 0.186592, 0.235875, 0.199746, 0.258097, 0.18314, 0.283392,
0.249769, 0.262319), var_6 = c(0.227892, 0.253624, 0.186194,
0.233518, 0.197826, 0.255778, 0.181736, 0.281578, 0.247566, 0.260859
), var_7 = c(0.225756, 0.251379, 0.185813, 0.231679, 0.195496,
0.253272, 0.180961, 0.27873, 0.244901, 0.259456), var_8 = c(0.223464,
0.249673, 0.185515, 0.229863, 0.193899, 0.251128, 0.180393, 0.276851,
0.243248, 0.257856), var_9 = c(0.221471, 0.24726, 0.184834, 0.227454,
0.191849, 0.248769, 0.179127, 0.273859, 0.240625, 0.255606),
var_10 = c(0.21952, 0.245511, 0.184278, 0.225988, 0.190593,
0.246434, 0.178072, 0.271144, 0.238321, 0.253885), var_11 = c(0.218228,
0.243789, 0.184485, 0.224337, 0.189168, 0.245093, 0.177002,
0.268688, 0.23696, 0.251804), var_12 = c(0.216438, 0.241876,
0.184569, 0.222695, 0.187973, 0.243475, 0.175195, 0.266073,
0.235168, 0.250305), var_13 = c(0.215116, 0.240005, 0.184283,
0.220832, 0.186319, 0.24159, 0.173557, 0.263756, 0.232819,
0.248114), var_14 = c(0.213016, 0.237224, 0.18444, 0.21831,
0.18518, 0.240112, 0.17209, 0.261131, 0.230609, 0.245875),
var_15 = c(0.211184, 0.23517, 0.18475, 0.216627, 0.183275,
0.238314, 0.171204, 0.258135, 0.228459, 0.243731), var_16 = c(0.208855,
0.232755, 0.184906, 0.215249, 0.181248, 0.236821, 0.169593,
0.256136, 0.226637, 0.241915), var_17 = c(0.207139, 0.230857,
0.185459, 0.21385, 0.180094, 0.235208, 0.168155, 0.254205,
0.22486, 0.240045), var_18 = c(0.205077, 0.228666, 0.185522,
0.211764, 0.178778, 0.233662, 0.166491, 0.251451, 0.222678,
0.237376), var_19 = c(0.203173, 0.226569, 0.185825, 0.209949,
0.176726, 0.231828, 0.165068, 0.248426, 0.220556, 0.235003
), var_20 = c(0.201251, 0.224366, 0.186176, 0.207974, 0.175703,
0.230081, 0.163141, 0.246262, 0.218654, 0.232062), var_21 = c(0.199265,
0.221885, 0.186458, 0.205793, 0.174502, 0.228247, 0.161569,
0.24376, 0.216408, 0.229642), var_22 = c(0.197004, 0.219585,
0.186486, 0.203886, 0.173065, 0.226032, 0.160078, 0.241633,
0.214141, 0.227404), var_23 = c(0.19512, 0.216987, 0.186782,
0.201754, 0.171262, 0.223991, 0.158268, 0.239415, 0.212232,
0.225068), var_24 = c(0.193056, 0.21441, 0.186593, 0.199443,
0.169317, 0.221896, 0.156727, 0.237254, 0.209865, 0.222927
), var_25 = c(0.190861, 0.211877, 0.186553, 0.19689, 0.168172,
0.219797, 0.155611, 0.235068, 0.207387, 0.220559)), row.names = c(22743L,
6535L, 59032L, 61113L, 16944L, 60773L, 3235L, 19567L, 20560L,
42516L), class = "data.frame")
Each row in the data is 1 signal and I'd like to group the signals with same patterns.
FFT on this data:
f <- apply(df, 1, function(x){abs(fft(x))})
How do I go about from here to finding similar patterns? Does removing the peaks and reconstructing the inverse FFT help here?

Linear Regression Analysis of population data with R

I have a homework assignment where I need to take a CSV file based around population data around the United States and do some data analysis on the data inside. I need to find the data that exists for my state and for starters run a Linear Regression Analysis to predict the size of the population.
I've been studying R for a few weeks now, went through a LinkedIn Learning training, as well as 2 different trainings on pluralsight about R. I have also tried searching for how to do a Linear Regression Analysis in R and I find plenty of examples for how to do it when the data is perfectly laid out in a table in just the right way to Analyze.
The CSV file is laid out so that each state is defined on a single line/row so I used the filter function to grab just the data for my State and put it into a variable.
Within that dataset the population data is defined across several columns with the most important data being the Population Estimates for each year from 2010 to 2018.
library(tidyverse)
population.data <- read_csv("nst-est2018-alldata.csv")
mn.state.data <- filter(population.data, NAME == "Minnesota")
I'm looking for some help to get headed in the right direction my thought is that I will need to create to containers of data 1 having each year from 2010 to 2018 and one that contains the population data for each of those years. And then use the xyplot function with those two containers? If you have some experience in this area please help me think this through I'm not looking for anybody to do the assignment for me just want some help trying to think it through.
Edit: Here is the results of the
dput(head(population.data))
command:
structure(list(SUMLEV = c("010", "020", "020", "020", "020",
"040"), REGION = c("0", "1", "2", "3", "4", "3"), DIVISION = c("0",
"0", "0", "0", "0", "6"), STATE = c("00", "00", "00", "00", "00",
"01"), NAME = c("United States", "Northeast Region", "Midwest Region",
"South Region", "West Region", "Alabama"), CENSUS2010POP = c(308745538L,
55317240L, 66927001L, 114555744L, 71945553L, 4779736L), ESTIMATESBASE2010
= c(308758105L,
55318430L, 66929743L, 114563045L, 71946887L, 4780138L), POPESTIMATE2010 =
c(309326085L,
55380645L, 66974749L, 114867066L, 72103625L, 4785448L), POPESTIMATE2011 =
c(311580009L,
55600532L, 67152631L, 116039399L, 72787447L, 4798834L), POPESTIMATE2012 =
c(313874218L,
55776729L, 67336937L, 117271075L, 73489477L, 4815564L), POPESTIMATE2013 =
c(316057727L,
55907823L, 67564135L, 118393244L, 74192525L, 4830460L), POPESTIMATE2014 =
c(318386421L,
56015864L, 67752238L, 119657737L, 74960582L, 4842481L), POPESTIMATE2015 =
c(320742673L,
56047587L, 67869139L, 121037542L, 75788405L, 4853160L), POPESTIMATE2016 =
c(323071342L,
56058789L, 67996917L, 122401186L, 76614450L, 4864745L), POPESTIMATE2017 =
c(325147121L,
56072676L, 68156035L, 123598424L, 77319986L, 4875120L), POPESTIMATE2018 =
c(327167434L,
56111079L, 68308744L, 124753948L, 77993663L, 4887871L), NPOPCHG_2010 =
c(567980L,
62215L, 45006L, 304021L, 156738L, 5310L), NPOPCHG_2011 = c(2253924L,
219887L, 177882L, 1172333L, 683822L, 13386L), NPOPCHG_2012 = c(2294209L,
176197L, 184306L, 1231676L, 702030L, 16730L), NPOPCHG_2013 = c(2183509L,
131094L, 227198L, 1122169L, 703048L, 14896L), NPOPCHG_2014 = c(2328694L,
108041L, 188103L, 1264493L, 768057L, 12021L), NPOPCHG_2015 = c(2356252L,
31723L, 116901L, 1379805L, 827823L, 10679L), NPOPCHG_2016 = c(2328669L,
11202L, 127778L, 1363644L, 826045L, 11585L), NPOPCHG_2017 = c(2075779L,
13887L, 159118L, 1197238L, 705536L, 10375L), NPOPCHG_2018 = c(2020313L,
38403L, 152709L, 1155524L, 673677L, 12751L), BIRTHS2010 = c(987836L,
163454L, 212614L, 368752L, 243016L, 14227L), BIRTHS2011 = c(3973485L,
646265L, 834909L, 1509597L, 982714L, 59689L), BIRTHS2012 = c(3936976L,
637904L, 830701L, 1504936L, 963435L, 59070L), BIRTHS2013 = c(3940576L,
635741L, 830869L, 1504799L, 969167L, 57936L), BIRTHS2014 = c(3963195L,
632433L, 836505L, 1525280L, 968977L, 58907L), BIRTHS2015 = c(3992376L,
634515L, 837968L, 1545722L, 974171L, 59637L), BIRTHS2016 = c(3962654L,
628039L, 831667L, 1541342L, 961606L, 59388L), BIRTHS2017 = c(3901982L,
616552L, 816177L, 1519944L, 949309L, 58259L), BIRTHS2018 = c(3855500L,
609336L, 804431L, 1499838L, 941895L, 57216L), DEATHS2010 = c(598691L,
110848L, 140785L, 228706L, 118352L, 11073L), DEATHS2011 = c(2512442L,
470816L, 586840L, 962751L, 492035L, 48818L), DEATHS2012 = c(2501531L,
460985L, 584817L, 960575L, 495154L, 48364L), DEATHS2013 = c(2608019L,
480032L, 605188L, 1011093L, 511706L, 50847L), DEATHS2014 = c(2582448L,
470196L, 597078L, 1006057L, 509117L, 49692L), DEATHS2015 = c(2699826L,
488881L, 626494L, 1052360L, 532091L, 51820L), DEATHS2016 = c(2703215L,
480331L, 619471L, 1058173L, 545240L, 51662L), DEATHS2017 = c(2779436L,
501022L, 620556L, 1092949L, 564909L, 53033L), DEATHS2018 = c(2814013L,
506909L, 621030L, 1109152L, 576922L, 53425L), NATURALINC2010 = c(389145L,
52606L, 71829L, 140046L, 124664L, 3154L), NATURALINC2011 = c(1461043L,
175449L, 248069L, 546846L, 490679L, 10871L), NATURALINC2012 = c(1435445L,
176919L, 245884L, 544361L, 468281L, 10706L), NATURALINC2013 = c(1332557L,
155709L, 225681L, 493706L, 457461L, 7089L), NATURALINC2014 = c(1380747L,
162237L, 239427L, 519223L, 459860L, 9215L), NATURALINC2015 = c(1292550L,
145634L, 211474L, 493362L, 442080L, 7817L), NATURALINC2016 = c(1259439L,
147708L, 212196L, 483169L, 416366L, 7726L), NATURALINC2017 = c(1122546L,
115530L, 195621L, 426995L, 384400L, 5226L), NATURALINC2018 = c(1041487L,
102427L, 183401L, 390686L, 364973L, 3791L), INTERNATIONALMIG2010 =
c(178835L,
45723L, 25158L, 68742L, 39212L, 928L), INTERNATIONALMIG2011 = c(792881L,
206686L, 116948L, 285343L, 183904L, 4716L), INTERNATIONALMIG2012 =
c(858764L,
207584L, 120995L, 344198L, 185987L, 5874L), INTERNATIONALMIG2013 =
c(850952L,
194103L, 126681L, 329897L, 200271L, 5111L), INTERNATIONALMIG2014 =
c(947947L,
222685L, 134310L, 365281L, 225671L, 3753L), INTERNATIONALMIG2015 =
c(1063702L,
227275L, 142759L, 429088L, 264580L, 4685L), INTERNATIONALMIG2016 =
c(1069230L,
236718L, 144859L, 436795L, 250858L, 5950L), INTERNATIONALMIG2017 =
c(953233L,
215872L, 126013L, 404582L, 206766L, 3190L), INTERNATIONALMIG2018 =
c(978826L,
229700L, 127583L, 418418L, 203125L, 3344L), DOMESTICMIG2010 = c(0L,
-32918L, -50873L, 90679L, -6888L, 1238L), DOMESTICMIG2011 = c(0L,
-159789L, -186896L, 335757L, 10928L, -2239L), DOMESTICMIG2012 = c(0L,
-205314L, -181285L, 336615L, 49984L, 59L), DOMESTICMIG2013 = c(0L,
-216273L, -123814L, 293443L, 46644L, 2641L), DOMESTICMIG2014 = c(0L,
-274391L, -182730L, 373439L, 83682L, -755L), DOMESTICMIG2015 = c(0L,
-339996L, -234823L, 452879L, 121940L, -1553L), DOMESTICMIG2016 = c(0L,
-372953L, -228200L, 442633L, 158520L, -1977L), DOMESTICMIG2017 = c(0L,
-316879L, -161387L, 364465L, 113801L, 2065L), DOMESTICMIG2018 = c(0L,
-292928L, -157048L, 345132L, 104844L, 5718L), NETMIG2010 = c(178835L,
12805L, -25715L, 159421L, 32324L, 2166L), NETMIG2011 = c(792881L,
46897L, -69948L, 621100L, 194832L, 2477L), NETMIG2012 = c(858764L,
2270L, -60290L, 680813L, 235971L, 5933L), NETMIG2013 = c(850952L,
-22170L, 2867L, 623340L, 246915L, 7752L), NETMIG2014 = c(947947L,
-51706L, -48420L, 738720L, 309353L, 2998L), NETMIG2015 = c(1063702L,
-112721L, -92064L, 881967L, 386520L, 3132L), NETMIG2016 = c(1069230L,
-136235L, -83341L, 879428L, 409378L, 3973L), NETMIG2017 = c(953233L,
-101007L, -35374L, 769047L, 320567L, 5255L), NETMIG2018 = c(978826L,
-63228L, -29465L, 763550L, 307969L, 9062L), RESIDUAL2010 = c(0L,
-3196L, -1108L, 4554L, -250L, -10L), RESIDUAL2011 = c(0L, -2459L,
-239L, 4387L, -1689L, 38L), RESIDUAL2012 = c(0L, -2992L, -1288L,
6502L, -2222L, 91L), RESIDUAL2013 = c(0L, -2445L, -1350L, 5123L,
-1328L, 55L), RESIDUAL2014 = c(0L, -2490L, -2904L, 6550L, -1156L,
-192L), RESIDUAL2015 = c(0L, -1190L, -2509L, 4476L, -777L, -270L
), RESIDUAL2016 = c(0L, -271L, -1077L, 1047L, 301L, -114L), RESIDUAL2017 =
c(0L,
-636L, -1129L, 1196L, 569L, -106L), RESIDUAL2018 = c(0L, -796L,
-1227L, 1288L, 735L, -102L), RBIRTH2011 = c(12.79898857, 11.646389369,
12.449493906, 13.0753983, 13.564866164, 12.455601786), RBIRTH2012 =
c(12.589173852,
11.454833676, 12.353389372, 12.900715293, 13.172754439, 12.287820829
), RBIRTH2013 = c(12.511116578, 11.384582534, 12.318197145, 12.770698648,
13.1250523, 12.012410502), RBIRTH2014 = c(12.493440163, 11.301146646,
12.363692308, 12.814734, 12.993051496, 12.179749675), RBIRTH2015 =
c(12.493175596,
11.324209532, 12.357461907, 12.843808208, 12.92441189, 12.301816868
), RBIRTH2016 = c(12.309933949, 11.20434042, 12.242454436, 12.663079639,
12.619264908, 12.222387438), RBIRTH2017 = c(12.039095529, 10.996948983,
11.989119413, 12.357287884, 12.333939366, 11.962999487), RBIRTH2018 =
c(11.820984126,
10.863177115, 11.789576855, 12.078306222, 12.128940451, 11.720998206
), RDEATH2011 = c(8.0928244199, 8.4846099623, 8.7504877826, 8.3388830191,
6.7917918366, 10.187095914), RDEATH2012 = c(7.9990857588, 8.2779015368,
8.6968381072, 8.2343067033, 6.7700904074, 10.060744313), RDEATH2013 =
c(8.2803198685,
8.5962112289, 8.9723230665, 8.5807898649, 6.9298356343, 10.542582104
), RDEATH2014 = c(8.1408206164, 8.4020820365, 8.8249187702, 8.4524499397,
6.8267702932, 10.274434632), RDEATH2015 = c(8.4484528254, 8.7250748685,
9.2388679994, 8.7443343664, 7.0592978512, 10.689339673), RDEATH2016 =
c(8.3975028099,
8.5692003816, 9.1188486402, 8.6935469035, 7.1552465339, 10.632332792
), RDEATH2017 = c(8.5756150392, 8.9363320099, 9.1155717285, 8.8857783149,
7.3396052849, 10.889883997), RDEATH2018 = c(8.6277792774, 9.0371195009,
9.1016891619, 8.9320830002, 7.4291216994, 10.944391939), RNATURALINC2011 =
c(4.7061641498,
3.161779407, 3.6990061239, 4.7365152812, 6.7730743272, 2.2685058724
), RNATURALINC2012 = c(4.5900880929, 3.1769321388, 3.656551265,
4.66640859, 6.402664032, 2.2270765159), RNATURALINC2013 = c(4.2307967093,
2.7883713049, 3.3458740787, 4.1899087829, 6.1952166656, 1.4698283977
), RNATURALINC2014 = c(4.3526195469, 2.89906461, 3.5387735378,
4.3622840605, 6.1662812026, 1.9053150433), RNATURALINC2015 =
c(4.0447227708,
2.5991346635, 3.1185939072, 4.0994738414, 5.8651140389, 1.6124771946
), RNATURALINC2016 = c(3.912431139, 2.6351400388, 3.123605796,
3.969532736, 5.4640183742, 1.5900546466), RNATURALINC2017 =
c(3.4634804902,
2.0606169731, 2.8735476848, 3.4715095687, 4.9943340813, 1.0731154898
), RNATURALINC2018 = c(3.1932048488, 1.8260576141, 2.687887693,
3.1462232219, 4.6998187519, 0.7766062675), RINTERNATIONALMIG2011 =
c(2.5539481982,
3.7247036946, 1.7438348531, 2.4715029092, 2.5385138982, 0.9841112772
), RINTERNATIONALMIG2012 = c(2.7460490726, 3.7275831375, 1.7993217139,
2.9505576333, 2.5429438207, 1.2219173785), RINTERNATIONALMIG2013 =
c(2.7017267715,
3.4759149144, 1.8781318506, 2.7997195452, 2.7121923767, 1.0597112344
), RINTERNATIONALMIG2014 = c(2.988275652, 3.9792291689, 1.9851256285,
3.0689308523, 3.0260314993, 0.7759790947), RINTERNATIONALMIG2015 =
c(3.3285982753,
4.0561842059, 2.1052580818, 3.5654043717, 3.5102060089, 0.9664136698
), RINTERNATIONALMIG2016 = c(3.3215493142, 4.2230961065, 2.1323795548,
3.5885415898, 3.2920380658, 1.2245437674), RINTERNATIONALMIG2017 =
c(2.9410856198,
3.8503376372, 1.8510505744, 3.2892897676, 2.6864164429, 0.6550398799
), RINTERNATIONALMIG2018 = c(3.0010858795, 4.0950670621, 1.8698304564,
3.3695510667, 2.6156748143, 0.685035969), RDOMESTICMIG2011 = c(0,
-2.879569389, -2.786843372, 2.9081645678, 0.1508443529, -0.467223314
), RDOMESTICMIG2012 = c(0, -3.686820778, -2.69589683, 2.8855541222,
0.6834160664, 0.0122732593), RDOMESTICMIG2013 = c(0, -3.872925953,
-1.835626629, 2.4903472978, 0.6316815776, 0.5475831286), RDOMESTICMIG2014
= c(0,
-4.903180146, -2.700781819, 3.1374707924, 1.1220952977, -0.156105573
), RDOMESTICMIG2015 = c(0, -6.067919504, -3.462920156, 3.7630900106,
1.6177886489, -0.320350145), RDOMESTICMIG2016 = c(0, -6.653555548,
-3.359190761, 3.6365043774, 2.0802759896, -0.40687782), RDOMESTICMIG2017 =
c(0,
-5.651919379, -2.370672066, 2.963134779, 1.4785645494, 0.4240305179
), RDOMESTICMIG2018 = c(0, -5.222289092, -2.301663494, 2.7793734944,
1.350093835, 1.1713623417), RNETMIG2011 = c(2.5539481982, 0.845134306,
-1.043008519, 5.379667477, 2.6893582511, 0.516887963), RNETMIG2012 =
c(2.7460490726,
0.0407623599, -0.896575116, 5.8361117555, 3.2263598871, 1.2341906378
), RNETMIG2013 = c(2.7017267715, -0.397011039, 0.0425052219,
5.2900668429, 3.3438739543, 1.6072943629), RNETMIG2014 = c(2.988275652,
-0.923950977, -0.71565619, 6.2064016447, 4.148126797, 0.6198735214
), RNETMIG2015 = c(3.3285982753, -2.011735298, -1.357662074,
7.3284943823, 5.1279946578, 0.6460635248), RNETMIG2016 = c(3.3215493142,
-2.430459441, -1.226811206, 7.2250459672, 5.3723140554, 0.8176659475
), RNETMIG2017 = c(2.9410856198, -1.801581742, -0.519621492,
6.2524245465, 4.1649809923, 1.0790703978), RNETMIG2018 = c(3.0010858795,
-1.12722203, -0.431833037, 6.1489245611, 3.9657686492, 1.8563983107
)), .Names = c("SUMLEV", "REGION", "DIVISION", "STATE", "NAME",
"CENSUS2010POP", "ESTIMATESBASE2010", "POPESTIMATE2010",
"POPESTIMATE2011",
"POPESTIMATE2012", "POPESTIMATE2013", "POPESTIMATE2014",
"POPESTIMATE2015",
"POPESTIMATE2016", "POPESTIMATE2017", "POPESTIMATE2018", "NPOPCHG_2010",
"NPOPCHG_2011", "NPOPCHG_2012", "NPOPCHG_2013", "NPOPCHG_2014",
"NPOPCHG_2015", "NPOPCHG_2016", "NPOPCHG_2017", "NPOPCHG_2018",
"BIRTHS2010", "BIRTHS2011", "BIRTHS2012", "BIRTHS2013", "BIRTHS2014",
"BIRTHS2015", "BIRTHS2016", "BIRTHS2017", "BIRTHS2018", "DEATHS2010",
"DEATHS2011", "DEATHS2012", "DEATHS2013", "DEATHS2014", "DEATHS2015",
"DEATHS2016", "DEATHS2017", "DEATHS2018", "NATURALINC2010",
"NATURALINC2011",
"NATURALINC2012", "NATURALINC2013", "NATURALINC2014", "NATURALINC2015",
"NATURALINC2016", "NATURALINC2017", "NATURALINC2018",
"INTERNATIONALMIG2010",
"INTERNATIONALMIG2011", "INTERNATIONALMIG2012", "INTERNATIONALMIG2013",
"INTERNATIONALMIG2014", "INTERNATIONALMIG2015", "INTERNATIONALMIG2016",
"INTERNATIONALMIG2017", "INTERNATIONALMIG2018", "DOMESTICMIG2010",
"DOMESTICMIG2011", "DOMESTICMIG2012", "DOMESTICMIG2013",
"DOMESTICMIG2014",
"DOMESTICMIG2015", "DOMESTICMIG2016", "DOMESTICMIG2017",
"DOMESTICMIG2018",
"NETMIG2010", "NETMIG2011", "NETMIG2012", "NETMIG2013", "NETMIG2014",
"NETMIG2015", "NETMIG2016", "NETMIG2017", "NETMIG2018", "RESIDUAL2010",
"RESIDUAL2011", "RESIDUAL2012", "RESIDUAL2013", "RESIDUAL2014",
"RESIDUAL2015", "RESIDUAL2016", "RESIDUAL2017", "RESIDUAL2018",
"RBIRTH2011", "RBIRTH2012", "RBIRTH2013", "RBIRTH2014", "RBIRTH2015",
"RBIRTH2016", "RBIRTH2017", "RBIRTH2018", "RDEATH2011", "RDEATH2012",
"RDEATH2013", "RDEATH2014", "RDEATH2015", "RDEATH2016", "RDEATH2017",
"RDEATH2018", "RNATURALINC2011", "RNATURALINC2012", "RNATURALINC2013",
"RNATURALINC2014", "RNATURALINC2015", "RNATURALINC2016",
"RNATURALINC2017",
"RNATURALINC2018", "RINTERNATIONALMIG2011", "RINTERNATIONALMIG2012",
"RINTERNATIONALMIG2013", "RINTERNATIONALMIG2014", "RINTERNATIONALMIG2015",
"RINTERNATIONALMIG2016", "RINTERNATIONALMIG2017", "RINTERNATIONALMIG2018",
"RDOMESTICMIG2011", "RDOMESTICMIG2012", "RDOMESTICMIG2013",
"RDOMESTICMIG2014",
"RDOMESTICMIG2015", "RDOMESTICMIG2016", "RDOMESTICMIG2017",
"RDOMESTICMIG2018",
"RNETMIG2011", "RNETMIG2012", "RNETMIG2013", "RNETMIG2014", "RNETMIG2015",
"RNETMIG2016", "RNETMIG2017", "RNETMIG2018"), row.names = c(NA,
-6L), class = c("tbl_df", "tbl", "data.frame"))
In order to help you out, an example data using dput(head(population.data)) would be helpful. Based on your comments, your data is in what is called 'wide' format, meaning each observation is contained in a column, rather than a row (pupulation 2010, population 2011 etc.).
As i hinted in my comment, a sub-goal within statistical modelling is always to clean and reshape data to a proper format, that will work for running models. In this case the problem is that your format is in an incorrect shape. The most common is likely melting to long format via the reshape2 or data.table package as explained in this link. I personally prefer the data.table package, as it seems to have better large scale performance. Their usage however is identical.
Lets say you have a column 'NAME' for states and 9 columns for population estimates (2010 population estimates, 2011 population estimates and so on), we could then convert these columns into a long format, using melt from either of the two suggested packages (They are identical in use)
require(data.table)
value_columns <- paste(2010:2018, "Population Estimates")
population.data_long <- melt(population.data, id.vars = "NAME",
measure.vars = value_columns, #Columns containing values we (that are grouped by their column names)
variable.name = 'Year (Population Estimate)', #Name of the column which tells us [(Year) Population Estimate]
value.name = 'Population Estimate') #Name of the column with values
population.data_long$year <- as.integer(substr(population.data_long$`Year (Population Estimate)`, 1, 4)) #Create a year column in a bit of a hacky way
Note i have ignored any additional columns, and these should be included in your melt statement. From here on a linear regression should follow any standard example that you have found.

How to plot the forecasted values against actual values observed later in R?

We used the R library forecast to make predictions for the next 24 hours. We have the following:
fore_cast=forecast.tbats(model,h=24,level=90)
fore_cast
Point Forecast Lo 90 Hi 90
5.380952 6270.778 5389.089 7296.643
5.386905 5458.096 4557.375 6536.743
5.392857 5219.995 4248.967 6412.814
5.398810 5187.102 4126.390 6520.328
Now we have 2 problems:
We need 'time' (in hour e.g. 01,23,19 etc) instead of 'point'.
We wish to plot the trendline against time showing the actual observed
values against these predicted values. We have loaded actual observed
values from a CSV file.
We tried:
actual_data = read.csv('actualdata.csv')
plot(actual_data,fore_cast)
Doesn't work, and using plot(actual_data) just shows some points in a straight line instead of curved trendline.
EDIT:
Sample output of fore_cast from dput:
structure(list(model = structure(list(lambda = 0.000438881055939422,
alpha = 0.65694875480321, beta = -0.0983972877836753, damping.parameter = 0.800419363290521,
gamma.one.values = c(-0.00150031474145603, -0.00124696854910294
), gamma.two.values = c(0.0023600487982342, -0.002465549595849
), ar.coefficients = NULL, ma.coefficients = NULL, likelihood = 13202.294346586,
optim.return.code = 0L, variance = 0.00855092137349485, AIC = 13258.294346586,
parameters = structure(list(vect = c(0.000438881055939422,
0.65694875480321, 0.800419363290521, -0.0983972877836753,
-0.00150031474145603, -0.00124696854910294, 0.0023600487982342,
-0.002465549595849), control = structure(list(use.beta = TRUE,
use.box.cox = TRUE, use.damping = TRUE, length.gamma = 4L,
p = 0, q = 0), .Names = c("use.beta", "use.box.cox",
"use.damping", "length.gamma", "p", "q"))), .Names = c("vect",
"control")), seed.states = structure(c(7.44188559667267,
0.00357069100887873, -0.0664300680553579, 0.0229067500159256,
0.00460111570469819, -0.00772324725408007, -0.000610110386029883,
0.00568378752162509, -0.0084050648066819, -0.0324093004247092,
-0.000720936399990958, -0.00705790547321605, -0.00738992950838566,
0.00180424326179638, -0.00107745502434416, 0.00242014705705761,
-0.01824679745657, 0.0123019701003545, -0.0245935735677402,
0.0181321397860132), .Dim = c(20L, 1L)), fitted.values = structure(c(1598.57443298879,
1435.74973092922, 1397.92464316794, 1296.90202189518, 1440.3201303663,
1544.11695101118, 1777.97079874181, 1766.50571671645, 1925.27360388028,
1863.26963233038, 1773.08363764691, 1887.26580055295, 1887.48006609474,
1841.66200850472, 1991.90290660363, 2233.04775631848, 2081.30246965768,
1872.12639817609, 1899.38583561568, 2213.43437455052, 2214.00832820531,
1745.36311914995, 1678.67975050944, 1502.35472259274, 1512.27350460399,
1456.14165844166, 1464.3803467642, 1517.99443293857, 1484.54280422369,
1382.37041287489, 1452.43700910726, 1545.16934543365, 1440.50974319508,
1475.59742668699, 1544.88546424501, 1790.95280713647, 1916.4267023671,
1928.72804180587, 1819.15839770808, 1916.43079357329, 1836.80043977753,
1720.25638746452, 1730.03629161412, 1614.6048115754, 1599.23641723244,
1635.86950932066, 1543.46360784778, 1641.35066985679, 1608.60556151299,
1651.47649465456, 1475.15006990464, 1403.67294742438, 1507.58932406857,
1666.3170708439, 1696.06132797576, 1543.32187293056, 1704.58043626911,
1914.72424191575, 2109.33624862625, 2092.98934458578, 2222.13355258602,
2084.68677709368, 1962.9230489947, 2045.61547393981, 2140.30565941261,
2097.46130996426, 2126.07936955385, 2226.18935508502, 2269.54492801286,
2300.37314952852, 2398.48786829541, 2303.31270702723, 2332.74139979969,
2146.51487558643, 2101.27480789243, 2111.61910899422, 2053.57840714969,
2046.56606362537, 2073.82870990658, 2094.88831798868, 2334.85185938782,
2541.72156227893, 2502.36031483721, 2398.12240784327, 2266.35832277135,
2151.05248890962, 2266.88803633019, 2366.19453856405, 2399.97570044332,
2341.74959623409, 2144.33465155869, 2102.91952061083, 2214.48622101851,
2179.48115699957, 2288.28092735955, 2224.55218736155, 2195.1506809087,
2163.94619334319, 2161.41843642149, 2134.75060670667, 2138.77895768654,
2142.84680080931, 2258.55072549978, 2297.90237035988, 2314.94197015208,
2300.99928929609, 2277.39754662665, 2291.06980363364, 2487.04257346235,
2381.05768214413, 2509.40078456481, 2657.61336243367, 2528.65026804303,
2434.2722174014, 2366.04811963942, 2270.6647135766, 2231.33965004538,
2376.51043520344, 2249.42861599343, 2193.98771109322, 2252.12327312365,
2210.76969838623, 2180.50451255189, 2221.92898123682, 2537.84678083006,
2329.57350097532, 2252.82349908982, 2143.92033677754, 2092.3142840022,
2084.70304624685, 2111.18929138546, 2160.05383108999, 2280.94409931504,
2118.22029344747, 2214.65738250204, 2269.05911898631, 2084.26658709038,
2016.04764576402, 2095.57091797435, 2161.07354463394, 2427.77607700887,
2333.91103594967, 2234.23838054763, 2250.71557301013, 2186.97925802073,
2129.51096829218, 2115.40228652934, 2094.89231085691, 2086.41044567131,
2180.94542608489, 2105.38187642016, 2459.45788915933, 2292.36325639374,
2410.75372754831, 2375.56640249604, 2491.11938114866, 2470.51372278037,
2464.95765202085, 2600.85929020727, 2709.48518695182, 2779.77558137814,
2518.29927341458, 2344.06621605191, 2391.56719713269, 2368.68842788795,
2199.93530349068, 2113.92970206565, 2458.96718445444, 3121.97852988865,
2559.40932439262, 2331.12829078836, 2238.54586985577, 2241.91440620202,
2225.29804576634, 2154.14147781021, 2060.57980596908, 2037.30100544426,
2215.93410789353, 2364.42668160056, 2518.72871618042, 2537.34279365294,
2473.76096855791, 2623.63387707374, 2589.08335304697, 2577.0563838788,
2349.53279218826, 2305.52193868551, 2232.63712180453, 2167.50003597208,
2320.23187534213, 2281.86365949586, 2281.21119271599, 2323.2014703372,
2185.94404743238, 2140.21863271207, 2011.67723856012, 1966.52063119589,
2002.67344212857, 1952.41101080662, 1988.37461163105, 2126.75137749373,
2239.14722292367, 2320.98046489603, 2444.91847853015, 2431.69548763034,
2514.73820659393, 2505.85249387343, 2888.19773974179, 2853.20690693738,
2502.20865871069, 2524.56894781003, 2659.52271740553, 2615.9025930681,
2923.69327019152, 2754.76074569658, 2784.59488335761, 2874.24378479002,
2683.41908597168, 2733.83011888159, 2774.1325162997, 2906.41593326865,
2726.06821502751, 2460.21579967528, 2450.8035097605, 2547.39389733175,
2625.60323572861, 2827.94083526683, 2971.92012845614, 3042.90981987278,
2835.00811374845, 2846.98066660519, 2871.21876763166, 2901.99696373824,
2627.47532996657, 2583.75084300313, 2602.68041642846, 2632.8054092953,
2667.85374690972, 2639.10586730146, 2466.95799545022, 2381.06823502402,
2531.32611053776, 2407.14812148706, 2342.75701798463, 2401.73791085847,
2365.50645844524, 2404.50408575777, 2452.57343738519, 2613.15332739214,
2665.50965844576, 2723.8237337447, 2915.09266385617, 2890.17498445896,
2853.6278331055, 2868.1228183545, 2917.07803535669, 2876.59409770233,
2577.82035337979, 2581.91435020803, 2520.20342021937, 2603.37973251208,
2536.03988578365, 2510.83398648802, 2472.80606784857, 2425.51212342113,
2442.02863541673, 2465.73405821711, 2384.42988766816, 2555.51500549788,
2737.77091706275, 2425.00224845814, 2460.17325671183, 2639.16650619329,
2816.37024420397, 2755.69999167982, 2802.64991688288, 2685.12803367301,
2521.77568128564, 2500.99980614696, 2620.41659854805, 2529.25134423133,
2590.14804885984, 2318.80485234464, 2341.88940012276, 2460.21008281205,
2513.70688167177, 2437.71670675479, 2383.29782281743, 2499.36244454453,
2472.98602901478, 2491.10649022417, 2350.1405559119, 2362.78308814045,
2431.3911847573, 2321.15216823049, 2355.74203614213, 2429.60523843166,
2355.61947983433, 2346.3751018515, 2453.82214513707, 2542.98125962684,
2342.43364707529, 2302.17741211575, 2388.93541944219, 2435.41878657221, ....
Sample output from dput for actual observed values:
structure(list(index12 = c(6297.416944, 5406.865556, 4718.355556,
5304.729167, 4968.014722, 5081.130833, 5544.955, 4655.009444,
4269.023056, 4346.588333, 4511.455833, 5102.57, 4818.673333,
4862.343056, 4785.176667, 5385.005278, 6469.080833, 7166.025278,
7010.708333, 511.114167)), .Names = "index12", class = "data.frame", row.names = c(NA,
-20L))
The value of Point is unusual in spite of hour unit data. I think you failed to make a model.
Here is my example:
actual_data <- structure(list(index12 = c(6297.416944, 5406.865556, 4718.355556,
5304.729167, 4968.014722, 5081.130833, 5544.955, 4655.009444,
4269.023056, 4346.588333, 4511.455833, 5102.57, 4818.673333,
4862.343056, 4785.176667, 5385.005278, 6469.080833, 7166.025278,
7010.708333, 511.114167)),
.Names = "index12", class = "data.frame", row.names = c(NA, -20L))
# I suppose that actual_data was taken per hour.
num_actual <- as.numeric(actual_data[,1])
model <- bats(num_actual)
fore_cast <- forecast(model, h=24, level=90)
fore_cast # Point is from 21 to 44 because of length(actual_data)=20 and demanding predictions for the next 24 hours
# Point Forecast Lo 90 Hi 90
# 21 5063.207 2902.187 7224.226
# 22 5108.114 2946.988 7269.241
# :
# 44 5108.114 2944.629 7271.600
# plot() has forecast method. It draws actual_data and prediction, and paints Lo90-Hi90.
plot(fore_cast, main="")

Resources