/
PackagecontrastMarch192020TitleACollectionofContrastMethodsVersion022D PackagecontrastMarch192020TitleACollectionofContrastMethodsVersion022D

PackagecontrastMarch192020TitleACollectionofContrastMethodsVersion022D - PDF document

davis
davis . @davis
Follow
342 views
Uploaded On 2021-09-25

PackagecontrastMarch192020TitleACollectionofContrastMethodsVersion022D - PPT Presentation

2contrastlmcontrastlmGeneralContrastsofRegressionCoef2cientsDescriptionThisfunctioncomputesoneormorecontrastsoftheestimatedregressioncoef2cientsina2tfromoneofthefunctionsinDesignalongwithstandarderror ID: 885303

factor contrast crossed group contrast factor group crossed diet 2contrast aut s3methodforclass fit data sex newage anova calc print

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "PackagecontrastMarch192020TitleACollecti..." 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

1 Package`contrast'March19,2020TitleAColle
Package`contrast'March19,2020TitleACollectionofContrastMethodsVersion0.22DescriptionOnedegreeoffreedomcontrastsforlm,glm,gls,andgeeseobjects.LicenseGPL-2URLhttps://github.com/topepo/contrastEncodingUTF-8LazyDatatrueDependsR�(=2.10)Importsnlme,sandwich,rmsSuggestsknitr,kableExtra,dplyr,ggplot2,tidyr,rmarkdown,testthat,covr,geepackRoxygenNote7.0.2.9000VignetteBuilderknitrNeedsCompilationnoAuthorAlanOCallaghan[aut,cre],MaxKuhn[aut],SteveWeston[aut],JedWing[aut],JamesForester[aut],ThornThaler[aut]MaintainerAlanOCallaghan lan;&#x.oca;&#xllag;&#xhan@;&#xoutl;&#xook.; om0;RepositoryCRANDate/Publication2020-03-1914:10:02UTCRtopicsdocumented:contrast.lm.........................................2print.contrast........................................4two_factor_crossed.....................................5two_factor_incompl.....................................5Index71 2contrast.lm contrast.lmGeneralContrastsofRegressionCoefcients DescriptionThisfunctioncomputesoneo

2 rmorecontrastsoftheestimatedregressionco
rmorecontrastsoftheestimatedregressioncoefcientsinatfromoneofthefunctionsinDesign,alongwithstandarderrors,condencelimits,torZstatistics,P-values.Usage##S3methodforclass'lm'contrast(fit,...)##S3methodforclass'gls'contrast(fit,...)##S3methodforclass'lme'contrast(fit,...)##S3methodforclass'geese'contrast(fit,...)contrast_calc(fit,a,b,cnames=NULL,type=c("individual","average"),weights="equal",conf.int=0.95,fcType="simple",fcFunc=I,covType=NULL,...,env=parent.frame(2))ArgumentsfitAtofclasslm,glm,etc....Forcontrast(),thesepassargumentstocontrast_calc().Forcontrast_calc(),theyarenotused.a,bListscontainingconditionsforallpredictorsinthemodelthatwillbecontrastedtoformthehypothesisH0:a=b.Thegendatafunctionwillgeneratetheneces-sarycombinationsanddefaultvaluesforunspeciedpredictors.Seeexamplesbelow. contrast.lm3cnamesAvectorofcharacterstringsnamingthecontrastswhentype="individual".Usuallycnamesisnotnecessaryasthefunctiontriestonamethecontrastsbyexaminingwhichpredictorsarevaryingconsistentlyinthetwolists.cnamesw

3 illbeneededwhenyoucontrast"non-comparabl
illbeneededwhenyoucontrast"non-comparable"settings,e.g.,youcomparelist(treat="drug",age=c(20,30))withlist(treat="placebo",age=c(40,50).typeAcharacterstring.Settype="average"toaveragetheindividualcontrasts(e.g.,toobtaina"TypeII"or"TypeIII"contrast).weightsAnumericvector,usedwhentype="average",toobtainweightedcontrasts.conf.intThecondencelevelforcondenceintervalsforthecontrasts.fcTypeAcharacterstring:"simple","log"or"signed".fcFuncAfunctiontotransformthenumeratoranddenominatoroffoldchanges.covTypeAstringmatchingthemethodforestimatingthecovariancematrix.Thedefaultvalueproducesthetypicalestimate.Seesandwich::vcovHC()foroptions.envAnenvironmentinwhichevaluatet.DetailsThesefunctionsmirrorrms::contrast.rms()buthavefeweroptions.Therearesomebetween-packageinconsistenciesregardingdegreesoffreedominsomemodels.Seethepackagevignetteformoredetails.Foldchangesarecalculatedforeachhypothesis.WhenfcType="simple",theratiooftheagrouppredictionsoverthebgrouppredictionsareused.WhenfcType="signed",theratioisusedifitisgreaterthan1

4 ;otherwisethenegativeinverse(e.g.,-1/rat
;otherwisethenegativeinverse(e.g.,-1/ratio)isreturned.Valuealistofclasscontrast.DesigncontainingtheelementsContrast,SE,Z,var,df.residualLower,Upper,Pvalue,X,cnames,andfoldChange,whichdenotethecontrastestimates,stan-darderrors,Zort-statistics,variancematrix,residualdegreesoffreedom(thisisNULLifthemodelwasnotols),loweranduppercondencelimits,2-sidedP-value,designmatrix,andcontrastnames(orNULL).SeeAlsorms::contrast.rms(),sandwich::vcovHC()Exampleslibrary(nlme)Orthodont2OrthodontOrthodont2$newAgeOrthodont$age-11fm1Orth.lme2lme(distance~Sex*newAge,data=Orthodont2,random=~newAge|Subject)summary(fm1Orth.lme2) 4print.contrastcontrast(fm1Orth.lme2,a=list(Sex=levels(Orthodont2$Sex),newAge=8-11),b=list(Sex=levels(Orthodont2$Sex),newAge=10-11))#------------------------------------------------------------------------------anova_modellm(expression~diet*group,data=two_factor_crossed)anova(anova_model)library(ggplot2)theme_set(theme_bw()+theme(legend.position="top"))ggplot(two_factor_crossed)+aes(x=diet,y=expression,col=group,shape

5 =group)+geom_point()+geom_smooth(aes(gro
=group)+geom_point()+geom_smooth(aes(group=group),method=lm,se=FALSE)int_modellm(expression~diet*group,data=two_factor_crossed)main_effectslm(expression~diet+group,data=two_factor_crossed)#Interactioneffectisprobablyreal:anova(main_effects,int_model)#Testtreatmentinlowfatdiet:veh_grouplist(diet="lowfat",group="vehicle")trt_grouplist(diet="lowfat",group="treatment")contrast(int_model,veh_group,trt_group)#------------------------------------------------------------------------------car_modlm(mpg~am+wt,data=mtcars)print(summary(car_mod),digits=5)mean_wtmean(mtcars$wt)manual_translist(am=0,wt=mean_wt)auto_translist(am=1,wt=mean_wt)print(contrast(car_mod,manual_trans,auto_trans),digits=5) print.contrastPrintaContrastObject DescriptionPrintaContrastObjectUsage##S3methodforclass'contrast'print(x,X=FALSE,fun=function(u)u,...) two_factor_crossed5ArgumentsxResultofcontrast().XAlogical:setTRUEtoprintdesignmatrixusedincomputingthecontrasts(ortheaveragecontrast).funAfunctiontotransformthecontrast,SE,andloweranduppercondencelimi

6 tsbeforeprinting.Forexample,specifyfun=e
tsbeforeprinting.Forexample,specifyfun=exptoanti-logthemforlogisticmodels....Notused. two_factor_crossedCompleteTwo-FactorExperiment DescriptionCompleteTwo-FactorExperimentDetailsAgeneexpressionexperimentwasruntoassesstheeffectofacompoundundertwodifferentdiets:highfatandlowfat.Themaincomparisonsofinterestarethedifferencebetweenthetreatedanduntreatedgroupswithinadiet.Theinteractioneffectwasasecondaryhypothesis.Forillustration,weonlyincludetheexpressionvalueofoneofthegenes.Thestudydesignwasafulltwo-wayfactorialwithn=24samples.Valuetwo_factor_crossedAdataframeExamplestwo_factor_crossed two_factor_incomplIncompleteTwo-FactorExperimentwithRepeatedMeasurments DescriptionIncompleteTwo-FactorExperimentwithRepeatedMeasurments 6two_factor_incomplDetailsInageneexpressionexperiment,stemcellsweredifferentiatedusingasetoffactors(suchasmediatypes,cellspreadsetc.).Thesefactorswerecollapsedintoasinglecellenvironmentcongurationsvariable.Thecelllineswereassaysoverthreedays.Twoofthecongurationswereonlyrunontherstdayandtheother

7 twowereassaysatbaseline.Togetthematerial
twowereassaysatbaseline.Togetthematerials,threedonorsprovidedmaterials.Thesedonorsprovided(almost)equalrepli-cationacrossthetwoexperimentalfactors(dayandconguration).Oneofthegoalsofthisexperimentwastoassesspre-specieddifferencesinthecongurationateachtimepoint.Forexample,thedifferencesbetweencongurationsAandBatdayoneisofinterest.Also,thedifferencesbetweencongurationsCandDateachtimepointswereimportant.Sincetherearemissingcellsinthedesign,itisnotacompletetwo-wayfactorial.Onewaytoanalyzethisexperimentistofurthercollapsethetimeandcongurationdataintoasinglevariableandthenspecifyeachcomparisonusingthisfactor.Valuetwo_factor_incomplAdataframeExamplestwo_factor_incompl IndexTopicdatasetstwo_factor_crossed,5two_factor_incompl,5Topicmodelscontrast.lm,2Topicregressioncontrast.lm,2contrast.geese(contrast.lm),2contrast.gls(contrast.lm),2contrast.lm,2contrast.lme(contrast.lm),2contrast_calc(contrast.lm),2print.contrast,4rms::contrast.rms(),3sandwich::vcovHC(),3two_factor_crossed,5two_factor_incompl

Related Contents


Next Show more