I've just run a linear regression on an entire data set, but now I need to run the regression with data just from females within the data.
Females are denoted under the female column of the data set by a 1. Males are denoted by a 0 under the same column. I don't know how to remove the male data so I can run the regression on female data only.
mydatais a data frame containingy,x1,x2andsex, then instead oflm(y~x1+x2,data=mydata)you replace thedata=argument with one that appropriately subsets the rows ofmydataby the relevant value ofsex. – Glen_b Mar 03 '14 at 00:55mydata[as.logical(mydata$female),]as your data set inlmis one of half a dozen obvious ways (mydata[mydata$female==1,]is another; as is usingsubset) – Glen_b Mar 03 '14 at 07:37