Including na.action=na.exclude within a Loop regression

146 views Asked by At

I have two sets of data frame A and B. Data frame A has 590 columns and B has 6 variables. Each column in data set A is the Dependent Variable. All the 6 variables in data set B are the independent variables. Both data sets A and B have NA included in the data. I want run each of the columns in A on the 6 variable in B. I will then put the fitted values in a matrix of 590 columns. I am running these codes;

set.seed(1)
n<-590
fitted2<-matrix(0, nrow = 678, ncol = 590)

fitttedqr2<-function(x)
  {fitted2[,x]<-fitted(rq(Retprice[,x]~ Vix + Eqreturn + Changetbill + 
    Liqsprd + Creditsprd + Bondslope, tau = 0.01 ))
    }

 fittedvalue2<-sapply(1:m, fitttedqr2)

Each column in data A is regressed on all variables in data B. B has the variables Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslop. Please how do I include either na.action=na.exclude or ....=na.omit in this function to take care of na(s) in any column of the data.

0

There are 0 answers