Z obou datových souborů načtěte texty k analýze. Pro každý text zvlášť zjistěte absolutní četnosti jednotlivých znaků (symbolů včetně mezery), které se v textech vyskytují. Dále předpokládejme, že první text je vygenerován z homogenního markovského řetězce s diskrétním časem.
preface most of the adventures recorded in this book really occurred one or two were experiences of my own the rest those of boys who were schoolmates of mine huck finn is drawn from life tom sawyer also but not from an individual he is a combination of the characteristics of three boys whom i knew and therefore belongs to the composite order of architecture the odd superstitions touched upon were all prevalent among children and slaves in the west at the period of this story that is to say thirty or forty years ago although my book is intended mainly for the entertainment of boys and girls i hope it will not be shunned by men and women on that account for part of my plan has been to try to pleasantly remind adults of what they once were themselves and of how they felt and thought and talked and what queer enterprises they sometimes engaged in the author hartford chapter i tom no answer tom no answer what s gone with that boy i wonder you tom no answer the old lady pulled her spectacles down and looked over them about the room then she put them up and looked out under them she seldom or never looked through them for so small a thing as a boy they were her state pair the pride of her heart and were built for style not service she could have seen through a pair of stove lids just as well she looked perplexed for a moment and then said not fiercely but still loud enough for the furniture to hear well i lay if i get hold of you i ll she did not finish for by this time she was bending down and punching under the bed with the broom and so she needed breath to punctuate the punches with she resurrected nothing but the cat i never did see the beat of that boy she went to the open door and stood in it and looked out among the tomato vines and jimpson weeds that constituted the garden no tom so she lifted up her voice at an angle calculated for distance and shouted y o u u tom there was a slight noise behind her and she turned just in time to seize a small boy by the slack of his roundabout and arrest his flight there i might a thought of that closet what you been doing in there nothing nothing look at your hands and look at your mouth what is that truck i don t know aunt well i know it s jam that s what it is forty times i ve said if you didn t let that jam alone i d skin you hand me that switch the switch hovered in the air the peril was desperate my look behind you aunt the old lady whirled round and snatched her skirts out of danger the lad fled on the instant scrambled up the high board fence and disappeared over it his aunt polly stood surprised a moment and then broke into a gentle laugh hang the boy can t i never learn anything ain t he played me tricks enough like that for me to be looking out for him by this time but old fools is the biggest fools there is can t learn an old dog new tricks as the saying is but my goodness he never plays them alike two days and how is a body to know what s coming he pears to know just how long he can torment me before i get my dander up and he knows if he can make out to put me off for a minute or make me laugh it s all down again and i can t hit him a lick i ain t doing my duty by that boy and that s the lord s truth goodness knows spare the rod and spile the child as the good book says i m a laying up sin and suffering for us both i know he s full of the old scratch but laws a me he s my own dead sister s boy poor thing and i ain t got the heart to lash him somehow every time i let him off my conscience does hurt me so and every time i hit him my old heart most breaks well a well man that is born of woman is of few days and full of trouble as the scripture says and i reckon it s so he ll play hookey this evening and southwestern for afternoon i ll just be obleeged to make him work tomorrow to punish him it s mighty hard to make him work saturdays when all the boys is having holiday but he hates work more than he hates anything else and i ve got to do some of my duty by him or i ll be the ruination of the child tom did play hookey and he had a very good time he got back home barely in season to help jim the small colored boy saw next day s wood and split the kindlings before supper at least he was there in time to tell his adventures to jim while jim did three fourths of the work tom s younger brother or rather half brother sid was already through with his part of the work picking up chips for he was a quiet boy and had no adventurous trouble some ways while tom was eating his supper and stealing sugar as opportunity offered aunt polly asked him questions that were full of guile and very deep for she wanted to trap him into damaging revealments like many other simple hearted souls it was her pet vanity to believe she was endowed with a talent for dark and mysterious diplomacy and she loved to contemplate her most transparent devices as marvels of low cunning said she tom it was middling warm in school warn t it yes m powerful warm warn t it yes m didn t you want to go in a swimming tom a bit of a scare shot through tom a touch of uncomfortable suspicion he searched aunt polly s face but it told him nothing so he said no m well not very much the old lady reached out her hand and felt tom s shirt and said but you ain t too warm now though and it flattered her to reflect that she had discovered that the shirt was dry without anybody knowing that that was what she had in her mind but in spite of her tom knew where the wind lay now so he forestalled what might be the next move some of us pumped on our heads mine s damp yet see aunt polly was vexed to think she had overlooked that bit of circumstantial evidence and missed a trick then she had a new inspiration tom you didn t have to undo your shirt collar where i sewed it to pump on your head did you unbutton your jacket the trouble vanished out of tom s face he opened his jacket his shirt collar was securely sewed bother well go long with you i d made sure you d played hookey and been a swimming but i forgive ye tom i reckon you re a kind of a singed cat as the saying is better n you look this time she was half sorry her sagacity jonathan harker s journal kept in shorthand may bistritz left munich at p m on st may arriving at vienna early next morning should have arrived at but train was an hour late buda pesth seems a wonderful place from the glimpse which i got of it from the train and the little i could walk through the streets i feared to go very far from the station as we had arrived late and would start as near the correct time as possible the impression i had was that we were leaving the west and entering the east the most western of splendid bridges over the danube which is here of noble width and depth took us among the traditions of turkish rule we left in pretty good time and came after nightfall to klausenburgh here i stopped for the night at the hotel royale i had for dinner or rather supper a chicken done up some way with red pepper which was very good but thirsty mem get recipe for mina i asked the waiter and he said it was called paprika hendl and that as it was a national dish i should be able to get it anywhere along the carpathians i found my smattering of german very useful here indeed i don t know how i should be able to get on without it having had some time at my disposal when in london i had visited the british museum and made search among the books and maps in the library regarding transylvania it had struck me that some foreknowledge of the country could hardly fail to have some importance in dealing with a nobleman of that country i find that the district he named is in the extreme east of the country just on the borders of three states transylvania moldavia and bukovina in the midst of the carpathian mountains one of the wildest and least known portions of europe i was not able to light on any map or work giving the exact locality of the castle dracula as there are no maps of this country as yet to compare with our own ordnance survey maps but i found that bistritz the post town named by count dracula is a fairly well known place i shall enter here some of my notes as they may refresh my memory when i talk over my travels with mina in the population of transylvania there are four distinct nationalities saxons in the south and mixed with them the wallachs who are the descendants of the dacians magyars in the west and szekelys in the east and north i am going among the latter who claim to be descended from attila and the huns this may be so for when the magyars conquered the country in the eleventh century they found the huns settled in it i read that every known superstition in the world is gathered into the horseshoe of the carpathians as if it were the centre of some sort of imaginative whirlpool if so my stay may be very interesting mem i must ask the count all about them i did not sleep well though my bed was comfortable enough for i had all sorts of queer dreams there was a dog howling all night under my window which may have had something to do with it or it may have been the paprika for i had to drink up all the water in my carafe and was still thirsty towards morning i slept and was wakened by the continuous knocking at my door so i guess i must have been sleeping soundly then i had for breakfast more paprika and a sort of porridge of maize flour which they said was mamaliga and egg plant stuffed with forcemeat a very excellent dish which they call impletata mem get recipe for this also i had to hurry breakfast for the train started a little before eight or rather it ought to have done so for after rushing to the station at i had to sit in the carriage for more than an hour before we began to move it seems to me that the further east you go the more unpunctual are the trains what ought they to be in china all day long we seemed to dawdle through a country which was full of beauty of every kind sometimes we saw little towns or castles on the top of steep hills such as we see in old missals sometimes we ran by rivers and streams which seemed from the wide stony margin on each side of them to be subject to great floods it takes a lot of water and running strong to sweep the outside edge of a river clear at every station there were groups of people sometimes crowds and in all sorts of attire some of them were just like the peasants at home or those i saw coming through france and germany with short jackets and round hats and home made trousers but others were very picturesque the women looked pretty except when you got near them but they were very clumsy about the waist they had all full white sleeves of some kind or other and most of them had big belts with a lot of strips of something fluttering from them like the dresses in a ballet but of course there were petticoats under them the strangest figures we saw were the slovaks who were more barbarian than the rest with their big cow boy hats great baggy dirty white trousers white linen shirts and enormous heavy leather belts nearly a foot wide all studded over with brass nails they wore high boots with their trousers tucked into them and had long black hair and heavy black moustaches they are very picturesque but do not look prepossessing on the stage they would be set down at once as some old oriental band of brigands they are however i am told very harmless and rather wanting in natural self assertion it was on the dark side of twilight when we got to bistritz which is a very interesting old place being practically on the frontier for the borgo pass leads from it into bukovina it has had a very stormy existence and it certainly shows marks of it fifty years ago a series of great fires took place which made terrible havoc on five separate occasions at the very beginning
Prvni text: symbol četnost a 360 b 79 c 93 d 241 e 541 f 101 g 86 h 325 i 301 j 12 k 62 l 195 m 151 n 315 o 440 p 81 q 3 r 260 s 299 t 473 u 155 v 42 w 119 x 5 y 124 z 1 1259
Druhy text: symbol četnost a 391 b 69 c 94 d 171 e 542 f 104 g 96 h 281 i 300 j 6 k 45 l 169 m 136 n 278 o 341 p 72 q 4 r 299 s 290 t 468 u 117 v 52 w 118 x 8 y 96 z 5 1079
1. Za předpokladu výše odhadněte matici přechodu markovského řetězce pro první text. Pro odhad matice přechodu vizte přednášku 17. Odhadnuté pravděpodobnosti přechodu vhodně graficky znázorněte, např. použitím heatmapy.
2. Na základě matice z předchozího bodu najděte stacionární rozdělení π tohoto řetězce pro první text.
pi hodnota 0 0.058796 1 0.012909 2 0.015191 3 0.039362 4 0.088345 5 0.016500 6 0.014046 7 0.053095 8 0.049163 9 0.001961 10 0.010128 11 0.031824 12 0.024667 13 0.051449 14 0.071884 15 0.013060 16 0.000490 17 0.042455 18 0.048854 19 0.077265 20 0.025303 21 0.006860 22 0.019442 23 0.000816 24 0.020254 25 0.000163 26 0.205716
3. Porovnejte rozdělení znaků druhého textu se stacionárním rozdělením π, tj. na hladině významnosti 5 % otestujte hypotézu, že rozdělení znaků druhého textu se rovná rozdělení π z předchozího bodu.
Nij Pi Sigma a 360.008974 391.0 b 79.040160 69.0 c 93.015114 94.0 d 241.011934 171.0 e 540.936138 542.0 f 101.031614 104.0 g 86.005477 96.0 h 325.098609 281.0 i 301.026957 300.0 j 12.005692 6.0 k 62.013576 45.0 l 194.860191 169.0 m 151.037848 136.0 n 315.021684 278.0 o 440.142711 341.0 p 79.966566 72.0 q 3.001423 4.0 r 259.949735 299.0 s 299.134312 290.0 t 473.095397 468.0 u 154.931280 117.0 v 42.005246 52.0 w 119.046161 118.0 x 4.999410 8.0 y 124.016485 96.0 z 1.000090 5.0 1259.597216 1079.0
Nij Pi Sigma a 360.008974 391.0 b 79.040160 69.0 c 93.015114 94.0 d 241.011934 171.0 e 540.936138 542.0 f 101.031614 104.0 g 86.005477 96.0 h 325.098609 281.0 i 301.026957 300.0 j 12.005692 6.0 k 62.013576 45.0 l 194.860191 169.0 m 151.037848 136.0 n 315.021684 278.0 o 440.142711 341.0 p 79.966566 72.0 qxz 9.000922 17.0 r 259.949735 299.0 s 299.134312 290.0 t 473.095397 468.0 u 154.931280 117.0 v 42.005246 52.0 w 119.046161 118.0 y 124.016485 96.0 1259.597216 1079.0
Marginaly pi_ = [[0.47907095] [0.52092905]] p_j = [[0.06389391 0.01259487 0.01591076 0.03505291 0.09213341 0.01744356 0.01548456 0.05156531 0.05113382 0.00153188 0.00910444 0.03095629 0.02442044 0.05045276 0.06645761 0.01292892 0.00221209 0.047554 0.05012203 0.08006597 0.02313521 0.00799772 0.02016728 0.01871844 0.19896182]] Teoreticke cetnosti npipj [[ 359.78658628 70.92174059 89.5935092 197.38295073 518.80324917 98.22469118 87.19353742 290.36423923 287.93455817 8.62600419 51.26709602 174.3148491 137.51149589 284.09946416 374.22278411 72.80276783 12.45628672 267.77658306 282.23713738 450.85147002 130.27437767 45.03518272 113.56193079 105.40350754 1120.35400083] [ 391.22238817 77.11841904 97.42160483 214.62898371 564.13288842 106.80692312 94.8119392 315.73436989 313.09239917 9.3796881 55.74648 189.54534204 149.52635222 308.92221969 406.91992668 79.16379816 13.54463569 291.17315185 306.89717495 490.24392664 141.65690187 48.97006283 123.48423055 114.61297756 1218.2432156 ]]
stupeň volnosti: 24 kriticka hodnota: 36.415028501807306 testová statistika: 49.03331051110915 p-hodnota: 0.0018760803600106465 Zamitame H0