ebook img

Financial Analytics with R - Building a Laptop Laboratory for Data Science PDF

393 Pages·2016·18.2 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Financial Analytics with R - Building a Laptop Laboratory for Data Science

FinancialAnalyticswithR BuildingaLaptopLaboratoryforDataScience Areyouinnatelycuriousaboutdynamicallyinter-operatingfinancialmarkets?Sincethe crisisof2008,thereisaneedforprofessionalswithmoreunderstandingaboutstatistics anddataanalysis,whocandiscussthevariousriskmetrics,particularlythoseinvolving extremeevents. Byproviding aresource for trainingstudents and professionals inbasic and sophis- ticated analytics, this book meets that need. It offers both the intuition and basic vocabularyasasteptowardthefinancial,statistical,andalgorithmicknowledgerequired toresolvetheindustryproblems,anditdepictsasystematicwayofdevelopinganalytical programsforfinanceinthestatisticallanguageR.Buildahands-onlaboratoryandrun manysimulations.Exploretheanalyticalfringesofinvestmentsandriskmanagement. Bennett and Hugen help profit-seeking investors and data science students sharpen theirskillsinmanyareas,includingtime-series,forecasting,portfolioselection,covari- anceclustering,prediction,andderivativesecurities. MarkJ.Bennettisaseniordatascientistwithamajorinvestmentbankandalecturerin theUniversityofChicago’sMaster’sprograminAnalytics.Hehasheldsoftwareposi- tions at Argonne National Laboratory, Unisys Corporation, AT&T Bell Laboratories, NorthropGrumman,andXRTradingSecurities. DirkL.HugenisagraduatestudentintheDepartmentofStatisticsandActuarialScience attheUniversityofIowa.Hepreviouslyworkedasasignalprocessingengineer. 06:21:40, subject to the Cambridge Core terms of use, available at 06:21:40, subject to the Cambridge Core terms of use, available at Financial Analytics with R Building a Laptop Laboratory for Data Science MARK J. BENNETT UniversityofChicago DIRK L. HUGEN UniversityofIowa 06:21:40, subject to the Cambridge Core terms of use, available at UniversityPrintingHouse,CambridgeCB28BS,UnitedKingdom CambridgeUniversityPressispartoftheUniversityofCambridge. ItfurtherstheUniversity’smissionbydisseminatingknowledgeinthepursuitof education,learning,andresearchatthehighestinternationallevelsofexcellence. www.cambridge.org Informationonthistitle:www.cambridge.org/9781107150751 ©MarkJ.BennettandDirkL.Hugen2016 Thispublicationisincopyright.Subjecttostatutoryexception andtotheprovisionsofrelevantcollectivelicensingagreements, noreproductionofanypartmaytakeplacewithoutthewritten permissionofCambridgeUniversityPress. Firstpublished2016 PrintedintheUnitedKingdombyClays,StIvesplc AcataloguerecordforthispublicationisavailablefromtheBritishLibrary. LibraryofCongressCataloging-in-PublicationData Names:Bennett,MarkJ.(MarkJoseph),1959–author.|Hugen,DirkL.,author. Title:FinancialanalyticswithR:buildingalaptoplaboratoryfordata science/MarkJ.Bennett,UniversityofChicago,DirkL.Hugen, UniversityofIowa. Description:Cambridge,UK:CambridgeUniversityPress,2016. Identifiers:LCCN2016026635|ISBN9781107150751 Subjects:LCSH:Finance–Mathematicalmodels–Dataprocessing.| Finance–Databases.|R(Computerprogramlanguage) Classification:LCCHG104.B462016|DDC332.0285/513--dc23 LCrecordavailableathttps://lccn.loc.gov/2016026635 ISBN978-1-107-15075-1Hardback CambridgeUniversityPresshasnoresponsibilityforthepersistenceoraccuracyof URLsforexternalorthird-partyInternetWebsitesreferredtointhispublication anddoesnotguaranteethatanycontentonsuchWebsitesis,orwillremain, accurateorappropriate. 06:21:40, subject to the Cambridge Core terms of use, available at Toourparents: MaryandHerbandPatriciaandBernard andfamily: Rachel,Austin,andCheryl foralltheirkindness,love,andsupport 06:22:47, subject to the Cambridge Core terms of use, available at 06:22:47, subject to the Cambridge Core terms of use, available at Contents Preface pagexiii Acknowledgments xvii 1 AnalyticalThinking 1 1.1 WhatIsFinancialAnalytics? 2 1.2 WhatIstheLaptopLaboratoryforDataScience? 3 1.3 WhatIsRandHowCanItBeUsedintheProfessionalAnalyticsWorld? 5 1.4 Exercises 6 2 TheRLanguageforStatisticalComputing 7 2.1 GettingStartedwithR 7 2.2 LanguageFeatures:Functions,Assignment,Arguments,andTypes 10 2.3 LanguageFeatures:BindingandArrays 13 2.4 ErrorHandling 17 2.5 Numeric,Statistical,andCharacterFunctions 18 2.6 DataFramesandInput–Output 19 2.7 Lists 20 2.8 Exercises 22 3 FinancialStatistics 23 3.1 Probability 23 3.2 Combinatorics 24 3.3 MathematicalExpectation 31 3.4 SampleMean,StandardDeviation,andVariance 35 3.5 SampleSkewnessandKurtosis 36 3.6 SampleCovarianceandCorrelation 36 3.7 FinancialReturns 39 3.8 CapitalAssetPricingModel 40 3.9 Exercises 42 4 FinancialSecurities 44 4.1 BondInvestments 45 4.2 StockInvestments 48 06:22:54, subject to the Cambridge Core terms of use, available at viii Contents 4.3 TheHousingCrisis 49 4.4 TheEuroCrisis 50 4.5 SecuritiesDatasetsandVisualization 52 4.6 AdjustingforStockSplits 55 4.7 AdjustingforMergers 61 4.8 PlottingMultipleSeries 62 4.9 SecuritiesDataImporting 64 4.10 SecuritiesDataCleansing 71 4.11 SecuritiesQuoting 74 4.12 Exercises 75 5 DatasetAnalyticsandRiskMeasurement 77 5.1 GeneratingPricesfromLogReturns 77 5.2 NormalMixtureModelsofPriceMovements 80 5.3 SuddenCurrencyPriceMovementin2015 86 5.4 Exercises 90 6 TimeSeriesAnalysis 92 6.1 ExaminingTimeSeries 92 6.2 StationaryTimeSeries 97 6.3 Auto-RegressiveMovingAverageProcesses 98 6.4 PowerTransformations 98 6.5 TheTSAPackage 99 6.6 Auto-RegressiveIntegratedMovingAverageProcesses 109 6.7 CaseStudy:EarningsofJohnson&Johnson 110 6.8 CaseStudy:MonthlyAirlinePassengers 114 6.9 CaseStudy:ElectricityProduction 117 6.10 GeneralizedAuto-RegressiveConditionalHeteroskedasticity 120 6.11 CaseStudy:VolatilityofGoogleStockReturns 121 6.12 Exercises 128 7 TheSharpeRatio 130 7.1 SharpeRatioFormula 131 7.2 TimePeriodsandAnnualizing 131 7.3 RankingInvestmentCandidates 132 7.4 TheQuantmodPackage 136 7.5 MeasuringIncomeStatementGrowth 141 7.6 SharpeRatiosforIncomeStatementGrowth 144 7.7 Exercises 155 8 MarkowitzMean-VarianceOptimization 157 8.1 OptimalPortfolioofTwoRiskyAssets 157 8.2 QuadraticProgramming 160 8.3 DataMiningwithPortfolioOptimization 162 06:22:54, subject to the Cambridge Core terms of use, available at Contents ix 8.4 Constraints,Penalization,andtheLasso 165 8.5 ExtendingtoHighDimensions 171 8.6 CaseStudy:SurvivingStocksoftheS&P500Indexfrom2003to2008 179 8.7 CaseStudy:ThousandsofCandidateStocksfrom2008to2014 182 8.8 CaseStudy:Exchange-TradedFunds 186 8.9 Exercises 195 9 ClusterAnalysis 197 9.1 K-MeansClustering 197 9.2 DissectingtheK-MeansAlgorithm 204 9.3 SparsityandConnectednessofUndirectedGraphs 208 9.4 CovarianceandPrecisionMatrices 211 9.5 VisualizingCovariance 215 9.6 TheWishartDistribution 221 9.7 Glasso:PenalizationforUndirectedGraphs 225 9.8 RunningtheGlassoAlgorithm 225 9.9 TrackingaValueStockthroughtheYears 226 9.10 RegressiononYearlySparsity 231 9.11 RegressiononQuarterlySparsity 235 9.12 RegressiononMonthlySparsity 236 9.13 ArchitectureandExtension 238 9.14 Exercises 239 10 GaugingtheMarketSentiment 240 10.1 MarkovRegimeSwitchingModel 241 10.2 ReadingtheMarketData 244 10.3 BayesianReasoning 247 10.4 TheBetaDistribution 250 10.5 PriorandPosteriorDistributions 250 10.6 ExaminingLogReturnsforCorrelation 253 10.7 MomentumGraphs 255 10.8 Exercises 259 11 SimulatingTradingStrategies 261 11.1 ForeignExchangeMarkets 261 11.2 ChartAnalytics 263 11.3 InitializationandFinalization 264 11.4 MomentumIndicators 265 11.5 BayesianReasoningwithinPositions 266 11.6 Entries 268 11.7 Exits 269 11.8 Profitability 270 11.9 Short-TermVolatility 270 11.10 TheStateMachine 271 06:22:54, subject to the Cambridge Core terms of use, available at x Contents 11.11 SimulationSummary 278 11.12 Exercises 280 12 DataExplorationUsingFundamentals 281 12.1 TheRSQLitePackage 281 12.2 FindingMarket-to-BookRatios 283 12.3 TheReshape2Package 285 12.4 CaseStudy:Google 288 12.5 CaseStudy:Walmart 289 12.6 ValueInvesting 290 12.7 Lab:TryingtoBeattheMarket 294 12.8 Lab:FinancialStrength 295 12.9 Exercises 296 13 PredictionUsingFundamentals 297 13.1 BestIncomeStatementPortfolio 298 13.2 ReformattingIncomeStatementGrowthFigures 298 13.3 ObtainingPriceStatistics 300 13.4 CombiningtheIncomeStatementwithPriceStatistics 306 13.5 PredictionUsingClassificationTreesandRecursivePartitioning 308 13.6 ComparingPredictionRatesamongClassifiers 314 13.7 Exercises 316 14 BinomialModelforOptions 318 14.1 ApplyingComputationalFinance 318 14.2 Risk-NeutralPricingandNoArbitrage 322 14.3 HighRisk-FreeRateEnvironment 322 14.4 ConvergenceofBinomialModelforOptionData 324 14.5 Put–CallParity 327 14.6 FromBinomialtoLog-Normal 328 14.7 Exercises 330 15 Black–ScholesModelandOption-ImpliedVolatility 331 15.1 GeometricBrownianMotion 332 15.2 MonteCarloSimulationofGeometricBrownianMotion 333 15.3 Black–ScholesDerivation 335 15.4 AlgorithmforImpliedVolatility 338 15.5 ImplementationofImpliedVolatility 339 15.6 TheRcppPackage 345 15.7 Exercises 348 Appendix ProbabilityDistributionsandStatisticalAnalysis 350 A.1 Distributions 350 A.2 BernoulliDistribution 350 06:22:54, subject to the Cambridge Core terms of use, available at

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.