Question

In: Math

Generate 1000 random numbers from ??3? starting with standard normal random numbers in R.

  1. Generate 1000 random numbers from ??3? starting with standard normal random numbers in R.

Solutions

Expert Solution

The R code is given below

The histogram of the random numbers from t(3) is

From the histogram it is clear that the random numbers are from t distribution

1000 random numbers which are obtained from the given code are given below

   [1] -0.127599301  0.449350313  0.166071229 -2.832973151 -1.253517499 -1.841312069 -1.511593526  0.421056959 -0.549328337 -0.076734035  0.094467005  0.944483073
  [13] -0.866753991 -0.924904563  0.182555473 -0.196078231  0.852168793 -0.015942610 -0.103774486 -0.264645308 -1.010018088 -2.679696490  0.953369453  1.911646091
  [25] -0.288483958 -0.368437277 -0.910898977  0.596065272  1.225718783  2.121335571  0.280696946 -1.316331533 -1.158736551  1.046251818  2.687746896  3.365896540
  [37]  1.740192944  3.357734194 -0.884211886 -0.307966344  0.920421139 -0.618456119  1.521597362  0.135018051 -0.944373303  1.984214462  0.281260723  0.240720677
  [49] -0.859300828  1.075182948  2.117077809 -0.072513596  2.691443180 -2.299429457 -0.184996142  1.335418532 -6.547474719 -1.230841285  1.233998512  2.544976665
  [61] -0.389952269 -0.366575101  0.811042226  0.083387617  0.076851261  0.739733387  1.224746674  0.705048777 -2.268424960 -0.720407708 -0.724818730  1.914091660
  [73] -0.313645724 -0.408730566  0.200992781 -0.221031029 -0.529516870 -0.593958693 -0.196585493 -0.577102260 -1.528882040 -0.856018444  1.707912450 -0.857173603
  [85] -0.433834933  3.931151230  1.330334469  0.551818806  1.629937729  2.137719742 -1.729948135 -1.559947265 -0.138494551 -0.679833885 -1.635283720  0.535309253
  [97] -2.519939711 -0.991982528  0.006426805  0.829256781  4.031417981 -0.042091871  0.248483648 -1.745614141  1.096577880 -2.288288052  0.673247430  1.627069997
 [109] -2.712243562 -0.266297183  1.417796288 -0.322604688  0.193144021  1.245674237  3.169101137  0.168457012 -1.740447462  0.880617334  1.217308766  0.752770088
 [121]  0.347223962 -2.294488570 -0.095907424 -0.923349827 -0.422459737  1.245269891  0.462061434 -3.480096109  0.839687495 -0.801875527  0.460795333 -0.730396542
 [133] -0.530211271  0.255549073 -0.020687473 -0.973452358  0.538027732 -0.129231054 -0.386852939 -0.080483306 -0.136042826  0.715929348 -1.191247845 -0.913817886
 [145]  0.572060226 -1.150500372  0.406831942 -3.379796582 -0.985799706  0.659486222 -0.084421293 -1.522353005  0.523555159 -0.675080815  0.287249679  0.300402899
 [157] -0.002580491 -0.535064718 -0.001366722 -1.450050776 -2.937008885  0.758073425  0.570049970  0.681073727  0.335230194  0.213767490  1.128456047  0.409680626
 [169] -0.822027313 -0.597382021  0.282124591 -0.684116946  0.442577062  3.172186661  2.982872438 -1.003657923  0.649724856 -0.308448872  0.223628260 -0.305630767
 [181]  3.258905748 -0.049059853  0.677069074  1.535080182 -9.992204215 -0.698195511 -0.181369217 -0.407684333  0.118666200  0.677715336 -2.253249897  2.078663482
 [193] -0.501836585 -1.366094798 -0.420095692 -1.551347516  1.562456928  0.876393810 -5.664906634 -0.879125155 -0.069781265  0.372013848 -1.678446141  0.402317189
 [205]  0.871156206 -0.822979630  0.252403922 -1.756275398  0.561135015 -0.505022715 -1.829420303 -2.836324368 -1.509637726 -1.172011022 -0.902140967 -0.266131091
 [217] -1.345516968 -0.255526460 -0.414854029 -0.791059346  0.812033723 -0.932776423 -0.226974507  0.163974445 -1.081199905  0.273697504  0.573286561 -1.168117310
 [229] -0.727455741 -0.213712848 -0.962521742 -0.215376574  0.489748172  0.784786413 -0.687261280  1.519101494 -1.464847030 -0.497758981  1.309293379 -0.663090345
 [241]  0.571797537 -4.373343342  0.783514737 -1.700968850 -1.308226411  0.420912746 -0.741048645 -0.128084001  0.241983486 -0.492279406 -0.750234370  0.637115195
 [253] -1.039798733  0.679750239 -1.387549964  3.099500779 -1.272208729 -0.099116739 -0.017544178 -0.028398784  0.416545955 -0.254830058  1.026535606  0.870588048
 [265]  8.921270876 -0.815290324 -0.774701659 -0.708091136 -0.307463908 -0.512708559 -1.525830958  1.577120770 -0.632160424  1.562582957 -0.115207432 -1.219643257
 [277] -0.209925819  0.525062878 -1.335819303 -1.641962048  0.130635363  0.263012375 -0.179186651 -1.239978456  0.176887472  0.413041526 -8.924823788  0.215928355
 [289]  1.504561928  1.063702813  0.323749565 -1.031975613  8.851537057 -0.295567459  1.038110016 -0.587057262  0.250556428 -1.914693905  0.155454136 -1.692530683
 [301]  0.143926526  1.096564991 -0.101148355 -1.976543862 -0.219699934 -0.197281531  2.570775075  1.062424722  0.814556822  1.599794067 -0.829037744  1.018638730
 [313] -0.270409204  1.247405015  0.939451761 -2.384355187  0.457444917 -1.627979542  0.043151374  1.542742308 -0.349197207  1.751199353 -0.178622619 -0.033348508
 [325] -2.007835430  1.466662203  0.374668138  0.746035057 -0.044992213  0.779062734 -0.823002211  0.677020912  0.200891582 -2.648954329 -0.885744320 -1.736798005
 [337]  0.769421140 -0.099685597 -3.304385386 -1.008897925  0.844571371  1.377993858 -0.270765003 -0.201389728 -1.384306055  1.122857871  1.890461465 -1.735897927
 [349]  0.407325608  0.071046449  1.763399343  0.312939331  1.136301601 -0.835759678 -2.575128414  0.631406526  0.181223803 -1.944412563  0.046335689  0.890341508
 [361]  1.005705682 -0.840177757  0.846385494  0.743560693 -2.386929968 -0.466980889  5.788939853 -0.037986456  0.186455800 -0.114986922 -0.386084917 -0.571719042
 [373] -0.440632739  2.118914858 -0.647054084 -1.155225802  0.459261180  1.260023352 -0.083069225 -1.146251128  0.023409225 -1.081193774  0.260849423 -0.398054602
 [385] -1.744114253  1.271491973  1.180679672  0.952337014  1.855862559 -2.653173648  0.683108862  0.048132760  0.397266530  0.698631425  0.344136787 -0.508353094
 [397]  1.311798203 -3.744621291  0.020553736  0.741120335  0.271342682  0.491749989  1.323227606  0.389335317 -0.052146557 -1.159619544 -1.045206495 -0.609202541
 [409]  0.199326331  0.442966857  0.592707655 -0.991291935  0.141481031  1.529555086  0.647943592 -0.025382073 -0.453444998  0.887049679  0.432558327 -1.199254855
 [421]  0.019664070 -0.475843584  0.084211670  1.167686229 -1.370779467  1.156342447  0.323294674 -0.144061315 -0.745530564 -0.819128685 -0.117463879  0.850820516
 [433]  0.902520951  0.727020513  2.519207867  2.113258297  1.064720865 -1.038774464 -0.346360866 -0.808087065  2.329681332 -0.496233066  0.534684581 -0.167097821
 [445]  1.168946536 -1.889921486  0.252575446  2.644360871 -0.446525060  1.856033981 -0.136650198 -1.588745486 -1.057300999  3.527631921 -0.287431150 -0.335132136
 [457] -0.539861310 -0.246021615  1.534889614 -0.110406700 -0.731319884  0.728485161 -0.483251046  1.546063842  0.830736966 -0.409397065  0.425134851 -2.402287027
 [469]  2.223137378  0.574451328  2.860119458  1.266569952 -0.375138205 -0.285639811  6.790383458  1.244539426 -0.569996199 -0.388234560 -7.104341794 -0.519551838
 [481]  0.610728616  2.046318199 -0.100523775  0.757549359 -0.669735534 -0.079510780  0.670921280 -0.867692733  0.274086343  3.285265616 -0.517301784  2.176908475
 [493] -0.284969968 -0.602971070  0.115634770  0.658276608  1.512188573  3.140211368  0.523430610 -0.114608408 -2.238724056 -8.222529266  1.470289067 -0.300615706
 [505] -2.946728116 -0.072376658  0.292701302  0.916671789  0.649011295  0.570381793 -1.611621218  2.185157369 -1.647211089  0.776250261 -0.408053775  0.141291939
 [517]  1.039011858  0.890250250 -0.211180277  1.802918222  0.139346334  1.980173527  1.087574048  2.750661902  0.049125910 -0.312174576  2.958510164  0.985550344
 [529] -0.399275193  0.798530464 -2.161957372 -0.661819124  0.937012392 -0.559198826 -0.986679655  1.492843757  1.372830956 -2.307362096 -0.996440308  0.511706331
 [541]  0.056108128 -0.995396268 -0.421330335 -1.904006956  0.028523387 -1.254476765  0.640287365 -0.374241510  0.372959791  1.220261037  6.745769001 -0.280924298
 [553] -0.285874574  1.125197967 -0.107185369 -5.204182854 -1.744160893  0.373590605 -1.213371969  2.540495956 -1.445534545 -0.731352446 -1.523438920  0.312495113
 [565] -0.090414703 -1.030152377  0.213140895  0.005098283  1.422428405 -0.785518237 -2.176300660  0.332966803  1.272395132  0.227693405  0.479987104  0.406492065
 [577]  0.363189839  0.398039589  0.460117600 -0.358408501  0.795890900  1.995956471 -0.681562530 -4.030022346  0.203738476  0.903614858  0.821649121 -1.500130376
 [589]  0.015239108  0.658754148  1.059966212 -0.008765340  3.991316816 -0.809727109  0.780685885 -0.068602668 -1.468155236 -0.476479679 -0.566427791  0.512904178
 [601]  0.315733409 -1.210536644  0.127807610  1.125013865  1.520615857  6.311135501  0.485403538  0.392112918 -1.037624185 -0.584532120 -1.172839113 -0.196413100
 [613] -0.736950057 -0.260526535  0.205065287 -0.556502246 -1.981806904 -7.566353535 -0.953333845  1.200809825 -0.512510770 -1.223821184 -0.835672926 -1.239550767
 [625] -2.198519883 -1.250641375 -0.729345795  0.968431401  0.704200135 -1.821879824 -0.820074885  0.947406519  0.340127083 -2.096722425  0.221103154 -0.439509446
 [637] -1.104448421  0.057363251  1.991889438  0.965077346  0.612874888 -0.047327073  1.080774273  0.195321185 -1.144863746  0.169594125 -1.460420962 -0.465902007
 [649]  0.680647429 -1.734321485 -0.990956716 -2.246178057  0.028153959  0.046512108  0.579608317  0.657213522  0.770868943 -0.738681494  2.240590160  0.570644664
 [661]  1.321272773 -0.057852096 -0.509457248  0.311091060  0.441106835  0.644823986 -0.246242097  1.468242629 -1.236952589  0.608503190 -1.026844141  0.061825970
 [673]  0.274724203  0.448679700  0.090065287  0.355819407 -0.173311063 -0.469238821 -3.309878764  0.175246824 -1.303745796  1.026779000  0.003377233  1.352391841
 [685]  2.255082247 -1.136277892 -0.698813822 -2.254093586  0.119897729 -0.012408217  3.811769349 -0.355516970  0.494992935  0.009370813 -1.614882233 -0.350392253
 [697]  0.749985870 -1.764312835  4.790790453  0.051799244 -1.764536820 -1.925565047 -0.497098058  0.539437293 -1.070463290  1.165233302  1.701287078 -1.550659570
 [709] -0.999899363 -0.560777733 -2.040850966  0.695306830 -0.414269350  0.276425995 -0.392949325  0.681821562 -0.088309406  0.364790541 -0.816783683  0.536294025
 [721]  1.145884396  1.204015191 -0.452903243  1.857095566 -0.178709805 -0.520670719  0.051425936 -2.080277764 -1.058543728  0.663796586  0.360866166 -1.010269728
 [733] -0.342076039 -0.355739583 -0.689641570 -0.096019881  0.718922723  1.615787467  1.083174923  0.474658527 -0.014191068 -1.463483523  0.388271645 -2.807849469
 [745]  2.715471789  1.200056645 -1.569320627  0.182129359 -0.220533660  0.050416752 -0.467901077 -0.354473792  0.314561778 -0.469210326 -0.863396175 -0.686905546
 [757]  0.562142872 -0.312914399  2.002348454  4.265727533 -4.932938649  2.183730384 -0.752931382  0.389432168  1.709592967 -0.016929037  0.450314725  0.738086883
 [769] -2.709446752 -0.701057270 -3.086346134  0.678816653 -0.183587688  0.919316051  0.083714294 -0.292260469 -0.458393297 -0.159976648  0.018276012 -2.322537166
 [781] -0.587343324  1.243502538  0.565150371  0.776327910  1.617503507  0.740134942  0.158994437  1.022584270 -0.158326161 -0.388342589  0.686975437 -0.261785026
 [793]  0.971716305 -1.739026272  0.075468740  0.274707110 -4.421499277  0.691433158  1.703818510 -1.486869418  0.791279095 -1.320855009  2.813473924  0.161544619
 [805]  0.903026522  0.176449015  0.026210408  1.904926075  0.168535071  0.327720480  1.441919652 -2.480976115  0.735141670 -0.825317082  0.248487999 -0.342238954
 [817] -0.213382038 -0.210940842  0.854036330  0.487660048 -0.065082666  1.037680468  0.493700250  0.305693607 -0.236432865  2.591302399 -0.962440854  1.529031879
 [829] -3.499259405  1.336203495 -0.550030379  0.618601014  0.026316215 -0.558898836  2.619023190 -0.429228142  3.075546687 -2.041450759  0.311806339 -0.968075385
 [841] -0.920771103 -0.636056412  1.236658523  0.415371102  3.715673802  2.566708053 -1.794439439  2.371152823  0.214681523 -0.449613671 -0.321609212 -0.105552303
 [853]  0.118839676  3.935128394  1.088200532 -0.161164989  0.762692678 -0.265231936  0.408698224  0.294674907  1.165070388 -2.136631555 -2.082583681  0.654444761
 [865] -0.146868794 -3.580824454  0.760417568 -1.040110701 -0.253217499 -0.197001020  0.738497983 -0.641417530 -0.696508744  1.723174756  0.157450659  0.142288888
 [877] -0.445756779  0.085543343 -2.159556581  1.508278307 -0.377151487  0.399942719 -2.997706910 -0.088989944 -1.623127291  0.819763937 -1.006453766 -8.357211351
 [889] -1.191057853 -1.710889638  0.670559582 -0.773334453 -3.216522774  3.130601798 -1.035065475 -0.204904758  0.345201180  0.149431772  0.125089419  0.194658451
 [901]  0.604063579 -0.370619146 -0.349305031  0.499253359 -2.435152832  0.316855494  0.268502170  0.354052860  0.556724435 -6.668264039 -0.670644011 -2.747661480
 [913]  0.457845037  0.855961580 -0.024127718 -0.147038022 -0.058877456  0.233876594  0.152935856 -0.221898748 -0.053068317  0.405484486  1.951573590  0.003972543
 [925]  0.236996766  1.065948435  0.577058577  0.004176317 -3.210613986 -0.190412053  0.824997507  0.446596692 -1.697183310 -1.700432522 -0.631428467 -1.757101922
 [937]  1.413680687 -2.098423948  1.515882455 -1.152029531  4.785021703 -0.831475167  3.805208612  0.281842382  0.278996811  0.746308693 -2.841571161 -1.628822708
 [949]  0.427818193 -0.075431309  0.432890414 -0.195183026  2.249294033 -1.832570331 -2.151024832  1.248091588 -0.407651559 -1.051875640  0.341823365  1.019104074
 [961]  0.786337352 -1.370180669 -1.059174652  0.213449807  0.499250835  0.119739153 -0.713643831 -1.053529207  0.316425339 -0.546757014  0.652897632  0.234227127
 [973]  0.227172987 -0.331621578 -0.027908335  2.339396052  1.083397681  2.449909078 -1.130590015 -0.754213036 -0.254147124 -2.195565429  0.551510881 -0.354206293
 [985]  0.362791610  1.120947204 -1.979115121 -0.177633750 -2.695584353  0.429985778 -0.388190025  3.867318575 -1.251150108  1.282846436 -0.048782241 -1.465473160
 [997] -0.153469743 -1.516518746 -1.546400395 -0.225832638

Related Solutions

Generate 1000 random numbers from ??2, 5? starting with standard normal random numbers in R.
Generate 1000 random numbers from ??2, 5? starting with standard normal random numbers in R.
Generate 1000 random numbers from a normal distribution with mean 1 and variance 2 using Box‐Muller...
Generate 1000 random numbers from a normal distribution with mean 1 and variance 2 using Box‐Muller transformation in R.
3. (3 pt) Use R functions to generate 1000 random samples from t-distribution with 15 degrees...
3. (3 pt) Use R functions to generate 1000 random samples from t-distribution with 15 degrees of freedom. Make a histogram with the samples showing the relative frequencies. Then overlay a probability density plot over this histogram.
A computer was used to generate ten random numbers from a normal distribution with a set...
A computer was used to generate ten random numbers from a normal distribution with a set of unknown mean and variance: −1.1623, 0.2210, 1.6518, −1.1312, −0.2879, −1.0458, 1.3706, −0.7492, −0.1355, −1.2686. Eight more random normal numbers with the same variance perhaps a different mean were then generated (the mean may or may not actually be different): 0.3472, 2.2437, 1.0712, 2.5906, 0.5163, −1.1743, 0.0473, −0.8338. (a) What do you think the means of the random normal number generators were? What do...
Assume that Z  (6). Generate 1000 random numbers from Z and plot the corresponding histogram.
Assume that Z  (6). Generate 1000 random numbers from Z and plot the corresponding histogram.
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.
Program in R: Generate 1000 exponential random deviates with the mean equal to ½. Be careful!...
Program in R: Generate 1000 exponential random deviates with the mean equal to ½. Be careful! The exponential is sometimes parameterized directly with the mean, B, using 1/B*exp(-x/B) and sometimes it is parameterized with the rate lambda = 1/B. Know what your software is doing. After generating the data, compute the mean and variance of the data. The mean and variance is all I need to see.
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
Coding Language: R Generate 100 observations from the normal distribution with mean 3 and variance 1....
Coding Language: R Generate 100 observations from the normal distribution with mean 3 and variance 1. Compute the sample average, the standard error for the sample average, and the 95% confidence interval. Repeat the above two steps 1000 times. Report (a) the mean of the 1000 sample means, (b) the standard deviation of the 1000 sample means, (c) the mean of the 1000 standard errors, and (d) how many times (out of 1000) the 95% confidence intervals include the population...
Use R to generate two random numbers n11, n21 from the Binomial distribution: Bin(10, 0.4). Print...
Use R to generate two random numbers n11, n21 from the Binomial distribution: Bin(10, 0.4). Print your results. Please don’t forget to use the command set.seed(101) before the commands gen- erating the random numbers. (b) (2 points) Use the R command ntable < − array(data = c(n11, n21, n1plus-n11, n2plus-n21), dim = c(2,2)) to create a 2 × 2 table using the numbers generated in part (a) above. Print your table. (c) (3 points) Perform the Fisher’s exact test on...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT