/
2colldiagUsagecolldiag(mod,scale=TRUE,center=FALSE,add.intercept=TRUE) 2colldiagUsagecolldiag(mod,scale=TRUE,center=FALSE,add.intercept=TRUE)

2colldiagUsagecolldiag(mod,scale=TRUE,center=FALSE,add.intercept=TRUE) - PDF document

alida-meadow
alida-meadow . @alida-meadow
Follow
499 views
Uploaded On 2015-09-23

2colldiagUsagecolldiag(mod,scale=TRUE,center=FALSE,add.intercept=TRUE) - PPT Presentation

4consumptionlibrarycarvifm2libraryperturbcd2printcd2decplaces5SamedataSPSSexampleathttpwwwatsuclaedustatspsswebbooksregchapter2spssreg2htmcolldiagm2addinterceptTRUE ID: 137756

4consumptionlibrary(car)vif(m2)library(perturb)cd2()print(cd2 dec.places=5)#Samedata SPSSexampleat#http://www.ats.ucla.edu/stat/spss/webbooks/reg/chapter2/spssreg2.htmcolldiag(m2 add.intercept=TRUE)##

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "2colldiagUsagecolldiag(mod,scale=TRUE,ce..." 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.


Presentation Transcript

Package`perturb'January16,2019TitleToolsforEvaluatingCollinearityVersion2.10AuthorJohnHendrickxDescriptionUsetheperturb()functiontoevaluatescollinearitybyaddingrandomnoisetoselectedvariables(Hendrickx&Pelzer2004).Thecolldiagfunction()calculatesconditionnumbersandvariancedecompositionproportionstotestforcollinearityanduncoveritssources(Belsley1980).MaintainerJohnHendrickx&#xJohn;&#x_Hen; ric;&#xkx@y; hoo;&#x.com;LicenseGPL&#xJohn;&#x_Hen; ric;&#xkx@y; hoo;&#x.com;(=2)ImportsgdataSuggestscar,rmsRepositoryCRANNeedsCompilationnoDate/Publication2019-01-1618:50:03UTCRtopicsdocumented:colldiag...........................................1consumption.........................................4perturb............................................5reclassify..........................................9Index14 colldiagConditionindexesandvariancedecompositionproportions DescriptionCalculatesconditionindexesandvariancedecompositionproportionsinordertotestforcollinearityamongtheindependentvariablesofaregressionmodelandidentiesthesourcesofcollinearityifpresent1 2colldiagUsagecolldiag(mod,scale=TRUE,center=FALSE,add.intercept=TRUE)##S3methodforclass'colldiag'print(x,dec.places=3,fuzz=NULL,fuzzchar=".",...)ArgumentsmodAmodelobjectordata-framescaleIfFALSE,thedataareleftunscaled.DefaultisTRUEcenterIfTRUE,dataarecentered.DefaultisFALSEadd.interceptifTRUE,aninterceptisadded.DefaultisTRUExAcolldiagobjectdec.placesnumberofdecimalplacestousewhenprintingfuzzvariancedecompositionproportionslessthanfuzzareprintedasfuzzcharfuzzcharcharacterforsmallvariancedecompositionproportionvalues...argumentstobepassedontoorfromothermethodsDetailsColldiagisanimplementationoftheregressioncollinearitydiagnosticproceduresfoundinBels-ley,Kuh,andWelsch(1980).Theseproceduresexaminethe“conditioning”ofthematrixofinde-pendentvariables.Colldiagcomputestheconditionindexesofthematrix.Ifthelargestconditionindex(theconditionnumber)islarge(Belsleyetalsuggest30orhigher),thentheremaybecollinearityproblems.Alllargeconditionindexesmaybeworthinvestigating.Colldiagalsoprovidesfurtherinformationthatmayhelptoidentifythesourceoftheseproblems,thevariancedecompositionproportionsassociatedwitheachconditionindex.Ifalargeconditionindexisassociatedtwoormorevariableswithlargevariancedecompositionproportions,thesevariablesmaybecausingcollinearityproblems.Belsleyetalsuggestthatalargeproportionis50percentormore.ValueAcolldiagobjectcondindxAvectorofconditionindexespiAmatrixofvariancedecompositionproportionsprint.colldiagprintstheconditionindexesastherstcolumnofatablewiththevariancede-compositionproportionsbesidethem.print.colldiaghasafuzzoptiontosuppressprintingofsmallnumbers.Iffuzzisused,smallvaluesarereplacesbyaperiod“.”.Fuzzcharcanbeusedtospecifyanalternativecharacter. colldiag3NoteColldiagisbasedontheStataprogramcoldiagbyJosephHarkness&#xjoe.;&#xhark;&#xness;&#x@jhu;&#x.edu;,JohnsHopkinsUniversity.Author(s)JohnHendrickx&#xJohn;&#x_Hen; ric;&#xkx@y; hoo;&#x.com;ReferencesD.Belsley,E.Kuh,andR.Welsch(1980).RegressionDiagnostics.Wiley.Belsley,D.A.(1991).Conditioningdiagnostics,collinearityandweakdatainregression.NewYork:JohnWiley&Sons.SeeAlsolm,scale,svd,[car]vif,[rms]vif,perturbExamples#Belsley(1991)."ConditioningDiagnostics"#TheConsumptionFunction(pp.149-154)data(consumption)ct1with(consumption,c(NA,cons[-length(cons)]))#compare(5.3)m1lm(cons~ct1+dpi+rate+d_dpi,data=consumption)anova(m1)summary(m1)#compareexhibit5.11with(consumption,cor(cbind(ct1,dpi,rate,d_dpi),use="complete.obs"))#compareexhibit5.12cd()cdprint(cd,fuzz=.3)##Notrun:#ExampleofreadingUCLAdatafilesfrom#https://stats.idre.ucla.edu/r/webbook/regression-with-rchapter-4-beyond-ols/library(foreign)elemapiread.dta("https://stats.idre.ucla.edu/stat/stata/webbooks/reg/elemapi.dta")attach(elemapi)#ExampleofSAScollinearitydiagnosticsfrom#https://stats.idre.ucla.edu/sas/webbooks/reg/#2.4TestsforCollinearitym2lm(api00~acs_k3+avg_ed+grad_sch+col_grad+some_col)summary(m2) 4consumptionlibrary(car)vif(m2)library(perturb)cd2()print(cd2,dec.places=5)##End(Notrun) consumptionTheConsumptionFunction DescriptionExamplefrompp149-154ofBelsley(1991),ConditioningDiagnosticsUsagedata(consumption)FormatAdataframewith28observationsonthefollowing5variables.year1947to1974constotalconsumption,1958dollarsratetheinterestrate(Moody'sAaa)dpidisposableincome,1958dollarsd_dpiannualchangeindisposableincomeSourcepp149-154ofBelsley(1991),ConditioningDiagnosticsReferencesBelsley,D.A.(1991).Conditioningdiagnostics,collinearityandweakdatainregression.NewYork:JohnWiley&Sons.Examplesdata(consumption) perturb5 perturbPerturbationanalysistoevaluatecollinearity DescriptionAddsrandomnoisetoselectedvariablestoevaluatecollinearity.AlsosuitableforothermodelsthanlinearregressionandforcategoricalindependentvariablesUsageperturb(mod,pvars=NULL,prange=NULL,ptrans=NULL,pfac=NULL,uniform=FALSE,niter=100)##S3methodforclass'perturb'summary(object,dec.places=3,full=FALSE,...)##S3methodforclass'perturb'print.summary(x,...)ArgumentsmodAmodelobject,notnecessarilytypelmpvarsContainsanarrayofvariablestobeperturbed.Randomvaluesareaddedtothevariable,afterwhichthemodelisre-estimated.prangeContainsanarrayofvaluesdeterminingthemagnitudeofperturbations.Thereshouldbeasmanyprangevaluesaspvarsvariables.ptransContainsanarrayoftransformationstobeapplied.EachelementshouldcontainvalidRsyntaxinquotesforderivingoneofthepvarsasafunctionofothervariables.pfacContainsalistofcategoricalvariablestobeperturbedandparameterscontrol-lingthereclassicationprocess.Therstcomponentmustbeafactorname.Thenamefortherstcomponentisignored.Otherlistcomponentsshouldcorre-spondwithoptionsforreclassify.Theusageoftheseparametersisdiscussedmorefullybelowundertheheading“Categoricalvariables”.uniformIfuniform=TRUE,randomvaluesfromauniformdistributionunif(�x=2;x=2)areaddedtotheperturbvariables,wherexistheprangevaluecorrespondingwitheachpvarsvariable.ThedefaultistoaddvaluesfromanormaldistributionN(0,x).niterIndicatesthenumberoftimestore-estimatethemodel.Defaultis100.objectaperturbobjecttobesummarizedxasummary.perturbobjecttobeprinteddec.placesnumberofdecimalplacestousewhenprintingfullifTRUE,someextrainformationisprinted...argumentstobepassedontoorfromothermethods.Printoptionsforclassmatrixmaybeused,e.g.print.gap 6perturbDetailsPerturbisatoolforassessingtheimpactofsmallrandomchanges(perturbations)tovariablesonparameterestimates.Itisanalternativeforcollinearitydiagnosticssuchasvifinthecarpackage,vifinthermspackageorcolldiaginthispackage.Perturbisparticularlyusefulforevaluatingcollinearityifinteractionsarepresentornonlineartransformationsofvariables,e.g.asquaredterm.Perturbcanshowhowtheperturbationsaffecttheestimatesofavariableandtermsderivedfromitwhereasothercollinearitydiagnosticssimplytreatinteractionsandtransformationsasregularindependentvariables.Perturbisnotlimitedtolinearregressionbutcanbeusedforallregression-likemodels.Perturbcanalsodealwithcategoricalvariablesbyrandomlymisclassifyingthemtoassesstheimpactonparameterestimates.Perturbworksbyaddingasmallrandom“perturbation”valuetoselectedindependentvariables,thenre-estimatingthemodel.Thisprocessisrepeatednitertimes,afterwhichasummaryofthemeans,standarddeviation,minimumandmaximumoftheparameterestimatesisdisplayed.Ifcollinearityisaseriousprobleminthedata,thentheestimateswillbeunstableandvarystrongly.Perturbcanbeusedwithcategoricalvariables.Categoricalvariablesarereclassiedaccordingtoatableofreclassicationprobabilities.Randomnumbersdeterminetowhichcategoryeachcaseisreclassiedateachiteration.Thereclassicationprobabilitiesarespeciedtomakereclassicationtothesamecategoryhighlylikely.Fororderedvariables,shortdistancereclassicationcanbemademorelikelythanlongdistance.Seethesectionon“Categoricalvariables”andreclassifyforfurtherdetails.ValueAnobjectofclass“perturb”.Themainresultiscontainedincoef.table,whichcontainstheparameterestimatesforeachiterationoftheperturbationanalysis.summaryprintsthemean,stan-darddeviation,minimumandmaximumofcoef.tableovertheiterations.Iftheoptionfullisspecied,reclassifyprintsadditionalinformationonhowthereclassicationprobabilitieswerederived.Summaryalsoprintsinformationonthetransformedmodelformula.coef.tableEstimatedcoefcientsforeachiterationoftheperturbationanalysisformulaThemodelformulausedpvarsThecontinuousvariablesperturbedintheanalysisprangeMagnitudeoftheperturbationsptrans2Thetransformationsusingthetemporaryvariablesoftheperturbationanalysisreclassify.tablesobjectsproducedbyreclassifyforeachfactorintheperturbationanalysisformula2Themodelformulausingtemporaryvariablesdistribution“normal”or“uniform”,thedistributionfromwhichtodrawrandomnumbersCategoricalvariablesInaperturbationanalysis,categoricalvariablesarereclassiedwithahighprobabilityofremaininginthesamecategory.Thiscouldbeaccomplishedinseveralways.reclassifyletsyouspecifythetargetpercentagereclassication,thenadjuststhereclassicationfrequenciessothattheexpectedfrequenciesofthereclassiedvariablearethesameasthoseoftheoriginal.Inaddition,reclassify perturb7imposesameaningfulpatternofassociationbetweentheoriginalandthereclassiedvariable.Seereclassifyfordetails.Categoricalvariablesarespeciedinperturbasalistinthepfacoption.Therst(unnamed)componentisthefactortobereclassied.Thenamesoffollowingcomponentsshouldbevalidreclassifyoptionsfollowsbyappropriatevalues.Forexample,toreclassifythefactor“type”witha95%probabilityofreclassifytothesamecategory,use:p2(()()pfac=list("type",pcnt=95))Thiscommandwilliterativelyre-estimatemodelm2100times(default).Randomvaluesfromanor-maldistributionwithastandarddeviationof1willbeaddedtothevariablesincomeandeducation.Reclassifycreatesatableofinitialreclassicationprobabilitiesfortypewitha95%probabilityofreclassicationtothesamecategory.Thisinitialtableisadjustedandthenalreclassicationprobabilitiesprintedintheoutputaresubsequentlyusedtoreclassifytypeateachiteration.Usealistofliststospecifyamodelwithmorethanonereclassicationfactor,forexample:pfac=list(list("fegp6",pcnt=95),list("eyrc",pcnt=m1),list("expc",pcnt=m2))q()NotePerturbcanbeusedwithestimationproceduresotherthanlm.Ontheotherhand,collinearityisaresultofextreme(multiple)correlationamongindependentvariables.Anotheroptionisvifinthermspackagevifinthecarpackage,orcolldiag,whichuseonlytheindependentvariablesofaregressionmodel.Thiswillusuallybeafastersolutionsincemaximumlikelihoodproceduresrequireiterativeestimationforeachiterationoftheperturbationanalysis.Itispossiblethoughthatcertainproceduresaremoresensitivetocollinearitythanlm,inwhichcaseperturbcouldbeabettersolution.Author(s)JohnHendrickx&#xJohn;&#x_Hen; ric;&#xkx@y; hoo;&#x.com;ReferencesD.Belsley,E.Kuh,andR.Welsch(1980).RegressionDiagnostics.Wiley.Belsley,D.A.(1991).Conditioningdiagnostics,collinearityandweakdatainregression.NewYork:JohnWiley&Sons.Hendrickx,John,BenPelzer.(2004).Collinearityinvolvingorderedandunorderedcategoricalvariables.PaperpresentedattheRC33conferenceinAmsterdam,August17-202004.Availableathttps://www.researchgate.net/publication/235994590_Collinearity_involving_ordered_and_unordered_categorical_variablesSeeAlsoreclassify,colldiag,[car]vif,[rms]vif 8perturbExampleslibrary(car)data(Duncan)attach(Duncan)m1()summary(m1)anova(m1)vif(m1)p1(()())summary(p1)m2()summary(m2)anova(m2)vif(m2)p2(()()())summary(p2)##Notrun:r1()summary(r1)q(()())summary(q)fegp6()#eyrandexpalsoasfactorseyrc((()()))table(eyrc)expc((()))table(expc)#roughinitialreclassificationprobabilities,#programwillensuretheysumto100row-wisem1(()())m1[row(m1)==col(m1)]m1[abs(row(m1)-col(m1))==1]m1[abs(row(m1)-col(m1))==2]m1m2(()())m2[row(m2)==col(m2)]m2[abs(row(m2)-col(m2))==1]m2[abs(row(m2)-col(m2))==2]m2r2()summary(r2)pfac=list(list("fegp6",pcnt=95),list("eyrc",pcnt=m1),list("expc",pcnt=m2))q2()summary(q2)##End(Notrun) reclassify9 reclassifyCalledbyperturbtocalculatereclassicationtables Descriptionreclassifyiscalledbyperturbtocalculatereclassicationprobabilitiesforcategoricalvariables.Useseparatelytoexperimentwithreclassicationprobabilities.Usagereclassify(varname,pcnt=NULL,adjust=TRUE,bestmod=TRUE,min.val=.1,diag=NULL,unif=NULL,dist=NULL,assoc=NULL)##S3methodforclass'reclassify'print(x,dec.places=3,full=FALSE,...)Argumentsvarnameafactortobereclassiedpcntinitialreclassicationpercentagesadjustmakestheexpectedfrequencydistributionofthereclassiedvariableequaltothatoftheoriginalbestmodimposesanappropriatepatternofassociationbetweentheoriginalandthere-classiedvariablemin.valvaluetoaddtoemptycellsoftheinitialexpectedtablewhenestimatingthebestmodeldiagTheoddsofsameversusdifferentcategoryreclassicationunifControlsshortdistanceversuslongdistancereclassicationfororderedvari-ablesdistalternativeparameterforshortversuslongdistancereclassicationassocamatrixdeningaloglinearpatternofassociationxareclassifyobjecttobeprinteddec.placesnumberofdecimalplacestousewhenprintingfullifTRUE,someextrainformationisprinted...argumentstobepassedontoorfromothermethods.Printoptionsforclassmatrixmaybeused,e.g.print.gapDetailsreclassifycreatesatableofreclassicationprobabilitiesforvarname.Bydefault,thereclassi-cationprobabilitiesaredenedsothattheexpectedfrequencydistributionofthereclassiedvari-ableisidenticaltothatoftheoriginal.Inaddition,ameaningfulpatternofassociationisimposed 10reclassifybetweentheoriginalandthereclassiedvariable.reclassifyiscalledbyperturbtocalculatere-classicationprobabilitiesforcategoricalvariables.reclassifycanbeusedseparatelytondasuitablereclassicationprobabilities.Reclassifyhasseveraloptionsbutthemostrelevantwillgenerallybethepcntoption.Theargu-mentforpcntcanbe•ascalar•avectoroflengthn•avectoroflengthn2,wherenisthenumberofcategoriesofthevariabletobereclassied.Iftheargumentforpcntisascalar,itsvalueistakentobethepercentageofcasestobereclassiedtothesamecategory,whichisthesameforallcategories.Atableofinitialreclassicationproba-bilitiesfortheoriginalbythereclassiedvariableiscreatedwiththisvaluedividedby100onthediagonalandequalvaluesonoff-diagonalcells.Iftheargumentforpcntisavectoroflengthn,itsvaluesindicatethepercentagetobereclassiedtothesamecategoryforeachcategoryseparately.Thesevaluesdividedby100formthediagonalofthetableofinitialreclassicationprobabilities.Off-diagonalcellshavethesamevaluesforrowssothattherowsumisequalto1.Iftheargumentforpcntisavectoroflengthn2,itsvaluesformthetableofinitialreclassicationprobabilities.prop.tableisusedtoensurethatthesevaluessumto1overthecolumns.Specifyingacompletetableofinitialreclassicationprobabilitieswillbeprimarilyusefulwhenanorderedvariableisbeingreclassied.Reclassifyprintsaninitialtableofreclassicationprobabilitiesbasedonthepcntoption.Thistableisnotuseddirectlythoughbutadjustedtomaketheexpectedfrequenciesofthereclassiedvariableidenticaltothoseoftheoriginal.Inaddition,ameaningfulpatternofassociationisimposedbetweentheoriginalandthereclassiedvariable.Detailsaregiveninthesection“Adjustingthereclassicationprobabilities”.Knowledgeableuserscanspecifyasuitablepatternofassociationdirectly,bypassingthepcntop-tion.Detailsaregiveninthesection“Specifyingapatternofassociationdirectly”.ValueAnobjectofclassreclassify.Bydefault,print.reclassifyprintsthevariablenameandthereclass.prob.Ifthefulloptionisusedwithprint.reclassify,additionalinformationsuchastheinitialreclassicationprobabilities,initialexpectedtable,bestmodel,areprintedaswell.variableThevariablespeciedreclass.probRow-wiseproportionsoffitted.tablecum.reclass.probCumulativerow-wiseproportionsexptab$init.pcntinitialreclassicationprobabilities(optionpcnt)exptab$init.tblinitialexpectedfrequencies(optionpcnt)bestmodThebestmodelfoundforthetableofinitialexpectedfrequencies(optionpcnt)assocThelogpatternofassociationspeciedusingpcntandbestmod=FALSE reclassify11coefThecoefcientsofattedloglinearmodelfitted.tableTheadjustedtableofexpectedfrequenciesAdjustingthereclassicationprobabilitiesAproblemwiththeinitialreclassicationprobabilitiescreatedusingpcntisthattheexpectedfre-quenciesofthereclassiedvariablewillnotbethesameasthoseoftheoriginal.Smallercategorieswillbecomelargerintheexpectedfrequencies,largercategorieswillbecomesmaller.Thiscanbeseeninthecolumnmarginaloftheinitialtableofexpectedfrequenciesinthereclassifyout-put.Thiscouldhaveastrongimpactonthestandarderrorsofreclassiedvariables,particularlyascategoriesdifferstronglyinsize.Toavoidthis,theinitialexpectedtableisadjustedsothatthecolumnmarginisthesameastherowmargin,i.e.theexpectedfrequenciesofthereclassiedvariablearethesameasthoseoftheoriginal.Useadjust=FALSEtoskipthisstep.Inthatcasetheinitialreclassicationprobabilitiesarealsothenalreclassicationprobabilities.Asecondobjectiontotheinitialreclassicationprobabilitiesisthatthepatternofassociationbe-tweentheoriginalandthereclassiedvariableisarbitrary.Theassociationbetweensomecombina-tionsofcategoriesishigherthanforothers.Reclassifythereforederivesanappropriatepatternofassociationfortheinitialexpectedtableoftheoriginalbyreclassiedvariable.Thispatternofasso-ciationisusedwhen“adjusting”themarginalstomakethefrequencydistributionofthereclassiedvariableidenticaltothatoftheoriginal.Usetheoptionbestmod=FALSEtoskipthisstep.Thepatternsofassociationusedbyreclassifyaredrawnfromloglinearmodelsforsquaretables,alsoknownas“mobilitymodels”(Goodman1984,Hout1983).Manytextsonloglinearmodellingcontainabriefdiscussionofsuchmodelsaswell.Forunorderedvariables,a“quasi-independent”patternofassociationwouldbeappropriate.Underquasi-independentassociation,therowvariableisindependentofthecolumnvariableifthediagonalcellsareignored.Iftheargumentforpcntwasascalar,reclassifytsa“quasi-independent(constrained)”model.Thismodelhasasingleparameterdiagwhichindicatesthelog-oddsofsameversusdifferentre-classication.Thislog-oddsisthesameforallcategories.Iftheargumentwasofvectoroflengthn,thenaregularquasi-independencemodelisttedwithparametersdiag1todiagn.Thesepa-rametersindicatethelog-oddsofsameversusdifferentcategoryreclassication,whichisdifferentforeachcategory.Forbothmodels,thereclassiedcategoryisindependentoftheoriginalcategoryifthediagonalcellsareignored.Iftheargumentforpcntwasavectoroflengthn2,reclassifytstwomodels,a“quasi-distancemodel”anda“quasi-uniformassociation”model,andselectstheonewiththebestttotheinitialexpectedtable.Bothhavethediagparameterofthe“quasi-independence(constrained)”model.Anadditionalparameterisaddedtomakeshortdistancereclassicationmorelikelythanlongdis-tancereclassication.Thequasi-uniformmodelisstricter:itmakesreclassicationlesslikelyproportionatelytothesquareddifferencebetweenthetwocategories.Thedistancemodelmakesreclassicationlesslikelyproportionatelytotheabsolutedifferencebetweenthetwocategories.Insomecases,theinitialexpectedtablebasedonthepcntoptioncontainsemptycells.Toavoidproblemswhenestimatingthebestmodelforthistable,avalueof.1isaddedtothesecells.Usethemin.valoptiontospecifyadifferentvalue. 12reclassifySpecifyingapatternofassociationdirectlyIfthepcntoptionisused,reclassifyautomaticallydeterminesasuitablepatternofassociationbetweentheoriginalandthereclassiedvariable.Knowledgeableuserscanalsospecifyapatternofassociationdirectly.Thenalreclassicationprobabilitieswillthenbebasedonthesevalues.Built-inoptionsforspecifyingtheloglinearparametersofselectedmobilitymodelsare:diagquasi-independenceconstrained(sameversusdifferentcategoryreclassication)unifuniformassociation(longversusshortdistancereclassicationfororderedcategories)distlineardistancemodel(allowsmorelongdistancereclassicationthanuniformassociation)Theassocoptioncanbeusedtospecifyanassociationpatternofone'sownchoice.Theelementsofassocshouldrefertomatriceswithanappropriateloglinearpatternofassociation.Suchmatricescanbecreatedinmanyways.Anefcientmethodis:wrk((factor))myassoc(()())()Thiscreatesasquarediagonalmatrixcalledwrkwiththesamenumberofrowsandcolumnsasthelevelsoffactor.row(wrk)andcol(wrk)cannowbeusedtodenealoglinearpatternofassociation,inthiscaseadistancemodelwithparameter5.reclassifychecksthelengthofthematrixequalsn2,wherenisthenumberofcategoriesofvarnameandensuresthatthepatternofassociationissymmetric.ImposingapatternofassociationAtablewithgivenmarginsandagivenpatternofassociationcanbecreatedby•estimatingaloglinearmodelofindependenceforatablewiththedesiredmargins•whilespecifyingthelogpatternofassociationasanoffsetvariable(cf.Kaufman&Schervish(1986),Hendrickx(2004).Thebodyofthetableisunimportantaslongasithastheappropriatemargins.Thepredictedvaluesofthemodelformatablewiththedesiredproperties.Theexpectedtableoftheoriginalbythereclassiedvariableisadjustedbycreatingatablewiththefrequencydistributionoftheoriginalvariableonthediagonalcells.Thistablethenhasthesamemarginalsfortherowandcolumnvariables.Thepatternofassociationisdeterminedbythereclassifyoptions.Ifpcntisusedandbestmod=TRUEthenthepredictedvaluesofthebestmodelareusedastheoffsetvariable.Ifbestmod=FALSE,thelogvaluesoftheinitialexpectedtablearemadesymmetricandusedastheoffsetvariable.Ifaloglinearmodelwasspecieddirectly,avariableiscreatedinthemanneroftheassocexample.Asmallmodicationinprocedureisthatreclassifyusesamodelofequalmaineffectsratherthanindependence.Sincethepatternofassociationisalwayssymmetric,thecreatedtablewillthenalsobeexactlysymmetricwiththefrequencydistributionoftheoriginalvariableasrowandcolumnmarginal.Author(s)JohnHendrickx&#xJohn;&#x_Hen; ric;&#xkx@y; hoo;&#x.com; reclassify13ReferencesGoodman,LeoA.(1984).Theanalysisofcross-classieddatahavingorderedcategories.Cam-bridge,Mass.:HarvardUniversityPress.Hendrickx,J.(2004).Usingstandardisedtablesforinterpretingloglinearmodels.Quality&Quan-tity38:603-620.Hendrickx,John,BenPelzer.(2004).Collinearityinvolvingorderedandunorderedcategoricalvariables.PaperpresentedattheRC33conferenceinAmsterdam,August17-202004.Availableathttps://www.researchgate.net/publication/235994590_Collinearity_involving_ordered_and_unordered_categorical_variablesHout,M.(1983).Mobilitytables.BeverlyHills:SagePublications.Kaufman,R.L.,&Schervish,P.G.(1986).Usingadjustedcrosstabulationstointerpretlog-linearrelationships.AmericanSociologicalReview51:717-733SeeAlsoperturb,colldiag,[car]vif,[rms]vifExampleslibrary(car)data(Duncan)attach(Duncan)reclassify(type,pcnt=95) IndexTopicdatasetsconsumption,4Topicregressioncolldiag,1perturb,5reclassify,9colldiag,1,6,7,13consumption,4lm,3,7perturb,3,5,9,10,13print.colldiag(colldiag),1print.reclassify(reclassify),9print.summary.perturb(perturb),5prop.table,10reclassify,5–7,9scale,3summary.perturb(perturb),5svd,3vif,3,6,7,1314