On Fri, May 25, 2012 at 4:10 AM, lasciel <corte...@msu.edu> wrote: > > So, I could use ‘rbind’ to stack the two years of data together with their > appropriate weights into a single data frame. > svychisq(~MyVar+MyVar, BothYears, statistic=”Chisq”) > > But now I have a problem that the variable name is the same across years, so > how do I differentiate the different time periods in the syntax for the > formula? Do I need to also create two new variables per: > MyVar.1 [year = 1] <- MyVar > MyVar.2 [year = 2] <- MyVar > svychisq(~MyVar.1+MyVar.2, BothYears, statistic=”Chisq”, na.rm= TRUE) > > > (I feel like I may be overthinking this and the answer is much simpler) > >
You don't need to create two new variables; you just need a year variable svychisq(~MyVar+Year, BothYears, statistic=”Chisq”, na.rm= TRUE) tests whether MyVar is independent of Year. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.