Question

In: Math

R Simulation:Write an R code that does the following: (a) Generate n samples x from a...

R Simulation:Write an R code that does the following:

(a) Generate n samples x from a random variable X that has a uniform density on [0,3].

(b) Now generate samples of Y using the equation: y = α x + β

(c) For starters, set α = 1, β = 1.

Solutions

Expert Solution

# Command

# a) Generate n samples x from a random variable X that has a
# uniform density on [0,3].

x=runif(n=1000, min = 0, max = 3)
x

# (b) Now generate samples of Y using the equation: y = α x + β
# by setting α = 1, β = 1.

y=1*x*1
y

## Result

> # a) Generate n samples x from a random variable X that has a
> # uniform density on [0,3].
>
> x=runif(n=1000, min = 0, max = 3)
> x
[1] 2.676802092 2.647266751 1.142663233 0.904854520 1.265866985 0.325854298
[7] 0.894797261 1.357160680 0.727363242 0.309877805 2.192792193 1.904744571
[13] 0.280010416 0.948966312 1.292643484 0.875926370 0.566390444 0.374292284
[19] 0.851245773 1.532447577 1.030802960 2.636592830 2.207418869 0.525802504
[25] 2.722728894 0.435688520 1.963871353 1.888447433 0.120782048 0.675865368
[31] 0.968241070 1.400812750 0.360185143 0.461715393 1.633237300 2.135191188
[37] 0.294834923 0.327644398 0.483224281 1.526024804 2.638749729 1.478006466
[43] 0.265844068 0.797292060 0.109200684 0.840625135 1.542920876 0.328529871
[49] 2.856175290 0.453143700 1.296332157 0.732526272 0.656189739 2.875638968
[55] 1.766858028 1.712032260 0.019516400 2.771668484 0.438898775 2.106072068
[61] 1.992352557 0.065972863 0.775083967 0.021375590 1.169381370 1.347733125
[67] 1.044571696 0.643344127 2.011164244 0.718011632 1.699650990 1.418938603
[73] 1.416186175 0.034627883 2.629104369 1.720379209 2.265726412 0.111018760
[79] 2.881741571 2.813602321 0.064045459 1.086367323 0.794659439 2.634215939
[85] 1.708043943 2.793018612 1.537711808 1.315281914 1.133780782 2.106808895
[91] 0.864058798 2.916466886 1.736698017 0.049541139 0.119374737 1.853509666
[97] 1.652494699 0.075735923 1.406412591 1.703051053 1.594400414 2.601438700
[103] 2.616584104 2.354931562 1.874945610 1.077878064 0.255736993 2.698710989
[109] 0.015617120 2.620048924 1.209274315 2.349230856 2.599505916 1.488369063
[115] 2.950331909 2.827827287 1.455684650 0.450013462 1.789377334 2.112566150
[121] 1.401627458 1.512398987 0.809010925 1.970042960 2.836847333 0.975467973
[127] 1.139072646 2.444285722 1.746892262 2.827174183 0.953314464 1.355272904
[133] 1.544772302 0.937084564 1.206254232 1.803770050 0.566893601 2.530928078
[139] 0.938602198 1.889064001 2.910973602 2.680789822 0.731735594 1.546938195
[145] 0.238630167 1.629107094 0.695593747 1.207905935 1.042162632 0.203724205
[151] 0.632919237 2.054258195 1.497964252 0.643118813 1.284844618 2.162731552
[157] 0.520032645 1.645939377 2.845823622 2.316532753 0.219192153 0.956918137
[163] 0.863959063 1.818817488 2.890135624 2.766651844 2.833007193 0.541888791
[169] 2.070374697 2.903043843 0.971133204 2.027751713 1.840560631 1.345358645
[175] 0.839752283 2.225680668 0.307684067 2.347342610 0.570524600 0.525931107
[181] 1.334087865 0.548665835 0.166540833 0.943286261 1.416852695 2.437104883
[187] 1.679533850 1.208425318 0.008908470 2.917420946 1.864684974 1.082178421
[193] 1.025405228 1.181058393 2.262259800 1.558967675 0.487566486 2.518634196
[199] 2.683709018 2.122739435 2.415099974 2.370522309 0.526187401 1.147688439
[205] 1.882783848 0.572579823 0.943623411 0.159254387 0.164722740 0.493067731
[211] 1.896636432 0.065627435 0.909611362 0.779255184 2.190603917 1.735775188
[217] 2.568100779 1.794239729 1.357593931 2.103323856 2.152039629 1.874829559
[223] 0.270037810 0.274548172 2.185426628 1.513420845 1.486891034 1.108369045
[229] 1.361194534 1.820851286 1.845158414 0.717087555 0.585436119 1.039223725
[235] 1.615378193 0.591485264 2.974604244 2.136148182 0.920994455 0.693502574
[241] 1.687219707 0.344380286 1.986613385 0.701016198 1.548732808 2.897491619
[247] 2.809449624 0.091892229 0.817399122 0.491817229 2.087130647 1.638454056
[253] 0.781764665 1.958740574 1.238035155 0.402622561 1.553263854 2.476417525
[259] 1.563846064 2.801636185 1.347773578 0.266262873 0.660696280 1.478670565
[265] 1.757935020 2.243785667 2.881021964 2.493581293 2.011086601 1.305899799
[271] 2.650949181 0.927301773 1.240218987 2.680989374 0.799822787 0.234812291
[277] 2.151554628 0.352742162 2.208097669 1.747685115 1.189757076 0.799678921
[283] 0.553603120 0.876132644 0.858621846 1.268829903 0.460254866 1.491486340
[289] 0.511196380 1.629076075 1.078909002 2.520935616 2.490863852 1.535810899
[295] 2.326194568 0.938564472 2.986176671 2.141291746 2.979448672 2.973308258
[301] 2.589439893 1.380489572 2.719310785 1.307115020 2.449838760 2.278591066
[307] 1.159107445 1.263092554 0.833318748 2.811367192 0.769104353 1.935307031
[313] 0.124821315 2.492760432 0.910199342 0.904291116 1.143728853 2.731029775
[319] 0.556950248 1.205866857 0.894270189 0.533762487 0.328521761 1.493319459
[325] 0.993925350 1.103897452 2.476268664 2.027373120 0.587475296 0.197113599
[331] 1.800156025 2.872851696 1.571103775 0.888057601 1.601705143 0.399493226
[337] 1.718234446 2.338849854 0.347306270 1.803484111 2.114343847 1.840105937
[343] 1.516471511 2.976729618 1.376613035 2.760030944 1.374084817 1.755401920
[349] 1.870346736 2.333880160 0.096258027 1.926458673 1.111396355 1.787529452
[355] 1.662747940 0.058420943 2.399623944 0.387071269 1.445820604 1.734271264
[361] 2.963552524 0.654075243 1.867877332 1.157613241 1.141600071 2.585877505
[367] 2.875310110 1.264296569 2.635827196 1.879010610 1.214081643 1.522207294
[373] 1.777240050 2.774328301 1.450969805 0.838394711 2.999960462 0.885667841
[379] 0.556020925 1.202312118 1.592085056 1.315280053 0.398515301 2.053895853
[385] 1.374793099 0.044952307 2.098011162 2.547326184 0.826419795 1.423389510
[391] 2.633057055 2.982308631 0.820249675 1.623682461 0.826390242 1.307686623
[397] 0.219340400 2.597372848 0.538275958 0.214039839 2.892392841 2.702985528
[403] 1.263740700 2.891550131 0.277858643 1.386701037 2.413661564 1.093548317
[409] 1.566984355 1.262001750 0.713726285 2.891250931 0.013119290 1.097069383
[415] 2.166478035 0.180916968 0.858717191 2.228131058 1.117739244 1.283515663
[421] 2.882668938 1.265347830 1.606090075 1.551382755 2.553674325 2.493271854
[427] 0.801173080 2.398023040 1.108120937 0.209957281 1.455545916 2.125412311
[433] 1.844793035 0.642294946 2.895708099 1.061425817 2.947552524 2.571776104
[439] 2.034827612 2.736889469 1.928857241 1.999859019 2.557839039 1.537654473
[445] 0.210301799 1.779655425 1.876558801 1.732081353 2.486056336 1.492660909
[451] 2.035036644 2.099993255 1.391467337 2.793796331 1.414763335 0.261239130
[457] 0.979563270 1.679364236 1.798135735 2.177388164 0.191806728 2.971540978
[463] 2.352038087 0.662788665 0.077260001 2.984600870 0.501800965 2.282185377
[469] 1.082891475 0.119997015 2.374057999 0.378100640 2.413587602 0.940722417
[475] 0.988678792 1.748621525 0.110095273 0.892559128 0.804474367 0.480486205
[481] 0.768176522 1.918965984 2.046678430 1.528228917 0.403173198 0.505911958
[487] 0.180515137 2.242188504 0.245482223 2.941010605 1.929560593 0.930993567
[493] 1.043893739 0.008120488 1.603958904 1.394178220 1.587791387 0.749835637
[499] 1.147182121 2.493283454 0.175073508 2.010901216 0.811632408 2.170075509
[505] 0.343706899 0.373357506 0.866600188 1.131940152 0.786469580 1.123410932
[511] 0.753313065 0.387015299 0.736521449 0.434035504 1.853079937 1.051070089
[517] 1.366217450 0.121740223 0.730741778 1.761940765 1.361690845 1.254293365
[523] 0.868425224 1.315852898 2.810424606 0.234080449 1.255732516 1.243656577
[529] 2.948490043 2.314766808 2.923328966 1.126326464 1.140850061 2.343640965
[535] 0.378718517 0.608485678 2.975297461 2.799542012 2.581840408 0.559951908
[541] 1.288209561 1.338027007 1.353994786 1.487170896 2.519385746 2.170981879
[547] 1.629825548 1.980487828 1.278012568 0.370287517 2.845085302 1.046344909
[553] 0.901026674 0.536236286 1.310885476 1.208352573 0.987095816 2.395847655
[559] 2.949781163 1.702588726 1.162315852 1.520945266 1.730786630 2.777827939
[565] 1.246571668 0.411753007 2.238370216 1.841595821 0.889438743 2.868993031
[571] 1.824373902 2.703819947 2.508461246 0.075342400 2.877531174 0.217118677
[577] 1.455378370 1.282544254 0.041145917 1.376377327 0.023849883 2.095277386
[583] 0.077475472 1.406784612 1.940246231 1.250818724 1.539158506 2.847951739
[589] 1.734721299 1.828714567 1.987944703 2.665985271 1.547963228 0.284522977
[595] 1.605389050 1.581501719 0.166564085 1.366428263 2.679443274 2.175215405
[601] 2.770628903 0.445961741 1.464759237 1.263358206 0.299488102 2.081664316
[607] 0.298914067 2.802991329 1.193385364 2.038833054 0.596322545 1.666535515
[613] 0.506859632 1.044796490 2.623166213 2.647858894 2.216643811 0.852435834
[619] 2.340621638 0.761346379 1.148077515 2.649329115 0.726563766 1.118275736
[625] 0.857698032 2.193755225 0.969061602 1.072396305 1.765542267 2.792453825
[631] 2.709633999 0.431035277 1.980526413 2.111790321 0.576525740 0.916906342
[637] 2.998403637 2.469324647 2.375635939 0.594457795 2.216809930 1.581765660
[643] 0.950612207 2.258478628 1.826993378 2.154989818 1.621331092 2.350716449
[649] 1.194374752 1.169968776 1.711673138 1.131793747 2.662144273 1.308473506
[655] 1.774351457 1.086471499 2.897480187 1.903999815 0.376742049 0.008849337
[661] 0.742757337 1.920297991 0.964314847 2.531681783 0.574159132 1.636374225
[667] 2.713975519 1.394547201 1.619194751 0.508388424 0.829940780 1.411039627
[673] 0.225203106 2.453193176 0.996267595 0.174878740 1.669997490 1.506066393
[679] 0.620681652 2.564817844 0.721691995 1.354753877 0.332894717 1.477819417
[685] 0.582811601 2.315756100 1.094756807 2.998259368 0.486095076 2.571141628
[691] 1.040963495 2.867842658 2.771559647 0.477956310 0.736177634 2.784443681
[697] 2.840800912 0.694399514 2.899027302 1.669307260 1.536367684 2.158492385
[703] 0.565437707 1.636142834 0.596779204 2.542176963 2.979296997 2.104508631
[709] 0.445636817 1.801847886 2.595369193 1.405879471 2.951325785 1.609670775
[715] 0.900235302 0.941198111 0.963548005 0.281636490 2.044759199 0.531367521
[721] 2.289250423 0.383434904 2.636865567 1.976923543 2.929048050 1.509989969
[727] 1.430741412 2.091164003 2.737919751 2.621091903 2.638037063 1.798433441
[733] 0.356278604 2.166462281 1.362444885 2.842279608 1.061248317 0.319539345
[739] 0.270907212 0.232214879 2.775776910 2.851253719 2.856140597 0.559870681
[745] 1.916470021 1.731711600 1.821771835 0.113905740 0.172391079 0.999022463
[751] 1.371089315 2.017777717 0.023879154 0.450930475 0.042052663 1.967815916
[757] 2.988283878 1.523767370 0.650876921 1.748941905 0.423612293 1.649035601
[763] 1.937604636 2.646937842 2.950167339 2.607838984 1.342940197 1.890220799
[769] 0.426096788 2.244312792 2.331070727 2.905399644 2.219416856 2.775482757
[775] 1.646428223 0.204037302 2.816041595 1.564781236 0.450506593 2.479341987
[781] 0.242711648 0.447008561 2.288215351 0.586899045 0.455664067 1.053952867
[787] 1.970310149 0.839073625 1.250480843 0.330354312 0.011150497 0.100755906
[793] 1.685669449 2.352617451 1.946448607 1.351369270 1.592186424 2.723212974
[799] 1.596676102 0.674400272 0.147289508 1.800336253 2.341951106 2.644274957
[805] 0.023012056 1.424707533 2.868350438 2.916999731 2.806863906 2.257690983
[811] 1.235041182 2.369721034 1.480285781 0.899806588 0.369491091 2.702258821
[817] 1.626866318 2.718381303 2.509623988 1.398341333 1.289999171 2.436285048
[823] 2.883421427 1.031854587 0.058766908 2.732582415 2.231158694 0.002495152
[829] 1.993744340 0.968663843 0.734666400 2.307582897 1.982631068 2.588799891
[835] 2.022288668 0.529422573 0.487225442 1.136649318 2.702275609 1.098223264
[841] 1.423751487 1.203916191 1.835942396 2.808767042 2.505487421 1.737009213
[847] 1.662988451 0.228693550 0.145984068 0.005255650 1.989478957 2.741423376
[853] 2.187459129 0.204183205 2.619503101 2.795129484 2.918881287 1.850403899
[859] 1.196053751 1.527479107 1.831868846 2.154579686 2.070811240 2.073407645
[865] 0.407310863 1.502387640 0.544734237 0.371907421 2.550872779 2.595659834
[871] 1.939854305 0.613602305 0.125783802 1.148778042 0.508312077 0.279525306
[877] 0.901069007 0.930060562 0.828461352 0.486810904 2.663349626 0.881613536
[883] 0.108073417 2.497289078 1.128973570 0.097860954 0.280546505 0.330521120
[889] 2.097386086 1.019116474 1.053232664 1.355687097 2.692510446 0.941572927
[895] 0.886999377 2.732032801 0.150847294 0.978044816 0.439010123 2.770103380
[901] 2.681294184 1.964232357 2.304386792 1.158550601 2.992884340 0.186991236
[907] 2.318852405 2.086792421 2.776832271 1.550079424 1.246130189 0.089101262
[913] 2.501498363 0.561057662 2.005483455 0.134935801 1.505943014 0.089284297
[919] 1.283231721 2.882945248 2.753389703 1.301047120 1.360613977 0.657229470
[925] 0.102027000 1.217374523 2.432020529 2.934684061 1.643214797 0.239989466
[931] 1.629189973 1.878237095 2.326322452 1.763521830 2.134006822 2.824763300
[937] 2.925473819 1.121776406 1.679903474 2.695782554 0.730419602 0.011386745
[943] 2.295451770 1.944345305 0.190466672 1.999953043 1.391519405 2.282360273
[949] 0.702124896 1.690033324 1.892915234 0.886074913 2.181487532 2.084184623
[955] 2.497656155 0.316707009 2.798734228 0.104359852 1.139695558 0.059417929
[961] 2.980093820 2.169005570 1.098800377 0.019232176 0.860744262 2.326691038
[967] 2.404097789 1.265805699 0.813857867 1.667354307 0.429475564 2.034847562
[973] 1.151630463 1.366885190 0.244827911 0.618031947 0.045592366 1.861640586
[979] 1.127660802 1.719224102 0.316498332 2.864433773 1.156899682 0.849168154
[985] 2.506816230 1.073521237 0.866037027 1.391112157 0.825435792 0.457736844
[991] 0.386978430 0.991842245 1.678112041 2.519593278 0.833953156 0.982420962
[997] 1.110738410 0.747109163 0.888145170 2.075462978
>
> # (b) Now generate samples of Y using the equation: y = α x + β
> # by setting α = 1, β = 1.
>
> y=1*x*1
> y
[1] 2.676802092 2.647266751 1.142663233 0.904854520 1.265866985 0.325854298
[7] 0.894797261 1.357160680 0.727363242 0.309877805 2.192792193 1.904744571
[13] 0.280010416 0.948966312 1.292643484 0.875926370 0.566390444 0.374292284
[19] 0.851245773 1.532447577 1.030802960 2.636592830 2.207418869 0.525802504
[25] 2.722728894 0.435688520 1.963871353 1.888447433 0.120782048 0.675865368
[31] 0.968241070 1.400812750 0.360185143 0.461715393 1.633237300 2.135191188
[37] 0.294834923 0.327644398 0.483224281 1.526024804 2.638749729 1.478006466
[43] 0.265844068 0.797292060 0.109200684 0.840625135 1.542920876 0.328529871
[49] 2.856175290 0.453143700 1.296332157 0.732526272 0.656189739 2.875638968
[55] 1.766858028 1.712032260 0.019516400 2.771668484 0.438898775 2.106072068
[61] 1.992352557 0.065972863 0.775083967 0.021375590 1.169381370 1.347733125
[67] 1.044571696 0.643344127 2.011164244 0.718011632 1.699650990 1.418938603
[73] 1.416186175 0.034627883 2.629104369 1.720379209 2.265726412 0.111018760
[79] 2.881741571 2.813602321 0.064045459 1.086367323 0.794659439 2.634215939
[85] 1.708043943 2.793018612 1.537711808 1.315281914 1.133780782 2.106808895
[91] 0.864058798 2.916466886 1.736698017 0.049541139 0.119374737 1.853509666
[97] 1.652494699 0.075735923 1.406412591 1.703051053 1.594400414 2.601438700
[103] 2.616584104 2.354931562 1.874945610 1.077878064 0.255736993 2.698710989
[109] 0.015617120 2.620048924 1.209274315 2.349230856 2.599505916 1.488369063
[115] 2.950331909 2.827827287 1.455684650 0.450013462 1.789377334 2.112566150
[121] 1.401627458 1.512398987 0.809010925 1.970042960 2.836847333 0.975467973
[127] 1.139072646 2.444285722 1.746892262 2.827174183 0.953314464 1.355272904
[133] 1.544772302 0.937084564 1.206254232 1.803770050 0.566893601 2.530928078
[139] 0.938602198 1.889064001 2.910973602 2.680789822 0.731735594 1.546938195
[145] 0.238630167 1.629107094 0.695593747 1.207905935 1.042162632 0.203724205
[151] 0.632919237 2.054258195 1.497964252 0.643118813 1.284844618 2.162731552
[157] 0.520032645 1.645939377 2.845823622 2.316532753 0.219192153 0.956918137
[163] 0.863959063 1.818817488 2.890135624 2.766651844 2.833007193 0.541888791
[169] 2.070374697 2.903043843 0.971133204 2.027751713 1.840560631 1.345358645
[175] 0.839752283 2.225680668 0.307684067 2.347342610 0.570524600 0.525931107
[181] 1.334087865 0.548665835 0.166540833 0.943286261 1.416852695 2.437104883
[187] 1.679533850 1.208425318 0.008908470 2.917420946 1.864684974 1.082178421
[193] 1.025405228 1.181058393 2.262259800 1.558967675 0.487566486 2.518634196
[199] 2.683709018 2.122739435 2.415099974 2.370522309 0.526187401 1.147688439
[205] 1.882783848 0.572579823 0.943623411 0.159254387 0.164722740 0.493067731
[211] 1.896636432 0.065627435 0.909611362 0.779255184 2.190603917 1.735775188
[217] 2.568100779 1.794239729 1.357593931 2.103323856 2.152039629 1.874829559
[223] 0.270037810 0.274548172 2.185426628 1.513420845 1.486891034 1.108369045
[229] 1.361194534 1.820851286 1.845158414 0.717087555 0.585436119 1.039223725
[235] 1.615378193 0.591485264 2.974604244 2.136148182 0.920994455 0.693502574
[241] 1.687219707 0.344380286 1.986613385 0.701016198 1.548732808 2.897491619
[247] 2.809449624 0.091892229 0.817399122 0.491817229 2.087130647 1.638454056
[253] 0.781764665 1.958740574 1.238035155 0.402622561 1.553263854 2.476417525
[259] 1.563846064 2.801636185 1.347773578 0.266262873 0.660696280 1.478670565
[265] 1.757935020 2.243785667 2.881021964 2.493581293 2.011086601 1.305899799
[271] 2.650949181 0.927301773 1.240218987 2.680989374 0.799822787 0.234812291
[277] 2.151554628 0.352742162 2.208097669 1.747685115 1.189757076 0.799678921
[283] 0.553603120 0.876132644 0.858621846 1.268829903 0.460254866 1.491486340
[289] 0.511196380 1.629076075 1.078909002 2.520935616 2.490863852 1.535810899
[295] 2.326194568 0.938564472 2.986176671 2.141291746 2.979448672 2.973308258
[301] 2.589439893 1.380489572 2.719310785 1.307115020 2.449838760 2.278591066
[307] 1.159107445 1.263092554 0.833318748 2.811367192 0.769104353 1.935307031
[313] 0.124821315 2.492760432 0.910199342 0.904291116 1.143728853 2.731029775
[319] 0.556950248 1.205866857 0.894270189 0.533762487 0.328521761 1.493319459
[325] 0.993925350 1.103897452 2.476268664 2.027373120 0.587475296 0.197113599
[331] 1.800156025 2.872851696 1.571103775 0.888057601 1.601705143 0.399493226
[337] 1.718234446 2.338849854 0.347306270 1.803484111 2.114343847 1.840105937
[343] 1.516471511 2.976729618 1.376613035 2.760030944 1.374084817 1.755401920
[349] 1.870346736 2.333880160 0.096258027 1.926458673 1.111396355 1.787529452
[355] 1.662747940 0.058420943 2.399623944 0.387071269 1.445820604 1.734271264
[361] 2.963552524 0.654075243 1.867877332 1.157613241 1.141600071 2.585877505
[367] 2.875310110 1.264296569 2.635827196 1.879010610 1.214081643 1.522207294
[373] 1.777240050 2.774328301 1.450969805 0.838394711 2.999960462 0.885667841
[379] 0.556020925 1.202312118 1.592085056 1.315280053 0.398515301 2.053895853
[385] 1.374793099 0.044952307 2.098011162 2.547326184 0.826419795 1.423389510
[391] 2.633057055 2.982308631 0.820249675 1.623682461 0.826390242 1.307686623
[397] 0.219340400 2.597372848 0.538275958 0.214039839 2.892392841 2.702985528
[403] 1.263740700 2.891550131 0.277858643 1.386701037 2.413661564 1.093548317
[409] 1.566984355 1.262001750 0.713726285 2.891250931 0.013119290 1.097069383
[415] 2.166478035 0.180916968 0.858717191 2.228131058 1.117739244 1.283515663
[421] 2.882668938 1.265347830 1.606090075 1.551382755 2.553674325 2.493271854
[427] 0.801173080 2.398023040 1.108120937 0.209957281 1.455545916 2.125412311
[433] 1.844793035 0.642294946 2.895708099 1.061425817 2.947552524 2.571776104
[439] 2.034827612 2.736889469 1.928857241 1.999859019 2.557839039 1.537654473
[445] 0.210301799 1.779655425 1.876558801 1.732081353 2.486056336 1.492660909
[451] 2.035036644 2.099993255 1.391467337 2.793796331 1.414763335 0.261239130
[457] 0.979563270 1.679364236 1.798135735 2.177388164 0.191806728 2.971540978
[463] 2.352038087 0.662788665 0.077260001 2.984600870 0.501800965 2.282185377
[469] 1.082891475 0.119997015 2.374057999 0.378100640 2.413587602 0.940722417
[475] 0.988678792 1.748621525 0.110095273 0.892559128 0.804474367 0.480486205
[481] 0.768176522 1.918965984 2.046678430 1.528228917 0.403173198 0.505911958
[487] 0.180515137 2.242188504 0.245482223 2.941010605 1.929560593 0.930993567
[493] 1.043893739 0.008120488 1.603958904 1.394178220 1.587791387 0.749835637
[499] 1.147182121 2.493283454 0.175073508 2.010901216 0.811632408 2.170075509
[505] 0.343706899 0.373357506 0.866600188 1.131940152 0.786469580 1.123410932
[511] 0.753313065 0.387015299 0.736521449 0.434035504 1.853079937 1.051070089
[517] 1.366217450 0.121740223 0.730741778 1.761940765 1.361690845 1.254293365
[523] 0.868425224 1.315852898 2.810424606 0.234080449 1.255732516 1.243656577
[529] 2.948490043 2.314766808 2.923328966 1.126326464 1.140850061 2.343640965
[535] 0.378718517 0.608485678 2.975297461 2.799542012 2.581840408 0.559951908
[541] 1.288209561 1.338027007 1.353994786 1.487170896 2.519385746 2.170981879
[547] 1.629825548 1.980487828 1.278012568 0.370287517 2.845085302 1.046344909
[553] 0.901026674 0.536236286 1.310885476 1.208352573 0.987095816 2.395847655
[559] 2.949781163 1.702588726 1.162315852 1.520945266 1.730786630 2.777827939
[565] 1.246571668 0.411753007 2.238370216 1.841595821 0.889438743 2.868993031
[571] 1.824373902 2.703819947 2.508461246 0.075342400 2.877531174 0.217118677
[577] 1.455378370 1.282544254 0.041145917 1.376377327 0.023849883 2.095277386
[583] 0.077475472 1.406784612 1.940246231 1.250818724 1.539158506 2.847951739
[589] 1.734721299 1.828714567 1.987944703 2.665985271 1.547963228 0.284522977
[595] 1.605389050 1.581501719 0.166564085 1.366428263 2.679443274 2.175215405
[601] 2.770628903 0.445961741 1.464759237 1.263358206 0.299488102 2.081664316
[607] 0.298914067 2.802991329 1.193385364 2.038833054 0.596322545 1.666535515
[613] 0.506859632 1.044796490 2.623166213 2.647858894 2.216643811 0.852435834
[619] 2.340621638 0.761346379 1.148077515 2.649329115 0.726563766 1.118275736
[625] 0.857698032 2.193755225 0.969061602 1.072396305 1.765542267 2.792453825
[631] 2.709633999 0.431035277 1.980526413 2.111790321 0.576525740 0.916906342
[637] 2.998403637 2.469324647 2.375635939 0.594457795 2.216809930 1.581765660
[643] 0.950612207 2.258478628 1.826993378 2.154989818 1.621331092 2.350716449
[649] 1.194374752 1.169968776 1.711673138 1.131793747 2.662144273 1.308473506
[655] 1.774351457 1.086471499 2.897480187 1.903999815 0.376742049 0.008849337
[661] 0.742757337 1.920297991 0.964314847 2.531681783 0.574159132 1.636374225
[667] 2.713975519 1.394547201 1.619194751 0.508388424 0.829940780 1.411039627
[673] 0.225203106 2.453193176 0.996267595 0.174878740 1.669997490 1.506066393
[679] 0.620681652 2.564817844 0.721691995 1.354753877 0.332894717 1.477819417
[685] 0.582811601 2.315756100 1.094756807 2.998259368 0.486095076 2.571141628
[691] 1.040963495 2.867842658 2.771559647 0.477956310 0.736177634 2.784443681
[697] 2.840800912 0.694399514 2.899027302 1.669307260 1.536367684 2.158492385
[703] 0.565437707 1.636142834 0.596779204 2.542176963 2.979296997 2.104508631
[709] 0.445636817 1.801847886 2.595369193 1.405879471 2.951325785 1.609670775
[715] 0.900235302 0.941198111 0.963548005 0.281636490 2.044759199 0.531367521
[721] 2.289250423 0.383434904 2.636865567 1.976923543 2.929048050 1.509989969
[727] 1.430741412 2.091164003 2.737919751 2.621091903 2.638037063 1.798433441
[733] 0.356278604 2.166462281 1.362444885 2.842279608 1.061248317 0.319539345
[739] 0.270907212 0.232214879 2.775776910 2.851253719 2.856140597 0.559870681
[745] 1.916470021 1.731711600 1.821771835 0.113905740 0.172391079 0.999022463
[751] 1.371089315 2.017777717 0.023879154 0.450930475 0.042052663 1.967815916
[757] 2.988283878 1.523767370 0.650876921 1.748941905 0.423612293 1.649035601
[763] 1.937604636 2.646937842 2.950167339 2.607838984 1.342940197 1.890220799
[769] 0.426096788 2.244312792 2.331070727 2.905399644 2.219416856 2.775482757
[775] 1.646428223 0.204037302 2.816041595 1.564781236 0.450506593 2.479341987
[781] 0.242711648 0.447008561 2.288215351 0.586899045 0.455664067 1.053952867
[787] 1.970310149 0.839073625 1.250480843 0.330354312 0.011150497 0.100755906
[793] 1.685669449 2.352617451 1.946448607 1.351369270 1.592186424 2.723212974
[799] 1.596676102 0.674400272 0.147289508 1.800336253 2.341951106 2.644274957
[805] 0.023012056 1.424707533 2.868350438 2.916999731 2.806863906 2.257690983
[811] 1.235041182 2.369721034 1.480285781 0.899806588 0.369491091 2.702258821
[817] 1.626866318 2.718381303 2.509623988 1.398341333 1.289999171 2.436285048
[823] 2.883421427 1.031854587 0.058766908 2.732582415 2.231158694 0.002495152
[829] 1.993744340 0.968663843 0.734666400 2.307582897 1.982631068 2.588799891
[835] 2.022288668 0.529422573 0.487225442 1.136649318 2.702275609 1.098223264
[841] 1.423751487 1.203916191 1.835942396 2.808767042 2.505487421 1.737009213
[847] 1.662988451 0.228693550 0.145984068 0.005255650 1.989478957 2.741423376
[853] 2.187459129 0.204183205 2.619503101 2.795129484 2.918881287 1.850403899
[859] 1.196053751 1.527479107 1.831868846 2.154579686 2.070811240 2.073407645
[865] 0.407310863 1.502387640 0.544734237 0.371907421 2.550872779 2.595659834
[871] 1.939854305 0.613602305 0.125783802 1.148778042 0.508312077 0.279525306
[877] 0.901069007 0.930060562 0.828461352 0.486810904 2.663349626 0.881613536
[883] 0.108073417 2.497289078 1.128973570 0.097860954 0.280546505 0.330521120
[889] 2.097386086 1.019116474 1.053232664 1.355687097 2.692510446 0.941572927
[895] 0.886999377 2.732032801 0.150847294 0.978044816 0.439010123 2.770103380
[901] 2.681294184 1.964232357 2.304386792 1.158550601 2.992884340 0.186991236
[907] 2.318852405 2.086792421 2.776832271 1.550079424 1.246130189 0.089101262
[913] 2.501498363 0.561057662 2.005483455 0.134935801 1.505943014 0.089284297
[919] 1.283231721 2.882945248 2.753389703 1.301047120 1.360613977 0.657229470
[925] 0.102027000 1.217374523 2.432020529 2.934684061 1.643214797 0.239989466
[931] 1.629189973 1.878237095 2.326322452 1.763521830 2.134006822 2.824763300
[937] 2.925473819 1.121776406 1.679903474 2.695782554 0.730419602 0.011386745
[943] 2.295451770 1.944345305 0.190466672 1.999953043 1.391519405 2.282360273
[949] 0.702124896 1.690033324 1.892915234 0.886074913 2.181487532 2.084184623
[955] 2.497656155 0.316707009 2.798734228 0.104359852 1.139695558 0.059417929
[961] 2.980093820 2.169005570 1.098800377 0.019232176 0.860744262 2.326691038
[967] 2.404097789 1.265805699 0.813857867 1.667354307 0.429475564 2.034847562
[973] 1.151630463 1.366885190 0.244827911 0.618031947 0.045592366 1.861640586
[979] 1.127660802 1.719224102 0.316498332 2.864433773 1.156899682 0.849168154
[985] 2.506816230 1.073521237 0.866037027 1.391112157 0.825435792 0.457736844
[991] 0.386978430 0.991842245 1.678112041 2.519593278 0.833953156 0.982420962
[997] 1.110738410 0.747109163 0.888145170 2.075462978
>


Related Solutions

What is the code in Rstudio or R? (a) Generate 200 random samples of size n...
What is the code in Rstudio or R? (a) Generate 200 random samples of size n = 10 from a Poisson distribution with mean λ = 12. i. Calculate sample means for each sample. Report the first 10 sample means. ii. Draw a histogram of the sample means (where the y-axis is the density) and fit a density estimate (default density estimator is ok). iii. What is your finding about the sampling distribution of the sample mean, based on your...
Use R to generate n = 400 samples (idependent identically distributed random numbers) of X ∼...
Use R to generate n = 400 samples (idependent identically distributed random numbers) of X ∼ N(0, 4). For each Xi , simulate Yi according to Yi = 3 + 2.5Xi + εi , where εi ∼ N(0, 16), i = 1, ..., n. Use R to solve the following questions. (a) Compute the least square estimators of βˆ 0 and βˆ 1. (b) Draw a regression line according to the numbers computed in (a). Plot Y and X with...
r programming generate 100 samples of size n= 5 from a normal random variable with u=2,...
r programming generate 100 samples of size n= 5 from a normal random variable with u=2, o= 3 in r
Write the R code First, generate 1000 observations from a binomial distribution with n=30 and p=0.2...
Write the R code First, generate 1000 observations from a binomial distribution with n=30 and p=0.2 Use the 1000 observations you generated: a) Generate poisson, binomial, negative binomial Diagnostic Distribution Plots using distplot. b) Generate a histogram and overlay a kernel estimator of the density (You can use: binom <- rbinom(n=1000,size=30, prob=0.2))
(R programming) Generate 50 samples from a Poisson distribution with lambda to be 2 and define...
(R programming) Generate 50 samples from a Poisson distribution with lambda to be 2 and define the log likelihood function Use optimization to find the maximum likelihood estimator of lambda. Repeat for 100 times using forloop. You will need to save the results of the estimated values of lambda.
Write a code in two ways to generate all multiple of n: from 0 to 158...
Write a code in two ways to generate all multiple of n: from 0 to 158 included. (this is all the teacher gave me) 1) in procedural style, 2) in Object Oriented style Input: just a value of n between 11 and 19 included. Output : the generated list required. Choose any languages you know. Keep working hard ----------------- To do: 1- Read about Styles of PLs : Procedural Programming Language. ... Object-oriented Programming Language. ... Functional Programming Language. ......
Write a code in two ways to generate all multiple of n: from 0 to 158...
Write a code in two ways to generate all multiple of n: from 0 to 158 included. 1) in procedural style, 2) in Object Oriented style Input: just a value of n between 11 and 19 included.
Suppose that f(x)=x^n+a_(n-1) x^(n-1)+⋯+a_0∈Z[x]. If r is rational and x-r divides f(x), prove that r is...
Suppose that f(x)=x^n+a_(n-1) x^(n-1)+⋯+a_0∈Z[x]. If r is rational and x-r divides f(x), prove that r is an integer.
Write the R code to generate five independent uniform random numbers and use that to generate...
Write the R code to generate five independent uniform random numbers and use that to generate 5 independent Bernoulli random variables with probability of success p = 0.4. please use RStudio. please do not use lab nor rbern for calculations.
Generate 100 samples of size n=8 from an exponential distribution with mean 3 . Each row...
Generate 100 samples of size n=8 from an exponential distribution with mean 3 . Each row of your data will denote an observed random sample of size 8, from an exponential distribution with mean 3. Obtain sample mean for each sample, store in another column and make a histogram for sample means. Repeat for n=100. Compare and interpret the histograms you obtained for n=8 and n=100. Submit the histograms along with your one small paragraph comparison. Can you solve it...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT