Hi, I am analyzing 24 samples that measure group (IN, IP) by time (naive, 2DPI, 10DPI, 42DPI). My design, sample table, and commands for extracting results are given below.
There are 12 animals, and each animal is measured at both levels of group. Three different animals are measured within each time period. After reading vignettes and posts on designs with paired and nested data, I created a new variable to reflect the nesting called animalID.nested and added it to the design below to explore main effects and interactions in the data.
This is the first time I have dealt with paired and nested data, and I wonder if I have dealt with it correctly. It seems correct given everything I have read, but I am concerned I may have missed something. I would appreciate any feedback.
DESIGN
~ group + dpi + dpi:animalId.nested + group:dpi
SAMPLE TABLE
animalID animalID.nested group dpi
1 1 IN naive
1 1 IP naive
2 2 IN naive
2 2 IP naive
3 3 IN naive
3 3 IP naive
4 1 IN 2DPI
4 1 IP 2DPI
5 2 IN 2DPI
5 2 IP 2DPI
6 3 IN 2DPI
6 3 IP 2DPI
7 1 IN 10DPI
7 1 IP 10DPI
8 2 IN 10DPI
8 2 IP 10DPI
9 3 IN 10DPI
9 3 IP 10DPI
10 1 IN 42DPI
10 1 IP 42DPI
11 2 IN 42DPI
11 2 IP 42DPI
12 3 IN 42DPI
12 3 IP 42DPI
EXTRACTING RESULTS FOR MAIN EFFECTS AND INTERACTION
IP VS IN AT EACH TIME POINT
results(dds, name="group_IP_vs_IN", test="Wald") #IP vs IN for dpi naive (the main effect)
results(dds, contrast=list(c("group_IP_vs_IN","groupIP.dpi2DPI")), test="Wald") #IP vs IN for dpi 2DPI
results(dds, contrast=list(c("group_IP_vs_IN","groupIP.dpi10DPI")), test="Wald") #IP vs IN for dpi 10DPI
results(dds, contrast=list(c("group_IP_vs_IN","groupIP.dpi42DPI")), test="Wald") #IP vs IN for dpi 42DPI
TEST BETWEEN TIME POINTS FOR EACH CONDITION.
results(dds, name="dpi_2DPI_vs_naive", test="Wald") #IN_2DPIvsNaive
results(dds, name="dpi_10DPI_vs_naive", test="Wald") #IN_10DPIvsNaive
results(dds, name="dpi_42DPI_vs_naive", test="Wald") #IN_42DPIvsNaive
results(dds, contrast=list(c("dpi_2DPI_vs_naive", "groupIP.dpi2DPI")), test="Wald") #IP_2DPIvsNaive
results(dds, contrast=list(c("dpi_10DPI_vs_naive", "groupIP.dpi10DPI")), test="Wald") #IP_10DPIvsNaive
results(dds, contrast=list(c("dpi_42DPI_vs_naive", "groupIP.dpi42DPI")), test="Wald") #IP_42DPIvsNaive
INTERACTIONS
interactionGroupEffectAcross2DPI<-results(dds, name="groupIP.dpi2DPI")
interactionGroupEffectAcross10DPI<-results(dds, name="groupIP.dpi10DPI")
interactionGroupEffectAcross42DPI<-results(dds, name="groupIP.dpi42DPI")
Hi Michael, My apologies. I would never expect you to do that, and perhaps I included way too much information in my question. I am mostly concerned that I handled the paired and nested data correctly. I have seen posts on dealing with paired data and posts on dealing with nested data, but I have both. I believe the following design handles both of those correctly given your previous answers and what I know about regression models. ...but I find that what you don't know can often get you into trouble! So I wanted to confirm that I had not missed anything in setting up this analysis. I do appreciate your time. Generally, most of us have more than we can handle in the time allotted. Julia