Dear all,
I think I have a rather strange question, but I'd like to give it a try:
I want to perform a simulation numerous times, thats why I can't do it by
hand. I sample a small dataset from a very large one, and use backward
selection to select significant predictors for some arbitrary outcome
variable Y. These predictors are to be placed in a model, and regression
coefficients estimated in a new small dataset.
This is what I got:
#First I sample a small dataset from the large one, lrm is logistic
regression from the Design package (as is the command fastbw)
fsubset=lrm(Ysub~X1sub+X2sub+X3sub+X4sub, data=dsubset1)
variables[i]=as.vector(fastbw(fsubset, rule="p",
type="individual",
sls=0.5)[2])
variables=unlist(variables[i])
#So my "variables" are the significant ones.
#Below is the sampling of the testset, in which I want to estimate a model,
but the only predictors in the model should be the ones I found to be
significant.
dderiveset=sample(patnr, 50, replace=FALSE)
dderiveset=d[dderiveset,]
colnames(dderiveset)=c("pat", "X1d", "X2d",
"X3d", "X4d", "Yd")
attach(dderiveset)
#Now in this new set of data, I want to build a model, but only using the
coefficients that were significant #in the fsubset model, thus from
"variables" I've tried everything and anything, even building
logical
expression within the model, but this was not accepted.
Best regards,
Sander van Kuijk
[[alternative HTML version deleted]]