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












0














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.










share|improve this question
























  • What are the two data sets in this example? I can see one called Retprice, is this set A? What is set B?
    – Jonny Phelps
    Nov 22 at 14:38












  • Retprice is Data set A and x is any column in the data set A (Retprice). Data set B contains Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslope
    – Fiavi
    Nov 23 at 7:03












  • Where is data set B referenced in the code?
    – Jonny Phelps
    Nov 23 at 8:13










  • Data set B contains the independent variables: Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslope
    – Fiavi
    Nov 24 at 9:39
















0














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.










share|improve this question
























  • What are the two data sets in this example? I can see one called Retprice, is this set A? What is set B?
    – Jonny Phelps
    Nov 22 at 14:38












  • Retprice is Data set A and x is any column in the data set A (Retprice). Data set B contains Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslope
    – Fiavi
    Nov 23 at 7:03












  • Where is data set B referenced in the code?
    – Jonny Phelps
    Nov 23 at 8:13










  • Data set B contains the independent variables: Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslope
    – Fiavi
    Nov 24 at 9:39














0












0








0







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.










share|improve this question















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.







r loops na quantile-regression






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 at 9:37

























asked Nov 22 at 9:43









Fiavi

42




42












  • What are the two data sets in this example? I can see one called Retprice, is this set A? What is set B?
    – Jonny Phelps
    Nov 22 at 14:38












  • Retprice is Data set A and x is any column in the data set A (Retprice). Data set B contains Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslope
    – Fiavi
    Nov 23 at 7:03












  • Where is data set B referenced in the code?
    – Jonny Phelps
    Nov 23 at 8:13










  • Data set B contains the independent variables: Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslope
    – Fiavi
    Nov 24 at 9:39


















  • What are the two data sets in this example? I can see one called Retprice, is this set A? What is set B?
    – Jonny Phelps
    Nov 22 at 14:38












  • Retprice is Data set A and x is any column in the data set A (Retprice). Data set B contains Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslope
    – Fiavi
    Nov 23 at 7:03












  • Where is data set B referenced in the code?
    – Jonny Phelps
    Nov 23 at 8:13










  • Data set B contains the independent variables: Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslope
    – Fiavi
    Nov 24 at 9:39
















What are the two data sets in this example? I can see one called Retprice, is this set A? What is set B?
– Jonny Phelps
Nov 22 at 14:38






What are the two data sets in this example? I can see one called Retprice, is this set A? What is set B?
– Jonny Phelps
Nov 22 at 14:38














Retprice is Data set A and x is any column in the data set A (Retprice). Data set B contains Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslope
– Fiavi
Nov 23 at 7:03






Retprice is Data set A and x is any column in the data set A (Retprice). Data set B contains Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslope
– Fiavi
Nov 23 at 7:03














Where is data set B referenced in the code?
– Jonny Phelps
Nov 23 at 8:13




Where is data set B referenced in the code?
– Jonny Phelps
Nov 23 at 8:13












Data set B contains the independent variables: Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslope
– Fiavi
Nov 24 at 9:39




Data set B contains the independent variables: Vix + Eqreturn + Changetbill + Liqsprd + Creditsprd + Bondslope
– Fiavi
Nov 24 at 9:39

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427952%2fincluding-na-action-na-exclude-within-a-loop-regression%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427952%2fincluding-na-action-na-exclude-within-a-loop-regression%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Berounka

Sphinx de Gizeh

Different font size/position of beamer's navigation symbols template's content depending on regular/plain...