Displaying 2 results from an estimated 2 matches for "res2new".
2013 Sep 10
0
Looping an lapply linear regression function
...dx2[indx2[,1]!=indx2[,2],]
nrow(indx2New)
#[1] 756
res2<-sapply(seq_len(nrow(indx2New)),function(i) {x1<- indx2New[i,]; x2<-cbind(dat2[x1[,1]],dat2[x1[,2]]);summary(lm(x2[,1]~x2[,2]))$coef[,4][2]}) #changed here
dat3<- cbind(indx2New,value=res2)
dim(dat3)
#[1] 756?? 3
library(reshape2)
res2New<- dcast(dat3,Var1~Var2,value.var="value")
row.names(res2New)<- res2New[,1]
?res2New<- as.matrix(res2New[,-1])
?dim(res2New)
#[1] 28 28
A.K.
________________________________
From: Rhys Manners <rhys.manners at hotmail.co.uk>
To: "smartpink111 at yahoo.com" <sm...
2013 Sep 25
1
Best and worst values for each date
Hi,
May be you can try this:
obj_name<- load("arun.RData")
Pred1<- get(obj_name[1])
Actual1<- get(obj_name[2])
library(reshape2)
dat<-cbind(melt(Pred1,id.vars="S1"),value2=melt(Actual1,id.vars="S1")[,3])? # to reshape to long form
colnames(dat)[3:4]<- c("Predict","Actual")
dat$variable<- as.character(dat$variable) #not that