Displaying 1 result from an estimated 1 matches for "exnew2".
Did you mean:
xnew2
2012 Mar 03
1
Problem running stepAIC within a function.
...<- rep(1/nrow(s1),nrow(s1))}
#do regression
if (opt==1){
fit <-
lm(stepAIC(lm(new~-1+SIC,s1,weights=w),scope=list(upper=~1+SIC+turn+exturn+new+exnew+hand+excise+merch+exmerch+tob+rub+water+turn1+exturn1+new1+exnew1+hand1+excise1+
merch1+exmerch1+tob1+rub1+water1+turn2+exturn2+new2+exnew2+hand2+excise2+merch2+exmerch2+tob2+rub2+water2,lower=~-1+SIC),
direction="both"))
sigdata <-
cbind(new=s1$new,SIC=s1$SIC,s1[,coeffs[which(summary(fit)$coeff[-c(1:128),4]
<= 0.05)]])
finalfit <- lm(new~.-1,data=sigdata,weights=w)
}
else {
fit <-
lm(stepAIC(lm(n...