x0000ytrainasmatrixConcretetrain9ကxtestasmatrixConcretetrain18ကytestasmatrixConcretetrain9ကdrmavemaveytrainxtrainmethodMEANOPGmaxdim8ကdrmaveCallma ID: 818459
Download Pdf The PPT/PDF document "ShortIntroductiontotheUsageofPakageMAVEW..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
ShortIntroductiontotheUsageofPakageMAVEW
ShortIntroductiontotheUsageofPakageMAVEWeiqiangHangHongfanZhangYingcunXiaNationalUniversityofSingapore,SingaporeOctober18,20191IntroductionPackageMAVEprovidesseveralmethods,includingMAVEandOPGmethodsproposedby[4,5,6],tondthecentralspace(CS)andthecentralmeanspace(CMS).Italsoimplementsslicedinverseregressionofakernelversion;see[1,4].Formaldenitionofthecentralspaceandthecentralmeanspacecanbefoundin[2,3].Forcomparison,apackagedrinCRANalsocontainsothersucientdimensionreductionmethods[7].ThemainpartofpackageMAVEiswritteninC++basedonRcppArmadillopackage.Ifthereisanyproblemduringinstallation,pleaseupdateyourRcpppackageandinstallRcppArmadillopackageandtryagain.2UsageTheprimaryfunctioninthispackageisMAVE.TheinputargumentsincludeannpcovariatematrixX,ann1respondmatrixY,andthemethodargumentfordimensionreduction.Theoptionsforthemethodargumentare'csopg','cs-mave','meanopg','meanmave'and'ksir',andthedefaultis'csopg'.'csopg'and'cs-mave'aremethodsofndingCSbyOPGandMAVErespectively,'meanopg'and'meanmave'aremethodsofndingCMSbyOPGandMAVE,'ksir'istheslicedinverseregressionofkernelversion.SinceOPGmethodistime-savingcomparedwithMAVEandtheresultofOPGisasgoodasthatofMAVE,werecommend
usingOPG.Argumentmax.dimsetsthemaximumdi
usingOPG.Argumentmax.dimsetsthemaximumdimensionformavetocompute.Thedefaultvalueis10meaningthatitwillonlycalculatedimensionreductionspacesofdimensionupto10.Itwillhelpusersavecomputationtimewhenthedataishighdimensional.Wewilluseexamplestoillustratetheusageofthepackage.library(MAVE)data(Concrete)set.seed(1234)train-sample(1:1030)[1:500]ကx.train-as.matrix(Concrete[train,1:8])1y.train-as.matrix(Concrete[train,9])ကx.test-as.matrix(Concrete[-train,1:8])ကy.test-as.matrix(Concrete[-train,9])ကdr.mave-mave(y.train~x.train,method='MEANOPG',max.dim=8)ကdr.maveCall:mave(formula=y.train~x.train,method="MEANOPG",max.dim=8)centralmeanspaceofdimensions12345678arecomputedTheobjectreturnedbymaveormave.computecontainsinformationofcall,dataandbasismatricesofdimensionreductionspaceswithdifferentdimensions.Thebasismatrixofagivendimension,2,forexample,canbeobtainedbyကdir2-coef(dr.mave,dim=2)Thenthereduceddataisobtainedfromoriginaldatamultipliedbythebasismatrixofdimensionreductionspace.Thereduceddatacanbecalculatedbymave.data.Thefollowingisanexampletoapplymarsinpacakgemdatothereduceddataforprediction.ကlibrary(mda)ကx.train.mave-mave.data(dr.mave,x=x.train,dim=
2)ကx.test.mave-mave.data(dr.mave,x=x.t
2)ကx.test.mave-mave.data(dr.mave,x=x.test,dim=2)ကmodel.mars-mars(x.train.mave,y.train,degree=2)ကy.pred.mars-predict(model.mars,x.test.mave)ကmean((y.pred.mars-y.test)^2)[1]113.0373Forconvenience,thepackageprovidespredicttoimplementtheaboveprocedurewithsomemodifications.Theargumentdegreewillbepassedtomarswhichspecifiesthemaximuminteractiondegree.Moreargumentslikethreshorpenaltycanbepassedtomarsbyplacingthemafterdiminthepredictmethod.ကy.pred-predict(dr.mave,newx=x.test,dim=2,degree=2)ကmean((y.pred-y.test)^2)[1]88.48931InMAVEpackageofversion1.3.8,mavefunctionallowsmutiplereponse,whichmeansthatargumentycananqmatrix.mave.dimimplementstheselectionofdimensionoftheCSorCMSdiscussedinsection??.Itreturnsanobjectwithadditionalinformationofcross-validationvaluesofdifferentdimensions.Belowisasimpleexampletoillustrateitsusage.2set.seed(12345)n=800x-matrix(rnorm(n*5),n,5)ကbeta1-matrix(c(0.717,0.717,0,0,0))ကbeta2-matrix(c(0,0,0.717,0.717,0))ကbeta3-matrix(c(0,0,0,0,1))ကerr1-matrix(rnorm(n))ကerr2-matrix(rnorm(n))ကy1-as.matrix((x%*%beta1)/(1+2*(x%*%beta2)^2)+(x%*%beta3)*err1)ကy2-as.matrix((x%*%beta3)^2)+err2ကy=cbind(y1,y2)ကdr.mave-mave(y~x,method='CSO
PG')ကdr.mave.dim-mave.dim(dr.mave)ကd
PG')ကdr.mave.dim-mave.dim(dr.mave)ကdr.mave.dimCall:mave.dim(dr=dr.mave)Thecross-validationisrunondimensionsof012345Dimension012345CV-value0.290.260.240.250.260.27Theselecteddimensionofcentralspaceis2Thecodebelowcanbeusedtofindtheselecteddimensionwithminimumcross-validationvalue.ကwhich.min(dr.mave.dim$cv)[1]2Fromtheresult,theestimateddimensionreductionspacewithdimension3hastheminimumcross-validationvalue.TheestimatedbasisvectorsofCSofdimension3canbeaccessedbycoefmethod.Fromtheresult,theestimatedbasisvectorfallsinthelinearspacegeneratedby(1;2;3)withsmalldeviation.Althoughinthisexample,theestimatedbasisvectorsarecloseto(1;2;3),weshouldnotethattheoriginalbasisvectorslike(1;2;3)areunidentifiable,onlythespacegeneratedbythetheoriginalbasisvectorsisidentifiable.ကcoef(dr.mave,dim=3)dir1dir2dir3x1-0.0022907430.71487066-0.12210258x20.0056505790.69502519-0.01138889x3-0.006105577-0.07085736-0.63225614x40.034851445-0.02713024-0.76417882x50.9993552530.011962970.035272503InMAVEpackageofversion1.3.8,weusescreeningmethodtoselectimportvariablesinhighdimensionaldata.Thedefaultnumberofvariablesretainedafterscreeningisn=log(n).Thefollowingisanexampleaboutit
.set.seed(12345)n-200က
.set.seed(12345)n-200ကp-500ကx-matrix(rnorm(n*p),n,p)ကy-x[,1]+x[,2]+rnorm(n)ကdr.mave-mave(y~x,method='MEANOPG')screeningmethodisusingtoselectimportvariables.ကdr.mave.dim-mave.dim(dr.mave)ကdr.mave.dimCall:mave.dim(dr=dr.mave)Thecross-validationisrunondimensionsof012345678910Dimension012345678910CV-value1.470.730.620.630.740.870.921.021.071.111.14Theselecteddimensionofcentralmeanspaceis2References[1]Li,K.C.(1991).Slicedinverseregressionfordimensionreduction.JournaloftheAmericanStatisticalAssociation,86(414),316-327.[2]Cook,R.D.(1998),RegressionGraphics.NewYork:Wiley[3]Cook,R.D.,andLi,B.(2002).Dimensionreductionforconditionalmeaninregression.AnnalsofStatistics,455-474.[4]Xia,Y.,Tong,H.,Li,W.K.,andZhu,L.X.(2002).Anadaptiveestimationofdimensionreductionspace.JournaloftheRoyalStatisticalSociety:SeriesB(StatisticalMethodology),64(3),363-410.[5]Xia,Y.(2007)Aconstructiveapproachtotheestimationofdimensionreductiondirections.AnnalsofStatistics,35(3),2654-26904[6]Wang,H.,andXia,Y.(2008).Slicedregressionfordimensionreduction.JournaloftheAmericanStatisticalAssociation,103(482),811-821.[7]Weisberg,S.(2002).DimensionreductionregressioninR.JournalofStatisticalSoftware,7(1),1-22