2coefmaveplotmave9predictmave10spam11Index12 coefmaveDirectionsofCSo ID: 818458
Download Pdf The PPT/PDF document "Package`MAVE'October18,2019TypePackageTi..." 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.
Package`MAVE'October18,2019TypePackageTi
Package`MAVE'October18,2019TypePackageTitleMethodsforDimensionReductionVersion1.3.10Date2019-10-17AuthorHangWeiqiangݘ@u.n;us.e; u00;,XiaYingcunstax;yc@n;us.e; u.s;g000;MaintainerHangWeiqiangݘ@u.n;us.e; u00;DescriptionFunctionsfordimensionreduction,usingMAVE(MinimumAverageVarianceEstima-tion),OPG(OuterProductofGradient)andKSIR(slicedinverseregressionofkernelver-sion).Methodsforselectingthebestdimensionarealsoincluded.Xia(2002) oi:;.1;đ/;ᑧ-]TJ; 0 -;.9;U T; [0;9868.03411;Xia(2007) oi:;.1;Ȕ/;占瀀刀Wang(2008) oi:;.1;Ƙ/;Ţᑐ耀᠀LicenseGPL oi:;.1;Ƙ/;Ţᑐ耀᠀(=2)LazyDatayesImportsRcpp oi:;.1;Ƙ/;Ţᑐ耀᠀(=0.11.0),stats,graphics,mdaDependsR oi:;.1;Ƙ/;Ţᑐ耀᠀(=3.1.0)LinkingToRcpp,RcppArmadilloRoxygenNote6.1.1SuggestsknitrVignetteBuilderknitrNeedsCompilationyesRepositoryCRANDate/Publication2019-10-1806:20:02UTCRtopicsdocumented:coef.mave..........................................2Concrete........
...................................3kc_h
...................................3kc_house_data........................................4mave.............................................5mave.data..........................................7mave.dim..........................................812coef.maveplot.mave..........................................9predict.mave.........................................10spam.............................................11Index12coef.maveDirectionsofCSorCMSofgivendimensionDescriptionThisfunctionreturnsthebasismatrixofCSorCMSofgivendimensionUsage##S3methodforclass'mave'coef(object,dim,...)##S3methodforclass'mave.dim'coef(object,dim="dim.min",...)Argumentsobjecttheoutputofmaveortheoutputofmave.dimdimthedimensionofCSorCMS.Thevalueofdimshouldbegivenwhentheclassoftheargumentdrismave.Whentheclassoftheargumentdrismave.dimanddimisnotgiven,thefunctionwillreturnthebasismatrixofCSorCMSofdimensionselectedbymave.dim...nouse.ValuedirthematrixofCSorCMSofgivendimensionSeeAlsomave.dataforobtainingthereduceddataExamplesxmatrix(rnorm(400),100,4)yx[,1]+x[,2]+as.matrix(rnorm(100))drmave(y~x)dir3coef(dr,3)dr.dimmave
.dim(dr)dir3coef(dr.dim,3)dir.bestcoef(d
.dim(dr)dir3coef(dr.dim,3)dir.bestcoef(dr.dim)Concrete3ConcreteConcreteCompressiveStrengthDataSetDescriptionConcretestrengthisveryimportantincivilengineeringandisahighlynonlinearfunctionofageandingredients.Thisdatasetcontains1030instancesandthereare8featuresrelevanttoconcretestrength.Thedescriptionofthevaraiblesaregivenbelow.Thedescriptionisfromhttps://archive.ics.uci.edu/ml/datasets/Concrete+Compressive+Strength.NameDataTypeMeasurementDescriptionFormatAdataframewith1030rowsand8covariatevariablesand1responsevariableDetailsCement(component1)quantitativekginam3mixtureInputVariableBlastFurnaceSlag(component2)quantitativekginam3mixtureInputVariableFlyAsh(component3)quantitativekginam3mixtureInputVariableWater(component4)quantitativekginam3mixtureInputVariableSuperplasticizer(component5)quantitativekginam3mixtureInputVariableCoarseAggregate(component6)quantitativekginam3mixtureInputVariableFineAggregate(component7)quantitativekginam3mixtureInpu
tVariableAgequantitativeDay(
tVariableAgequantitativeDay(1~365)InputVariableConcretecompressivestrengthquantitativeMPaOutputVariableSourcehttps://archive.ics.uci.edu/ml/datasets/Concrete+Compressive+StrengthReferences-ChengYeh,"Modelingofstrengthofhighperformanceconcreteusingarticialneuralnetworks,"CementandConcreteResearch,Vol.28,No.12,pp.1797-1808(1998).Examplesdata(Concrete)train=sample(1:1030)[1:500]x.train=as.matrix(Concrete[train,1:8])y.train=as.matrix(Concrete[train,9])x.test=as.matrix(Concrete[-train,1:8])y.test=as.matrix(Concrete[-train,9])dr=mave.compute(x.train,y.train,method='meanopg',max.dim=8)4kc_house_datadr.dim=mave.dim(dr)y.pred=predict(dr.dim,x.test)#estimationerrormean((y.pred-y.test)^2)kc_house_dataHousepriceinKingCounty,USADescriptionAdatasetcontains21613obervationswith19featuresplushouseprice.Thenamesofthecolumnsaregivenbelow.iddate:Datehousewassold(String)price:Priceofthesoldhousebedrooms:NumerofBedroomsbathrooms:Numerofbathroomssqft_living:Squarefootageofthelivingroomsqrt_log:Squarefootageofthelog
3;oors:Totaloorsinthehousewate
3;oors:Totaloorsinthehousewaterfront:Whetherthehousehasaviewawaterfront(1:yes,0:not)view:unknowncondtion:Conditionofthehousegrade:unknownsqft_above:Squarefootageofhouseapartfrombasementsqft_basement:Squarefootageofthebasementyr_built:Builtyearyr_renovated:Yearwhenthehousewasrenovatedzipcode:zipcodeofthehouselat:LatitudecoordinatelongLongitudecoordinatesqft_living15:Livingroomareain2015(impliessomerenovations)sqrt_lot15:Lotareain2015(impliessomerenovations)FormatAdataframewith21613rowsand19variablesSourcehttps://www.kaggle.com/harlfoxem/housesalespredictionmave5Examplesdata(kc_house_data)#convertdateinstringtodateinnumericvaluekc_house_data[,2]=sapply(kc_house_data[,2],as.double)train=sample(1:21613)[1:1000]x.train=as.matrix(kc_house_data[train,c(2,4:21)])#excludeid,housepricey.train=as.matrix(kc_house_data[train,3])#housepricex.test=as.matrix(kc_house_data[-train,c(2,4:21)])y.test=as.matrix(kc_house_data[-train,3])maveDimensionreductionDescriptionThisfunctionprovidesseveralmethodstoestimatethecentral
spaceorcentralmeanspaceofyonx.Itreturnst
spaceorcentralmeanspaceofyonx.Itreturnsthematrixofcentralspaceorcentralmeanspacefordifferentdimensionsandcontainsotherinformationusedfordimensionselectionbymave.dim.Usagemave(formula,data,method="CSOPG",max.dim=10,screen=NULL,subset,na.action=na.fail)mave.compute(x,y,method="CSOPG",max.dim=10,screen=nrow(x)/log(nrow(x)))ArgumentsformulathemodelusedinregressiondatathedatamethodThisparameterspecifywhichmethodwillbeusedindimensionreduction.Itprovidesvemethods,including"csMAVE","csOPG","meanOPG","meanMAVE","KSIR"bydefault,method='csOPG''meanOPG'and'meanMAVE'estimatedimensionreductionspaceforcon-ditionalmean'csMAVE'and'csOPG'estimatethecentraldimensionreductionspace'KSIR'isakernelversionofslicedinverseregression(Li,1991).Itisfast,butwithpooraccuracy.max.dimthemaximumdimensionofdimensionreductionspace.Thedefaultis10.Inpractice,max.dimwillbeequaltomin(max.dim,ncol(x),screen).screenspecifythenumberofvariablesretainedafterscreeningmethod.Thedefaultisn/log(n).Whenthisnumberissmallerthanmax.dim,thenmax.dimwillchangetothevalueofscreensubsetanoptionalvectorspecifyingasubseto
fobservationstobeusedinthettingproce
fobservationstobeusedinthettingprocess.6mavena.actionafunctionwhichindicateswhatshouldhappenwhenthedatacontainNAs.Thedefaultisna.action,whichwilstopcalculations.Ifna.actionissettobena.omit,theincompletecaseswillberemoved.xThenbypdesignmatrix.yThenbyqrespondmatrix.Valuedrisalistwhichcontains:dir:dir[[d]]isthecentralspacewithd-dimensiond=1,2,...,preduceddirectionofdifferentdimensionsy:thevalueofresponseidx:theindexofvariableswhichsurvivesafterscreeningmax.dim:thelargestdimensionsofCSorCMSwhichhavebeencalculatedinmavefunctionky:parameterusedforDIMforselectionx:theoriginaltrainingdataReferencesLiKC.Slicedinverseregressionfordimensionreduction[J].JournaloftheAmericanStatisticalAssociation,1991,86(414):316-327.XiaY,TongH,LiWK,etal.Anadaptiveestimationofdimensionreductionspace[J].JournaloftheRoyalStatisticalSociety:SeriesB(StatisticalMethodology),2002,64(3):363-410.XiaY.Aconstructiveapproachtotheestimationofdimensionreductiondirections[J].TheAnnalsofStatistics,2007:2654-2690.WangH,XiaY.Slicedregressionfordimensionreduction[J].JournaloftheAmericanStat
isticalAssociation,2008,103(482):811-821
isticalAssociation,2008,103(482):811-821.SeeAlsomave.dimfordimensionselection,predict.maveforpredictionusingthedimensionreductionspace,coef.maveforaccessingthebasisvectorsofdimensionreductionspaceofgivendimension,plot.maveforplotmethodformaveclassExamplesxmatrix(rnorm(400*5),400,5)b1matrix(c(1,1,0,0,0),5,1)b2matrix(c(0,0,1,1,0),5,1)epsmatrix(rnorm(400),400,1)yx%*%b1+(x%*%b2)*eps#findingcentralspacebasedonOPGmethod#dr.csopgmave.compute(x,y,method='csopg')#ordr.csopgmave(y~x,method='csopg')mave.data7#dr.meanopgmave.compute(x,y,method='meanopg')#ordr.meanopgmave(y~x,method='meanopg')#findcentralmeanspacebasedonksirmethoddr.ksirmave(y~x,method='ksir')#or#dr.ksirmave.compute(x,y,method='ksir')#Seemoreexamplesaboutscreeningandmutipleresponsesinthevignette#Usingscreeningforhighdimensionaldata#xmatrix(rnorm(100*50),100,50)#y1=as.matrix(x[,1])+rnorm(100)*.2#y2=as.matrix(x[,2]+x[,3])*as.matrix(x[,1]+x[,5])+rnorm(100)*.2#y=cbind(y1,y2)#dr.sc=mave(y~x,method='CSOPG',max.dim=5,screen=20)#dr.sc.dim=mave.dim(dr.sc)#printthedirectionsofcentralspacewiththeselectedvariables#dr.sc.dim$dir[[3]][dr.sc$i
dx,]mave.dataThereduceddatamatrixDescr
dx,]mave.dataThereduceddatamatrixDescriptionThefunctionreturnsthereduceddatamatrixoftheoriginaldata.Thereduceddatamatrixisob-tainedbytheoriginaldatamultipliedbythedimensionreductiondirectionsofgivendimension.Usagemave.data(dr,x,dim=NULL)Argumentsdrtheobjectreturnedbymaveormave.dimxtheoriginaldatamatrixofpdimensionsdimthedimensionofthereduceddatamatrix.SeeAlsocoef.maveforobtainingthedimensionreductiondirections8mave.dimExamplesxmatrix(rnorm(400),100,4)yx[,1]+x[,2]+as.matrix(rnorm(100))drmave(y~x)x.reducedmave.data(dr,x,3)mave.dimSelectbestdirectionusingcross-validationDescriptionThisfunctionselectsthedimensionofthecentral(mean)spacebasedonthecalculationofMAVEusingcross-validationmethod.Usagemave.dim(dr,max.dim=10)ArgumentsdrtheresultofMAVEfunctionmax.dimthemaximumdimensionforcross-validation.Valuedr.dimcontainsallinformationindrpluscross-validationvaluesofcorrespondingdirectioncv0:thecross-validationvaluewhenthenullmodelisusedcv:thecross-validationvalueusingdimensionreductiondirectionsofdifferentdimensionsdim.min:thedimensionofminimumcross-validationvalue.Noteth
atthisvaluecanbe0.SeeAlsomaveforcomputin
atthisvaluecanbe0.SeeAlsomaveforcomputingthedimensionreductionspace,predict.mave.dimforpredictionmethodofmave.dimclassExamplesxmatrix(rnorm(400*5),400,5)b1matrix(c(1,1,0,0,0),5,1)b2matrix(c(0,0,1,1,0),5,1)epsmatrix(rnorm(400),400,1)yx%*%b1+(x%*%b2)*eps#seleteddimensionofcentralspacedr.csmave(y~x,method='csmave')dr.cs.dimmave.dim(dr.cs)plot.mave9#seleteddimensionofcentralmeanspacedr.meanmave(y~x,method='meanmave')dr.mean.dimmave.dim(dr.mean)plot.mavePlotofmaveormave.dimobjectDescriptionPlotthescatterplotofgivendimensiondirectionsandreponsevariables.Usage##S3methodforclass'mave'plot(x,dim=4,plot.method=pairs,...)##S3methodforclass'mave.dim'plot(x,dim="dim.min",plot.method=pairs,...)Argumentsxtheobjectreturnedbymavedimthedimensionplot.methodthemethodforplottingscatterplot.Thedefaultis'pairs'...argumentspassedtotheplot.method.SeeAlsomaveforcomputingthedimensionreductionspaceExamplesx=matrix(rnorm(2000),400,5)beta1=as.matrix(c(1,1,0,0,0))beta2=as.matrix(c(0,0,1,1,0))err=as.matrix(rnorm(400))y=(x%*%beta1)^2+x%*%beta2+errdr=mave(y~x,method='meanopg')dr.dim=mave.dim(dr)plot(dr,dim=3)plot(
dr.dim)10predict.mavepredict.maveMakep
dr.dim)10predict.mavepredict.maveMakepredictionsbasedonthedimensionreductionspaceDescriptionThismethodmakepredictionsbasedthereduceddimensionofdatausingmarsfunction.Usage##S3methodforclass'mave'predict(object,newx,dim,...)##S3methodforclass'mave.dim'predict(object,newx,dim="dim.min",...)Argumentsobjecttheobjectofclass'mave'newxMatrixofthenewdatatobepredicteddimthedimensionofcentralspaceorcentralmeanspace.Thematrixoftheorig-inaldatawillbemultipliedbythematrixofdimensionreductiondirectionsofgivendimension.Thenthepredictionwillbemadebasedonthedataofgivendimensions.Thevalueofdimshouldbegivenwhentheclassoftheargumentdrismave.Whentheclassoftheargumentdrismave.dimanddimisnotgiven,thefunctionwillreturnthebasismatrixofCSorCMSofdimensionselectedbymave.dim...furtherargumentspassedtomarsfunctionsuchasdegree.ValuethepredicedresponseofthenewdataSeeAlsomaveforcomputingthedimensionreductionspaceandmave.dimforestimatingthedimensionofthedimensionreductionspaceExamplesX=matrix(rnorm(10000),1000,10)beta1=as.matrix(c(1,1,1,1,0,0,0,0,0,0))beta2=as.matrix(c(0,0,0,1,1,1,1,1,0,0))err=as.matrix(rnorm(1000)
)Y=X%*%beta1+X%*%beta2+errtrain=sample(1
)Y=X%*%beta1+X%*%beta2+errtrain=sample(1:1000)[1:500]spam11x.train=X[train,]y.train=as.matrix(Y[train])x.test=X[-train,]y.test=as.matrix(Y[-train])dr=mave(y.train~x.train,method='meanopg')yp=predict(dr,x.test,dim=3,degree=2)#meanerrormean((yp-y.test)^2)dr.dim=mave.dim(dr)yp=predict(dr.dim,x.test,degree=2)#meanerrormean((yp-y.test)^2)spam4601emailrecordDescriptionAdatasetcontaining4601recordofemailwith57features.Thesefeaturesaretherelativefrequencyofmostcommonlyusedphrasesandpunctions.Thedataofthesefeaturesarerecorded1to57columnsofthespamdata.Theoutcomeisspamoremailwhichisdenotedas1or0,recordedinthe58thcolumnofthedata.FormatAdataframewith4601rowsand57variablesExamplesdata(spam)train=sample(1:4601)[1:1000]x.trainas.matrix(spam[train,1:57])y.trainas.matrix(spam[train,58])x.testas.matrix(spam[-train,1:57])y.testas.matrix(spam[-train,58])x.trainsqrt(x.train)x.testsqrt(x.test)IndexTopicdatasetsConcrete,3kc_house_data,4spam,11coef.mave,2,6,7Concrete,3kc_house_data,4mars,10mave,2,5,710mave.data,2,7mave.dim,2,57,8,10plot.mave,6,9predict.mave,6,10predict.mave.dim,8spam,1112