概率上机作业1
程序员文章站
2024-02-16 10:46:10
...
第一次作业
注:无水印的图去gaygreen
第一题
a)产生 1000 个随机 变量服从标准正态变量服从标准正态 分布 N( 0,1)。
> a=rnorm(1000,0,1)
> a
[1] -1.272286767 -1.439739546 -1.577142197 -0.300379649 -0.387413411 -0.509719565
[7] 2.234016094 -0.517060159 -1.159488740 0.532285889 1.384123653 -2.156119304
[13] 1.934877252 -0.416573079 0.753170480 1.163331357 0.535230122 1.893866142
[19] 0.248060526 1.265366376 -1.205032371 -0.203918793 0.626720277 0.950830735
[25] -0.054668383 1.241737166 1.952999501 -0.351648892 -0.320895556 0.194871766
[31] 0.495396884 2.423603449 0.298776210 -0.394155104 0.163242161 -1.722109994
[37] 0.366315833 1.079698903 -0.996532110 0.408726683 0.276217164 0.660126040
[43] 0.042697891 1.104820456 0.038558481 -1.526068380 0.400393212 -0.635627673
[49] -1.652228842 0.387953327 0.899609544 0.473605568 -1.044460226 -0.563788055
[55] 1.032030206 -0.090326257 0.861538218 1.161182846 0.652539601 -0.759387236
[61] 1.922426503 1.910906110 0.619312665 3.675403495 0.677236233 0.907365142
[67] 0.643993868 -0.633543862 -0.547898546 1.811072668 -1.245436532 0.570818408
[73] -0.347689102 0.348830250 -0.537999204 -0.515857817 -1.519002673 1.228815997
[79] 0.726364197 0.258797413 0.312679505 -1.871756710 1.649968602 -0.055699846
[85] -1.199011327 2.415859892 -0.676721194 0.252711508 0.567077894 -1.297131069
[91] 0.813267248 1.753766094 0.268584479 -0.029634093 0.434472820 -0.938886823
[97] 1.769771993 -0.918349719 -0.421328022 -0.934935727 0.797206021 -0.311129170
[103] -0.432498212 -1.031555253 3.662155819 -1.051073014 1.582430632 -0.236138191
[109] -0.903966312 -1.040797255 0.190056167 -1.729560416 -0.091065989 -0.603043795
[115] 0.433050397 -0.314143431 -0.762582959 -0.616916601 1.274955553 -0.928284058
[121] 0.029715039 0.995469296 0.537534011 1.122533628 -0.969147180 0.428755906
[127] -0.923467910 -0.317074797 0.809059096 1.048178925 0.771069547 -0.121466524
[133] 0.481577079 1.903278910 -0.741412680 -0.193808990 2.759233454 0.381091861
[139] -0.098734410 1.150007372 1.991844540 0.632345647 0.652173007 1.652752458
[145] 1.618808156 -0.314635273 -1.728593240 0.317859676 0.021012868 -0.957592831
[151] -0.818949800 0.327500077 0.329610851 -0.418392592 1.335397091 -0.230914551
[157] -0.163820774 -0.920054280 1.464718051 0.576030944 0.220831747 -1.956442373
[163] -1.478659530 -1.765911128 -0.373186042 1.225792588 -0.880840921 1.674643932
[169] 0.783303930 0.209124430 -1.058991965 -2.505622710 -0.952361372 2.027198185
[175] -0.146310187 -1.162935911 0.961050338 -0.301433667 -0.574748939 -0.228265463
[181] 1.623661300 0.187524226 0.592027436 0.881106140 1.134874529 0.174880300
[187] -1.116992875 0.016806795 1.012467428 0.251642191 -0.949530254 -0.769395758
[193] -0.060733206 -0.789349142 0.969786115 2.695756149 0.399772077 -0.166640400
[199] 2.295457281 -0.358020039 -0.751267966 0.158392782 0.084682042 -1.167772988
[205] -0.637696759 -0.038831797 0.918799299 -0.509328397 0.965082515 -0.677876832
[211] -0.816962307 -0.149335459 1.118557382 1.334138598 0.334839418 1.120496242
[217] 0.372316515 0.119065046 -0.834492403 -0.259465125 -0.644209355 -1.232253366
[223] 0.319012566 -0.574453997 0.598214352 1.586703298 1.467603558 0.817424938
[229] 0.127032005 -1.630726420 -0.783776500 -1.574442306 -1.013964734 -1.188493745
[235] -0.365051690 1.206665388 0.864213791 -1.980124106 -0.366312657 0.347644187
[241] -0.894354355 1.197637153 1.842008699 -0.262478225 -1.021994843 2.404768567
[247] -0.960654784 0.833447978 0.228983764 -0.020433970 -0.841881665 -0.668943205
[253] 1.486886686 1.267051547 0.132294153 -1.694114946 1.489866038 -0.238547090
[259] 1.266807352 0.798635306 1.410428678 0.251018035 1.007938728 2.243341859
[265] 0.250256140 0.835844329 -0.427025552 -0.607903233 -0.794513278 -1.038708620
[271] 0.869818038 1.135413036 1.356658793 1.648940953 -0.997868005 0.823923123
[277] 1.570619199 -0.651017506 0.580658610 0.730145762 0.399115100 -0.565259962
[283] -1.097983512 1.379685989 0.476303881 1.661758328 1.996289804 -0.168065786
[289] -0.483423417 1.132545764 -0.821477395 -2.034219131 0.251253275 0.638334027
[295] -0.058918963 -0.838995160 1.045562862 -1.285182557 -1.609981599 -0.053890019
[301] 1.674979679 0.346602959 -0.441414370 -0.113649263 0.011942163 0.066772730
[307] -1.513366389 1.641209114 0.428330237 -0.126714256 -1.458876881 -0.312872702
[313] -0.477847148 -0.421003871 0.770735345 -2.573116861 -0.594991163 0.685085872
[319] -0.837718330 -0.801681458 -0.560372074 0.569993327 0.739636170 -0.598815039
[325] -0.244708853 0.217089612 0.324562309 -0.191784405 1.894952706 -0.703908455
[331] -0.412512125 0.236798527 0.475824305 0.348334918 -0.872421781 1.218573480
[337] 0.472774572 0.542584998 0.461478167 -0.715288147 0.288441090 -1.754309954
[343] -0.978278908 1.171072209 1.296998258 -1.463214643 0.294947500 0.567299114
[349] -0.176177740 1.189491756 -0.605967127 -1.071661049 0.592684515 -1.230323681
[355] -0.775553383 -1.388220147 0.372513568 -1.199436499 1.776420970 -0.284854849
[361] 0.718110027 0.158896492 -0.795627898 1.881453112 -0.055951542 0.213733223
[367] -1.179415841 -0.171920753 -1.427780294 -0.244620908 -0.188932136 -0.129697665
[373] 0.982871584 0.347516184 0.390213370 -1.282214239 0.790483098 -1.135584856
[379] -1.110701421 -0.450206950 -0.331157710 0.826163357 -0.930882289 0.052713332
[385] 0.089034871 -0.048879911 -1.018844536 0.347939582 0.861013837 0.051349780
[391] 1.057145684 -1.811672060 -2.544368317 1.125778977 0.740846791 1.629799936
[397] 0.175348878 1.568233714 -0.281204999 0.736456438 -0.233494351 -0.373552029
[403] 0.285965710 0.271793411 -0.803293575 -0.244378551 -0.779006161 0.078375656
[409] -0.162528241 -0.543568523 -0.763488204 0.078275308 -0.622136780 -1.391700818
[415] 1.639270516 -0.331822455 0.050384910 0.886549848 -0.556419175 -0.232059069
[421] -1.057052464 0.924619960 -2.059144653 2.120190096 -0.663302990 -0.434849319
[427] 1.764023548 1.546949050 -1.596315592 0.957383893 1.243177494 1.421615638
[433] -0.385042754 0.160420083 -1.080056410 -1.620202908 -2.552611364 -0.228154741
[439] -1.917246535 1.498233241 -0.392778491 0.590452046 -0.862525717 -0.664252870
[445] 2.997858273 1.074040289 2.405931225 -0.093189153 0.496166834 0.709047537
[451] -0.356332317 0.247212615 0.133679322 1.439581606 -0.239070964 1.642938736
[457] 0.686411478 -1.804298587 -0.063280852 -1.678058482 0.104651437 -1.496527848
[463] -0.291751586 -1.302310080 1.463200523 -0.668628376 1.233070790 -1.379278898
[469] 0.661514935 -0.259408146 -1.929644392 1.190931080 -0.779495715 -2.009100379
[475] -0.723066473 -0.219355553 0.940109739 0.892891768 -0.237392958 -0.930790608
[481] -0.016679954 0.725452008 0.025348265 -1.493420983 -1.643113674 -1.092169622
[487] -0.277486044 0.785134235 -0.110494217 1.626650527 0.017041790 -0.242041232
[493] 0.913496731 -0.958114505 1.246781064 0.439968760 -0.476925343 0.946555072
[499] -0.342216289 0.416530019 2.228252105 0.195726099 0.515314116 0.082909016
[505] 0.739876465 -0.488751790 -0.166894491 0.162615250 0.916698012 1.644029364
[511] 0.307517587 0.926003975 0.542097977 -0.427293720 -0.830642354 -0.864333976
[517] 0.008351432 -0.103470851 1.130191620 0.501159232 0.698939272 0.061010822
[523] -0.055481115 1.835001580 0.089852944 -0.577581147 -1.224095495 -0.102134997
[529] 0.894068369 -0.302263608 -0.849063277 -0.605365594 0.291974179 -1.544245613
[535] 1.430110760 0.159596486 -1.231190733 1.353899030 -2.509275192 -1.907478488
[541] -0.672799130 1.419917969 0.290108014 1.213003257 1.270471161 -0.425931821
[547] 0.398306883 0.738075578 -1.573008271 0.751885469 0.580408889 0.812021203
[553] 0.425688878 0.644905971 -0.086633242 -0.062003203 -0.623104060 -1.214724520
[559] 1.316804848 0.610495639 0.528256694 -0.815228795 -1.732024704 -0.291452446
[565] -1.034083649 1.023480723 0.945552445 1.267074398 1.280411691 0.839227036
[571] -1.074891796 0.362341117 1.351776239 -0.728114053 0.386450329 0.747142478
[577] 0.994231129 -0.894539351 0.776043362 -1.177158725 -0.377850561 -0.809717138
[583] -0.998849246 -0.055607586 -0.303300643 -0.760511507 -1.206578274 -0.378466253
[589] -0.470341941 0.692275515 -0.238252206 1.513052408 -0.585803459 1.107112954
[595] -0.437381834 1.450019708 1.384955259 -0.606559108 -0.717579757 -0.084140723
[601] 0.992653573 0.889101840 -1.788966018 -0.597794069 0.187477154 0.208375282
[607] 1.186287981 -0.498756944 -0.902829974 -0.414685710 -0.437314846 0.276983833
[613] 1.144990020 -2.094601239 -0.904111156 0.622746027 -0.475505472 1.680346745
[619] -1.438249905 0.037391752 -1.488935244 -0.416140773 -0.789098224 -0.632369921
[625] 0.870352619 -0.668103872 1.206644565 -1.706759381 1.393745624 1.510086464
[631] -0.486441791 -1.931572504 -1.357881197 1.592168843 0.400554281 0.269123679
[637] -0.380443796 -0.301573153 -0.936048474 -0.231235195 -1.567336382 0.545019097
[643] -0.271849049 0.729339394 0.720849480 -0.074655228 0.351904291 -0.837866770
[649] -0.659215717 -0.297031733 0.117989230 -0.016430065 -0.190784751 0.666886898
[655] -0.771424566 0.925508171 -0.629630505 2.234412092 0.857163018 0.575388981
[661] 0.057066842 0.296230863 0.034920924 -0.661277018 -0.020074943 -0.633919905
[667] 0.063855145 -0.568784925 1.243743700 -1.494572645 -0.179248837 -0.734905514
[673] 0.139434584 0.243790992 1.539481257 -0.523059363 1.791530939 -0.744497984
[679] 1.216504816 -0.994232256 -0.239351177 0.360276545 -0.417458610 0.717064728
[685] 1.471598695 -0.222341326 -0.476499837 -0.196552154 -1.366932818 1.441309129
[691] 0.397875080 -1.227182182 1.703247008 -0.721731324 1.639534973 0.384033095
[697] 0.489544294 0.857072472 -1.232115878 -0.341062053 -0.087668424 0.865532311
[703] 0.380821452 0.281590068 -0.508771703 -1.263037712 -1.447539621 -0.814161229
[709] 1.430633047 -2.001361966 -0.713355058 -1.424581659 1.040179564 0.385264737
[715] -0.875910985 -0.181940950 0.313282911 -1.070751338 -1.429114646 0.555922561
[721] 0.294210676 0.335826757 -0.957178267 3.002694766 0.249487709 -0.914968840
[727] -0.392607768 -0.989348759 -0.320113010 0.234150835 0.862454604 -0.652720652
[733] 1.018869864 -0.193224334 0.805924981 -0.065880086 -4.585813352 -0.027401145
[739] -1.255346812 0.938568504 -0.477673831 0.018885616 -2.029048410 0.730679597
[745] -0.334099902 -0.468890967 0.144205982 1.293136165 0.761760954 0.629159683
[751] -0.049364800 -1.082766149 -0.081426754 0.340275681 -1.482838919 -1.286735871
[757] -0.224829509 -0.179624787 -2.473045835 0.621259254 0.840302237 0.019560864
[763] -1.627437076 2.349573391 0.655715073 0.030276431 -0.042139476 -2.335263949
[769] -0.101982677 -1.281463160 0.684069164 0.900612913 1.765388158 0.580697220
[775] 0.771116436 0.629016123 1.013607386 0.835897280 0.560555828 0.395127346
[781] -1.027216514 0.303323166 0.298827099 0.556421184 -0.552431466 0.087174831
[787] 0.582273011 1.444976782 -1.055313739 0.669498068 0.628132207 -0.310523133
[793] -1.866244586 -1.062337070 0.152817813 0.466295720 1.202197814 1.221012575
[799] 2.358441496 -2.087618986 -1.329786072 -0.616475911 -0.044861780 0.116965317
[805] -0.494580823 1.276463177 0.312118292 -0.063558162 -0.027475491 -1.661660382
[811] -1.135492660 0.262560822 -1.320153739 1.159975131 -0.436912854 -0.496479846
[817] -3.093385191 0.972754143 -1.956184689 -0.406461226 1.805476930 1.034285206
[823] 0.725484320 -0.985396622 -0.058044352 0.137771727 0.606828206 0.713820007
[829] -2.170622641 -0.919910634 2.264682049 -1.323651690 -1.846588754 -0.593444599
[835] -1.266035823 -0.230447353 -0.768409376 0.611002514 -0.476761906 -0.174164005
[841] 0.393530561 -0.274123132 1.193064887 -0.510460228 -0.491518566 -0.001459399
[847] -0.759206631 0.269696904 -1.530023772 -0.181527322 -0.840994395 2.731030583
[853] 2.879320077 -0.364052089 0.926557014 0.522149165 -2.030214884 -0.184068142
[859] 1.512984037 0.975195149 -0.171715912 -0.237632030 -0.353900262 -1.997639476
[865] -0.227064459 -1.998406563 -0.572694530 -0.777149105 -0.963550689 -0.597459122
[871] 0.140954418 0.196556378 3.074860763 -0.757403023 0.026326376 -1.292310149
[877] 1.468470160 0.437059042 -0.446270308 -0.080540502 1.103347710 1.576114500
[883] 0.076602103 1.191692959 -0.529423012 2.267072218 1.107139275 -1.086597002
[889] -1.744689062 -0.817604776 -0.003462798 -0.265594790 1.281955927 -0.696266175
[895] -0.330935655 0.582103241 0.735449455 -0.855896392 1.531279534 0.324762514
[901] 0.381069575 0.839765203 -0.605795217 1.418478976 -1.563252894 1.227428729
[907] 0.173145613 0.527254833 0.410682178 0.380302872 -0.588406928 -0.897620198
[913] 1.064283375 0.620107075 0.643292398 -0.536952977 -0.290551852 0.838556333
[919] 1.057501579 -0.248157064 -1.347248934 -0.998314287 0.007268626 -0.684158868
[925] -0.599039525 -1.154373954 -1.183437398 1.869538300 -0.354941992 1.772312867
[931] -0.102812699 -0.002381763 0.010406382 0.909433789 -0.596527799 0.790769430
[937] 0.646623286 -0.570091241 -0.002172750 -2.649592358 -2.128487373 1.143587851
[943] -0.874068300 2.458965375 1.700205663 -0.565804969 -1.317959305 -0.115375263
[949] 1.637957227 0.321208362 0.758578953 -0.746675081 0.434495080 -1.537640107
[955] -0.629765997 1.415526793 -0.863784155 -0.134643260 -0.266378440 -0.397167184
[961] -1.448065933 -1.438325079 0.845355053 0.102390594 -1.372358935 -0.766739341
[967] -0.801068097 0.789843969 -0.505847528 -0.071229035 -0.747665693 0.311737809
[973] 0.615935619 1.134707165 -1.573880646 -0.336207303 -0.426903596 0.940660241
[979] -0.161815515 -0.039211550 0.161729238 0.212957822 1.661129869 -1.620450219
[985] -0.706927219 1.160682233 0.036148048 0.665653699 1.074055316 -1.010949980
[991] -0.513393007 0.676751452 -0.490318090 0.070992161 1.812488900 0.623634095
[997] 0.341276105 -1.075468301 0.304492274 -0.745034894
> length(a)
[1] 1000
计算样本期望和样本方差:
-
样本期望
> mean(a) [1] 0.03244432
-
样本方差
> var(a) [1] 1.090253
b)根据由 (a) 生成的随机变量,画所对应得直方图
> hist(a,freq=F)
并与 a) 所得到的期望和方差比较
期望很接近0,直方图的峰值在0的附近,左右近乎对称分布;
方差很接近1,大多数值分布在 之内.
第二题
a) 产生一组长度为 100 的随机向量, 记为,其中服从泊松分布P(2).
x=rpois(100,2)
> x
[1] 0 2 0 6 2 2 4 3 2 3 1 2 0 2 2 1 2 0 2 1 0 0 2 2 1 2 4 2 5 5 3 0 2 1 2 2 3 0 0 3
[41] 0 2 4 2 5 2 3 3 3 1 2 2 1 6 3 2 3 1 5 1 1 1 1 1 3 2 1 2 3 1 2 1 1 2 1 1 5 1 4 1
[81] 3 4 1 0 1 1 2 3 0 2 1 2 0 1 2 1 3 1 0 2
计算
-
均值
> mean(x) [1] 1.92
-
方差
> var(x) [1] 1.973333
直方图
> hist(x,freq=F)
b) 重复 2(a)1000次,得到 1000 组长度 为 100 的随机向量,计算每组均值,记为.
/*脚本*/
y <- list()
for (i in 1:1000) {
x=rpois(100,2)
y[i] <- matrix(mean(x))
}
/*运行脚本结果*/
[[661]]
[1] 1.98
[[662]]
[1] 2.16
[[663]]
[1] 1.94
[[664]]
[1] 2.19
[[665]]
[1] 2.11
[[666]]
[1] 2.09
[[667]]
[1] 1.87
[[668]]
[1] 1.83
[[669]]
[1] 2
[[670]]
[1] 2.12
[[671]]
[1] 1.89
[[672]]
[1] 2.09
[[673]]
[1] 2.08
[[674]]
[1] 2.11
[[675]]
[1] 2.12
[[676]]
[1] 1.82
[[677]]
[1] 1.62
[[678]]
[1] 2.03
[[679]]
[1] 2.06
[[680]]
[1] 2.17
[[681]]
[1] 1.78
[[682]]
[1] 1.9
[[683]]
[1] 1.97
[[684]]
[1] 2.05
[[685]]
[1] 2.3
[[686]]
[1] 2.14
[[687]]
[1] 2.09
[[688]]
[1] 1.68
[[689]]
[1] 1.91
[[690]]
[1] 1.76
[[691]]
[1] 2.13
[[692]]
[1] 1.7
[[693]]
[1] 1.92
[[694]]
[1] 2.06
[[695]]
[1] 1.77
[[696]]
[1] 2.06
[[697]]
[1] 2.16
[[698]]
[1] 1.94
[[699]]
[1] 2.11
[[700]]
[1] 1.96
[[701]]
[1] 2.2
[[702]]
[1] 1.87
[[703]]
[1] 1.86
[[704]]
[1] 2.03
[[705]]
[1] 2.2
[[706]]
[1] 2.25
[[707]]
[1] 1.92
[[708]]
[1] 1.92
[[709]]
[1] 2
[[710]]
[1] 2.05
[[711]]
[1] 2.12
[[712]]
[1] 1.96
[[713]]
[1] 1.96
[[714]]
[1] 2.13
[[715]]
[1] 2.03
[[716]]
[1] 1.92
[[717]]
[1] 1.87
[[718]]
[1] 2.02
[[719]]
[1] 1.96
[[720]]
[1] 1.74
[[721]]
[1] 2.09
[[722]]
[1] 1.93
[[723]]
[1] 2.17
[[724]]
[1] 2.19
[[725]]
[1] 1.99
[[726]]
[1] 2.05
[[727]]
[1] 1.93
[[728]]
[1] 1.97
[[729]]
[1] 1.88
[[730]]
[1] 1.99
[[731]]
[1] 1.93
[[732]]
[1] 2.29
[[733]]
[1] 2.15
[[734]]
[1] 1.88
[[735]]
[1] 2.03
[[736]]
[1] 2.04
[[737]]
[1] 1.95
[[738]]
[1] 1.96
[[739]]
[1] 2.13
[[740]]
[1] 2.19
[[741]]
[1] 1.96
[[742]]
[1] 1.85
[[743]]
[1] 2
[[744]]
[1] 1.86
[[745]]
[1] 2.01
[[746]]
[1] 1.95
[[747]]
[1] 2.16
[[748]]
[1] 2.02
[[749]]
[1] 1.81
[[750]]
[1] 2.32
[[751]]
[1] 2.02
[[752]]
[1] 1.9
[[753]]
[1] 2.06
[[754]]
[1] 2.05
[[755]]
[1] 2.23
[[756]]
[1] 1.88
[[757]]
[1] 1.89
[[758]]
[1] 1.94
[[759]]
[1] 1.94
[[760]]
[1] 2.14
[[761]]
[1] 2.05
[[762]]
[1] 2.6
[[763]]
[1] 1.88
[[764]]
[1] 2.13
[[765]]
[1] 2.23
[[766]]
[1] 2.04
[[767]]
[1] 2.15
[[768]]
[1] 1.98
[[769]]
[1] 1.78
[[770]]
[1] 2.23
[[771]]
[1] 2.06
[[772]]
[1] 1.96
[[773]]
[1] 2.04
[[774]]
[1] 1.81
[[775]]
[1] 1.95
[[776]]
[1] 2.11
[[777]]
[1] 1.9
[[778]]
[1] 1.81
[[779]]
[1] 1.98
[[780]]
[1] 1.93
[[781]]
[1] 2.05
[[782]]
[1] 2.16
[[783]]
[1] 2.18
[[784]]
[1] 2.15
[[785]]
[1] 2.01
[[786]]
[1] 2.08
[[787]]
[1] 2.13
[[788]]
[1] 2.1
[[789]]
[1] 1.86
[[790]]
[1] 1.88
[[791]]
[1] 2.21
[[792]]
[1] 1.99
[[793]]
[1] 2.16
[[794]]
[1] 2.17
[[795]]
[1] 1.98
[[796]]
[1] 2.08
[[797]]
[1] 1.76
[[798]]
[1] 2.17
[[799]]
[1] 1.89
[[800]]
[1] 1.97
[[801]]
[1] 1.84
[[802]]
[1] 2.04
[[803]]
[1] 1.82
[[804]]
[1] 1.79
[[805]]
[1] 1.98
[[806]]
[1] 1.87
[[807]]
[1] 1.98
[[808]]
[1] 1.86
[[809]]
[1] 1.88
[[810]]
[1] 1.97
[[811]]
[1] 1.93
[[812]]
[1] 2.03
[[813]]
[1] 1.97
[[814]]
[1] 2.07
[[815]]
[1] 1.92
[[816]]
[1] 1.92
[[817]]
[1] 2.16
[[818]]
[1] 2.05
[[819]]
[1] 1.79
[[820]]
[1] 2.04
[[821]]
[1] 1.92
[[822]]
[1] 1.84
[[823]]
[1] 1.93
[[824]]
[1] 1.78
[[825]]
[1] 1.97
[[826]]
[1] 1.92
[[827]]
[1] 1.89
[[828]]
[1] 2.02
[[829]]
[1] 1.85
[[830]]
[1] 1.9
[[831]]
[1] 1.95
[[832]]
[1] 1.95
[[833]]
[1] 2.06
[[834]]
[1] 1.95
[[835]]
[1] 2.12
[[836]]
[1] 2.09
[[837]]
[1] 2.18
[[838]]
[1] 2.16
[[839]]
[1] 2.14
[[840]]
[1] 2.03
[[841]]
[1] 1.9
[[842]]
[1] 2.34
[[843]]
[1] 2
[[844]]
[1] 1.84
[[845]]
[1] 1.89
[[846]]
[1] 1.96
[[847]]
[1] 1.9
[[848]]
[1] 1.92
[[849]]
[1] 1.86
[[850]]
[1] 1.87
[[851]]
[1] 1.94
[[852]]
[1] 1.94
[[853]]
[1] 1.84
[[854]]
[1] 1.94
[[855]]
[1] 2.04
[[856]]
[1] 2.26
[[857]]
[1] 2.04
[[858]]
[1] 1.93
[[859]]
[1] 2.02
[[860]]
[1] 2.19
[[861]]
[1] 2.19
[[862]]
[1] 2.21
[[863]]
[1] 2.03
[[864]]
[1] 1.83
[[865]]
[1] 1.98
[[866]]
[1] 1.9
[[867]]
[1] 1.87
[[868]]
[1] 2.01
[[869]]
[1] 1.77
[[870]]
[1] 2.02
[[871]]
[1] 2.05
[[872]]
[1] 1.8
[[873]]
[1] 1.95
[[874]]
[1] 2.32
[[875]]
[1] 1.94
[[876]]
[1] 1.93
[[877]]
[1] 2.08
[[878]]
[1] 2.05
[[879]]
[1] 1.93
[[880]]
[1] 1.95
[[881]]
[1] 1.97
[[882]]
[1] 1.83
[[883]]
[1] 1.89
[[884]]
[1] 2
[[885]]
[1] 1.77
[[886]]
[1] 2.14
[[887]]
[1] 2.06
[[888]]
[1] 1.82
[[889]]
[1] 2.33
[[890]]
[1] 1.93
[[891]]
[1] 1.95
[[892]]
[1] 2.09
[[893]]
[1] 2.09
[[894]]
[1] 1.63
[[895]]
[1] 1.81
[[896]]
[1] 1.98
[[897]]
[1] 1.91
[[898]]
[1] 2.01
[[899]]
[1] 2.09
[[900]]
[1] 2.22
[[901]]
[1] 1.82
[[902]]
[1] 2.06
[[903]]
[1] 1.92
[[904]]
[1] 2.13
[[905]]
[1] 1.93
[[906]]
[1] 1.84
[[907]]
[1] 1.68
[[908]]
[1] 1.94
[[909]]
[1] 2.07
[[910]]
[1] 2
[[911]]
[1] 2.07
[[912]]
[1] 1.94
[[913]]
[1] 1.97
[[914]]
[1] 2.09
[[915]]
[1] 2.08
[[916]]
[1] 2.11
[[917]]
[1] 2.02
[[918]]
[1] 2.26
[[919]]
[1] 2.18
[[920]]
[1] 1.96
[[921]]
[1] 2
[[922]]
[1] 2.15
[[923]]
[1] 2.13
[[924]]
[1] 2.15
[[925]]
[1] 2.03
[[926]]
[1] 1.84
[[927]]
[1] 1.88
[[928]]
[1] 2
[[929]]
[1] 1.94
[[930]]
[1] 1.92
[[931]]
[1] 1.81
[[932]]
[1] 1.95
[[933]]
[1] 1.64
[[934]]
[1] 1.86
[[935]]
[1] 1.63
[[936]]
[1] 2.07
[[937]]
[1] 1.78
[[938]]
[1] 1.93
[[939]]
[1] 2.04
[[940]]
[1] 1.71
[[941]]
[1] 2.11
[[942]]
[1] 1.72
[[943]]
[1] 1.86
[[944]]
[1] 1.79
[[945]]
[1] 2
[[946]]
[1] 2.11
[[947]]
[1] 2.26
[[948]]
[1] 2.12
[[949]]
[1] 2.08
[[950]]
[1] 2.02
[[951]]
[1] 2.29
[[952]]
[1] 2.02
[[953]]
[1] 2.14
[[954]]
[1] 1.93
[[955]]
[1] 2.24
[[956]]
[1] 1.96
[[957]]
[1] 2.11
[[958]]
[1] 2.24
[[959]]
[1] 1.78
[[960]]
[1] 1.86
[[961]]
[1] 2.1
[[962]]
[1] 2.21
[[963]]
[1] 2.17
[[964]]
[1] 2.14
[[965]]
[1] 1.91
[[966]]
[1] 1.86
[[967]]
[1] 1.97
[[968]]
[1] 2.16
[[969]]
[1] 2.09
[[970]]
[1] 1.71
[[971]]
[1] 1.84
[[972]]
[1] 1.97
[[973]]
[1] 1.97
[[974]]
[1] 2.22
[[975]]
[1] 1.84
[[976]]
[1] 1.75
[[977]]
[1] 2.21
[[978]]
[1] 2
[[979]]
[1] 1.97
[[980]]
[1] 1.84
[[981]]
[1] 1.92
[[982]]
[1] 2.22
[[983]]
[1] 1.97
[[984]]
[1] 2
[[985]]
[1] 1.93
[[986]]
[1] 2.21
[[987]]
[1] 2.23
[[988]]
[1] 2.32
[[989]]
[1] 1.97
[[990]]
[1] 1.99
[[991]]
[1] 1.8
[[992]]
[1] 2.16
[[993]]
[1] 1.86
[[994]]
[1] 2.06
[[995]]
[1] 1.93
[[996]]
[1] 1.84
[[997]]
[1] 1.93
[[998]]
[1] 1.97
[[999]]
[1] 2.08
[[1000]]
[1] 1.76
c) 标准化,求均值方差。
for (i in 1:1000) {
y[i] <- (mean(rpois(100,2)))
}
sy <- list()
for (i in 1:1000) {
sy[i] = ((y[[i]]-2)/sqrt(2/100))
}
均值
mean(sy)
0.0136
方差
var(sy)
0.9801
c) 直方图
hist(sy)
相较于(a)中的更加集中在0的附近
推荐阅读
-
概率上机作业1
-
荐 【python】作业1参考答案
-
三个点在同一个半圆的概率_Cartographer源码阅读之附 1—probability_values.h/c:占据概率相关...
-
第四章 数据查询1(上机)
-
js实现1,2,3,5的出现按照一定的概率
-
2012年计算机二级Access上机模拟试题(1)
-
第1次作业-Numpy练习
-
1.java小作业-计算1到100的整合-指定输入多少行输出就打印多少行-打印24小时60分钟每一分钟-重载基础练习-面向java编程初学者
-
第一次作业:关于Linux 2.6.20进程模型和O(1)调度器算法的分析
-
【操作系统作业—lab1】linux shell脚本 遍历目标文件夹和所有文件 | 包括特殊字符文件名的处理