CS计算机代考程序代写 c/c++ chain Bayesian algorithm Contents
Contents
Preface to the Second Edition xi Preface to the First Edition xiii 1 Introduction 1
1.1 StatisticalComputing …………………. 1 1.2 TheREnvironment ………………….. 3 1.3 GettingStartedwithRandRStudio . . . . . . . . . . . . . 5 1.4 BasicSyntax ……………………… 7 1.5 UsingtheROnlineHelpSystem ……………. 9 1.6 DistributionsandStatisticalTests . . . . . . . . . . . . . . . 11 1.7 Functions ……………………….. 12 1.8 Arrays,DataFrames,andLists ……………. 13 1.9 FormulaSpecification …………………. 20 1.10Graphics ……………………….. 20 1.11Introductiontoggplot ………………… 23 1.12WorkspaceandFiles ………………….. 26
1.12.1 TheWorkingDirectory …………….. 28 1.12.2 ReadingDatafromExternalFiles . . . . . . . . . . . 28 1.12.3 Importing/Exporting.csvFiles . . . . . . . . . . . . . 31
1.13UsingScripts ……………………… 32
1.14UsingPackages………. 1.15 Using R Markdown and knitr . .
2 Probability and Statistics Review
……………. 33 ……………. 33
37
2.1 RandomVariablesandProbability …………… 37
2.2 SomeDiscreteDistributions ……………… 42
2.3 SomeContinuousDistributions …………….. 45
2.4 MultivariateNormalDistribution …………… 49
2.5 LimitTheorems ……………………. 50
2.6 Statistics ……………………….. 51
2.7 Bayes’ Theorem and Bayesian Statistics . . . . .
2.8 MarkovChains ………………
Rizzo, Maria L.. Statistical Computing with R, Second Edition, CRC Press LLC, 2019. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/ualberta/detail.action?docID=5731927.
Created from ualberta on 2021-03-06 10:34:03.
……. 55 ……. 57
v
Copyright © 2019. CRC Press LLC. All rights reserved.
vi Contents
3 Methods for Generating Random Variables 61
3.1 Introduction ……………………… 61
3.2 TheInverseTransformMethod …………….. 63 3.2.1 Inverse Transform Method, Continuous Case . . . . . 64
3.2.2 Inverse Transform Method, Discrete Case . . . . . . . 65
3.3 TheAcceptance-RejectionMethod …………… 69
3.4 TransformationMethods ……………….. 71
3.5 SumsandMixtures ………………….. 75
3.6 MultivariateDistributions ………………. 83
3.6.1 MultivariateNormalDistribution. . . . . . . . . . . . 83
3.6.2 MixturesofMultivariateNormals. . . . . . . . . . . . 90
3.6.3 WishartDistribution………………. 92
3.6.4 Uniform Distribution on the d-Sphere . . . . . . . . . 93
Exercises ………………………….. 96
4 Generating Random Processes 99
4.1 StochasticProcesses ………………….. 99
4.1.1 PoissonProcesses………………… 99
4.1.2 RenewalProcesses ……………….. 104
4.1.3 SymmetricRandomWalk ……………. 105
4.2 BrownianMotion …………………… 109
Exercises ………………………….. 112
5 Visualization of Multivariate Data 115
5.1 Introduction ……………………… 115
5.2 PanelDisplays …………………….. 115
5.3 CorrelationPlots……………………. 118
5.4 SurfacePlotsand3DScatterPlots . . . . . . . . . . . . . . 120
5.4.1 SurfacePlots ………………….. 121
5.4.2 Three-dimensional Scatterplot . . . . . . . . . . . . . 124
5.5 ContourPlots …………………….. 126
5.6 Other2DRepresentationsofData …………… 129
5.6.1 AndrewsCurves ………………… 129
5.6.2 ParallelCoordinatePlots ……………. 132
5.6.3 Segments, Stars, and Other Representations . . . . . . 133
5.7 PrincipalComponentsAnalysis ……………. 135
5.8 OtherApproachestoDataVisualization . . . . . . . . . . . 141
5.9 AdditionalResources …………………. 143
Exercises ………………………….. 143
Rizzo, Maria L.. Statistical Computing with R, Second Edition, CRC Press LLC, 2019. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/ualberta/detail.action?docID=5731927.
Created from ualberta on 2021-03-06 10:34:03.
Copyright © 2019. CRC Press LLC. All rights reserved.
Contents vii
6 Monte Carlo Integration and Variance Reduction 147
6.1 Introduction ……………………… 147
6.2 MonteCarloIntegration ……………….. 147 6.2.1 SimpleMonteCarloEstimator . . . . . . . . . . . . . 148 6.2.2 VarianceandEfficiency …………….. 152
6.3 VarianceReduction ………………….. 154
6.4 AntitheticVariables ………………….. 155
6.5 ControlVariates ……………………. 159
6.5.1 Antithetic Variate as Control Variate . . . . . . . . . . 162
6.5.2 SeveralControlVariates…………….. 163
6.5.3 ControlVariatesandRegression . . . . . . . . . . . . 163
6.6 ImportanceSampling …………………. 168
6.7 StratifiedSampling ………………….. 173
6.8 StratifiedImportanceSampling ……………. 176
Exercises ………………………….. 178 RCode …………………………… 181
7 Monte Carlo Methods in Inference 183
7.1 Introduction ……………………… 183
7.2 MonteCarloMethodsforEstimation . . . . . . . . . . . . . 184 7.2.1 Monte Carlo Estimation and Standard Error . . . . . 184 7.2.2 EstimationofMSE……………….. 185 7.2.3 EstimatingaConfidenceLevel . . . . . . . . . . . . . 188
7.3 MonteCarloMethodsforHypothesisTests . . . . . . . . . . 192 7.3.1 EmpiricalTypeIErrorRate ………….. 193 7.3.2 PowerofaTest…………………. 197 7.3.3 PowerComparisons ………………. 200
7.4 Application: “Count Five” Test for Equal Variance . . . . . . 204
Exercises ………………………….. 209
8 Bootstrap and Jackknife 213
8.1 TheBootstrap …………………….. 213 8.1.1 Bootstrap Estimation of Standard Error . . . . . . . . 215 8.1.2 BootstrapEstimationofBias ………….. 217
8.2 TheJackknife …………………….. 220
8.3 BootstrapConfidenceIntervals …………….. 224
8.3.1 The Standard Normal Bootstrap Confidence Interval . 224
8.3.2 The Basic Bootstrap Confidence Interval . . . . . . . . 225
8.3.3 The Percentile Bootstrap Confidence Interval . . . . . 226
8.3.4 TheBootstraptInterval…………….. 228
8.4 BetterBootstrapConfidenceIntervals . . . . . . . . . . . . . 231
8.5 Application:CrossValidation ……………… 235
Rizzo, Maria L.. Statistical Computing with R, Second Edition, CRC Press LLC, 2019. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/ualberta/detail.action?docID=5731927.
Created from ualberta on 2021-03-06 10:34:03.
Copyright © 2019. CRC Press LLC. All rights reserved.
viii
Contents
9
Exercises ………………………….. 239 Resampling Applications 243
9.1 Jackknife-after-Bootstrap ……………….. 243
9.2 ResamplingforRegressionModels …………… 246 9.2.1 ResamplingCases ……………….. 250 9.2.2 ResamplingErrors(ModelBased) . . . . . . . . . . . 254
9.3 Influence ……………………….. 260
9.3.1 Empirical Influence Values for a Statistic . . . . . . . 260
9.3.2 Jackknife-after-Bootstrap Plots . . . . . . . . . . . . . 261
Exercises ………………………….. 263
10 Permutation Tests 265
10.1Introduction ……………………… 265 10.2TestsforEqualDistributions ……………… 269 10.3 Multivariate Tests for Equal Distributions . . . . . . . . . . 272
10.3.1 NearestNeighborTests …………….. 273
10.3.2 Energy Test for Equal Distributions . . . . . . . . . . 281 10.4 Application:DistanceCorrelation . . . . . . . . . . . . . . . 287 Exercises ………………………….. 294
11 Markov Chain Monte Carlo Methods 297
11.1Introduction ……………………… 297 11.1.1 Integration Problems in Bayesian Inference . . . . . . 297 11.1.2 Markov Chain Monte Carlo Integration . . . . . . . . 298
11.2 TheMetropolis-HastingsAlgorithm . . . . . . . . . . . . . . 299 11.2.1 Metropolis-HastingsSampler . . . . . . . . . . . . . . 300 11.2.2 TheMetropolisSampler…………….. 310 11.2.3 RandomWalkMetropolis ……………. 310 11.2.4 TheIndependenceSampler …………… 316
11.3TheGibbsSampler ………………….. 318 11.4MonitoringConvergence ……………….. 322 11.4.1 WhyMonitorConvergence …………… 322 11.4.2 Methods for Monitoring Convergence . . . . . . . . . . 323 11.4.3 TheGelman-RubinMethod…………… 323 11.5 Application:ChangePointAnalysis . . . . . . . . . . . . . . 327 Exercises ………………………….. 333 RCode …………………………… 335
Rizzo, Maria L.. Statistical Computing with R, Second Edition, CRC Press LLC, 2019. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/ualberta/detail.action?docID=5731927.
Created from ualberta on 2021-03-06 10:34:03.
Copyright © 2019. CRC Press LLC. All rights reserved.
Contents ix 12 Probability Density Estimation 337
12.1UnivariateDensityEstimation …………….. 337 12.1.1 Histograms …………………… 338 12.1.2 Frequency Polygon Density Estimate . . . . . . . . . . 345 12.1.3 TheAveragedShiftedHistogram . . . . . . . . . . . . 347
12.2KernelDensityEstimation ………………. 351
12.3 Bivariate and Multivariate Density Estimation . . . . . . . . 361 12.3.1 BivariateFrequencyPolygon ………….. 361 12.3.2 BivariateASH …………………. 364 12.3.3 Multidimensional Kernel Methods . . . . . . . . . . . 366
12.4 OtherMethodsofDensityEstimation . . . . . . . . . . . . . 369
Exercises ………………………….. 370 RCode …………………………… 373
13 Introduction to Numerical Methods in R 375
13.1Introduction ……………………… 375 13.2Root-findinginOneDimension ……………. 383 13.3NumericalIntegration …………………. 386 13.4MaximumLikelihoodProblems…………….. 391 13.5 Application: Evaluating an Expected Value . . . . . . . . . . 394 Exercises ………………………….. 398
14 Optimization 401
14.1Introduction ……………………… 401 14.2One-dimensionalOptimization …………….. 402 14.3 Maximum Likelihood Estimation with mle . . . . . . . . . . 403 14.4Two-dimensionalOptimization …………….. 405 14.5TheEMAlgorithm ………………….. 409 14.6 Linear Programming – The Simplex Method . . . . . . . . . 411 14.7Application:GameTheory ………………. 413 Exercises ………………………….. 417
15 Programming Topics 419
15.1Introduction ……………………… 419 15.2 Benchmarking: Comparing the Execution Time of Code . . . 419 15.2.1 Using the microbenchmark Package . . . . . . . . . . 420 15.2.2 UsingtherbenchmarkPackage . . . . . . . . . . . . . 423 15.3Profiling ……………………….. 425 15.4 ObjectSize,Attributes,andEquality . . . . . . . . . . . . . 427 15.4.1 ObjectSize …………………… 427 15.4.2 AttributesofObjects………………. 428
Rizzo, Maria L.. Statistical Computing with R, Second Edition, CRC Press LLC, 2019. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/ualberta/detail.action?docID=5731927.
Created from ualberta on 2021-03-06 10:34:03.
Copyright © 2019. CRC Press LLC. All rights reserved.
x
Contents
15.4.3 ComparingObjectsforEquality . . . . . . . . . . . . 429 15.5FindingSourceCode …………………. 430 15.5.1 FindingRFunctionCode ……………. 430 15.5.2 Methods…………………….. 431 15.5.3 MethodsandFunctionsinPackages . . . . . . . . . . 432 15.5.4 CompiledCode…………………. 433 15.6LinkingC/C++CodeUsingRcpp …………… 434 15.7Application:BaseballData ………………. 438 Exercises ………………………….. 442
Notation 445 Bibliography 447 Index 469
Rizzo, Maria L.. Statistical Computing with R, Second Edition, CRC Press LLC, 2019. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/ualberta/detail.action?docID=5731927.
Created from ualberta on 2021-03-06 10:34:03.
Copyright © 2019. CRC Press LLC. All rights reserved.