Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
23 17 23 4 24 17 20 4 22 18 20 6 20 21 21 8 24 20 24 8 27 28 22 4 28 19 23 4 27 22 20 8 24 16 25 5 23 18 23 4 24 25 27 4 27 17 27 4 27 14 22 4 28 11 24 4 27 27 25 4 23 20 22 8 24 22 28 4 28 22 28 4 27 21 27 4 25 23 25 8 19 17 16 4 24 24 28 7 20 14 21 4 28 17 24 4 26 23 27 5 23 24 14 4 23 24 14 4 20 8 27 4 11 22 20 4 24 23 21 4 25 25 22 4 23 21 21 4 18 24 12 15 20 15 20 10 20 22 24 4 24 21 19 8 23 25 28 4 25 16 23 4 28 28 27 4 26 23 22 4 26 21 27 7 23 21 26 4 22 26 22 6 24 22 21 5 21 21 19 4 20 18 24 16 22 12 19 5 20 25 26 12 25 17 22 6 20 24 28 9 22 15 21 9 23 13 23 4 25 26 28 5 23 16 10 4 23 24 24 4 22 21 21 5 24 20 21 4 25 14 24 4 21 25 24 4 12 25 25 5 17 20 25 4 20 22 23 6 23 20 21 4 23 26 16 4 20 18 17 18 28 22 25 4 24 24 24 6 24 17 23 4 24 24 25 4 24 20 23 5 28 19 28 4 25 20 26 4 21 15 22 5 25 23 19 10 25 26 26 5 18 22 18 8 17 20 18 8 26 24 25 5 28 26 27 4 21 21 12 4 27 25 15 4 22 13 21 5 21 20 23 4 25 22 22 4 22 23 21 8 23 28 24 4 26 22 27 5 19 20 22 14 25 6 28 8 21 21 26 8 13 20 10 4 24 18 19 4 25 23 22 6 26 20 21 4 25 24 24 7 25 22 25 7 22 21 21 4 21 18 20 6 23 21 21 4 25 23 24 7 24 23 23 4 21 15 18 4 21 21 24 8 25 24 24 4 22 23 19 4 20 21 20 10 20 21 18 8 23 20 20 6 28 11 27 4 23 22 23 4 28 27 26 4 24 25 23 5 18 18 17 4 20 20 21 6 28 24 25 4 21 10 23 5 21 27 27 7 25 21 24 8 19 21 20 5 18 18 27 8 21 15 21 10 22 24 24 8 24 22 21 5 15 14 15 12 28 28 25 4 26 18 25 5 23 26 22 4 26 17 24 6 20 19 21 4 22 22 22 4 20 18 23 7 23 24 22 7 22 15 20 10 24 18 23 4 23 26 25 5 22 11 23 8 26 26 22 11 23 21 25 7 27 23 26 4 23 23 22 8 21 15 24 6 26 22 24 7 23 26 25 5 21 16 20 4 27 20 26 8 19 18 21 4 23 22 26 8 25 16 21 6 23 19 22 4 22 20 16 9 22 19 26 5 25 23 28 6 25 24 18 4 28 25 25 4 28 21 23 4 20 21 21 5 25 23 20 6 19 27 25 16 25 23 22 6 22 18 21 6 18 16 16 4
Names of X columns:
Q2 Q9 Q16 Q23
Scale (list separated by spaces)
R Code
docor <- function(x,y,method) { r <- cor.test(x,y,method=method) paste(round(r$estimate,3),' (',round(r$p.value,3),')',sep='') } x <- t(x) nx <- length(x[,1]) cx <- length(x[1,]) mymedian <- median(as.numeric(strsplit(par1,' ')[[1]])) myresult <- array(NA, dim = c(cx,7)) rownames(myresult) <- paste('Q',1:cx,sep='') colnames(myresult) <- c('mean','Sum of<br />positives (Ps)','Sum of<br />negatives (Ns)', '(Ps-Ns)/(Ps+Ns)', 'Count of<br />positives (Pc)', 'Count of<br />negatives (Nc)', '(Pc-Nc)/(Pc+Nc)') for (i in 1:cx) { spos <- 0 sneg <- 0 cpos <- 0 cneg <- 0 for (j in 1:nx) { if (!is.na(x[j,i])) { myx <- as.numeric(x[j,i]) - mymedian if (myx > 0) { spos = spos + myx cpos = cpos + 1 } if (myx < 0) { sneg = sneg + abs(myx) cneg = cneg + 1 } } } myresult[i,1] <- round(mean(as.numeric(x[,i]),na.rm=T)-mymedian,2) myresult[i,2] <- spos myresult[i,3] <- sneg myresult[i,4] <- round((spos - sneg) / (spos + sneg),2) myresult[i,5] <- cpos myresult[i,6] <- cneg myresult[i,7] <- round((cpos - cneg) / (cpos + cneg),2) } myresult load(file='createtable') a<-table.start() a<-table.row.start(a) a<-table.element(a,'Summary of survey scores (median of Likert score was subtracted)',8,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'Question',header=TRUE) for (i in 1:7) { a<-table.element(a,colnames(myresult)[i],header=TRUE) } a<-table.row.end(a) for (i in 1:cx) { a<-table.row.start(a) a<-table.element(a,i,header=TRUE) for (j in 1:7) { a<-table.element(a,myresult[i,j],align='right') } a<-table.row.end(a) } a<-table.end(a) table.save(a,file='mytable.tab') a<-table.start() a<-table.row.start(a) a<-table.element(a,'Pearson correlations of survey scores (and p-values)',4,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'',header=TRUE) a<-table.element(a,'mean',header=TRUE) a<-table.element(a,'(Ps-Ns)/(Ps+Ns)',header=TRUE) a<-table.element(a,'(Pc-Nc)/(Pc+Nc)',header=TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'mean',header=TRUE) a<-table.element(a,docor(myresult[,1],myresult[,1],method='pearson'),align='right') a<-table.element(a,docor(myresult[,1],myresult[,4],method='pearson'),align='right') a<-table.element(a,docor(myresult[,1],myresult[,7],method='pearson'),align='right') a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'(Ps-Ns)/(Ps+Ns)',header=TRUE) a<-table.element(a,docor(myresult[,4],myresult[,1],method='pearson'),align='right') a<-table.element(a,docor(myresult[,4],myresult[,4],method='pearson'),align='right') a<-table.element(a,docor(myresult[,4],myresult[,7],method='pearson'),align='right') a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'(Pc-Nc)/(Pc+Nc)',header=TRUE) a<-table.element(a,docor(myresult[,7],myresult[,1],method='pearson'),align='right') a<-table.element(a,docor(myresult[,7],myresult[,4],method='pearson'),align='right') a<-table.element(a,docor(myresult[,7],myresult[,7],method='pearson'),align='right') a<-table.row.end(a) a<-table.end(a) table.save(a,file='mytable1.tab') a<-table.start() a<-table.row.start(a) a<-table.element(a,'Kendall tau rank correlations of survey scores (and p-values)',4,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'',header=TRUE) a<-table.element(a,'mean',header=TRUE) a<-table.element(a,'(Ps-Ns)/(Ps+Ns)',header=TRUE) a<-table.element(a,'(Pc-Nc)/(Pc+Nc)',header=TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'mean',header=TRUE) a<-table.element(a,docor(myresult[,1],myresult[,1],method='kendall'),align='right') a<-table.element(a,docor(myresult[,1],myresult[,4],method='kendall'),align='right') a<-table.element(a,docor(myresult[,1],myresult[,7],method='kendall'),align='right') a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'(Ps-Ns)/(Ps+Ns)',header=TRUE) a<-table.element(a,docor(myresult[,4],myresult[,1],method='kendall'),align='right') a<-table.element(a,docor(myresult[,4],myresult[,4],method='kendall'),align='right') a<-table.element(a,docor(myresult[,4],myresult[,7],method='kendall'),align='right') a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,'(Pc-Nc)/(Pc+Nc)',header=TRUE) a<-table.element(a,docor(myresult[,7],myresult[,1],method='kendall'),align='right') a<-table.element(a,docor(myresult[,7],myresult[,4],method='kendall'),align='right') a<-table.element(a,docor(myresult[,7],myresult[,7],method='kendall'),align='right') a<-table.row.end(a) a<-table.end(a) table.save(a,file='mytable2.tab')
Compute
Summary of computational transaction
Raw Input
view raw input (R code)
Raw Output
view raw output of R engine
Computing time
0 seconds
R Server
Big Analytics Cloud Computing Center
Click here to blog (archive) this computation