This discussion is archived
6 Replies Latest reply: Jul 23, 2012 9:01 AM by 950757 RSS

Regression problems

950757 Newbie
Currently Being Moderated
Hi,

i have a problem predicting data in Oracle R Enterprise. I build a model on a part of the dataset and build a prediction on a whole dataset. Something goes wrong - the prediction becomes inadequate. When i build a model on a whole data set everything is fine. I was trying to post the datasets, but they just messed.
Can anybody help me, please?

This is the code:

begin
sys.rqScriptCreate('electro2',
'function(dat) {
mod <- lm(ZHD ~ EL, dat)
mod}');
end;
/
drop table electro_model;
create table electro_model as
select *
from table(rqTableEval(
cursor(select ZHD,EL
from ELECTRISITY where DAT>'01.04.2012' and
DAT< '01.06.2012'
),
NULL,
NULL,
'electro2'));

-- score data
begin
sys.rqScriptCreate('electropred2',
'function(dat, mod) {
prd <- predict(mod, newdata=dat)
prd[as.integer(rownames(prd))] <- prd
res <- cbind(dat, PRED = prd)
res}');
end;
/
drop table electro_res
create table electro_res as
select *
from table(rqTableEval(
cursor(select ZHD,EL from ELECTRISITY),
cursor(select 1 max1, 1 pos1, 'mod' name1,
to_number(null) max2, to_number(null) pos2,
to_char(null) name2, total, chunk, value
from ELECTRO_MODEL),
'select ZHD, EL, 1 PRED from ELECTRISITY',
'electropred2'))
order by 1, 2, 3;



Regina Lazareva

Edited by: 947754 on 20.07.2012 5:47

Edited by: 947754 on 20.07.2012 5:47

Edited by: 947754 on 20.07.2012 5:48

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points