Send output to:
Browser Blue - Charts White
Browser Black/White
CSV
Data X:
22 8 21 28 8 23 27 8 25 19 9 19 25 9 21 26 11 20 26 12 19 18 12 20 24 12 22 27 12 25 20 13 15 24 13 21 10 14 15 22 14 18 24 14 20 22 14 21 22 14 23 28 15 20 20 15 20 22 15 22 24 15 22 23 15 24 14 16 20 19 16 20 21 16 22 21 16 23 23 16 23 21 16 25 17 17 14 21 17 15 21 17 17 22 17 18 24 17 21 22 17 21 26 17 21 26 17 23 25 17 25 23 17 25 28 17 27 26 18 15 23 18 18 21 18 19 27 18 19 24 18 20 24 18 21 24 18 22 22 18 23 24 18 23 23 18 25 19 18 25 23 18 25 23 18 25 25 18 25 26 19 18 21 19 20 20 19 20 11 19 20 18 19 21 27 19 24 23 19 24 23 19 24 21 19 24 25 19 25 21 20 18 21 20 19 27 20 19 22 20 20 26 20 20 27 20 21 22 20 21 24 20 23 20 20 23 23 20 23 21 20 23 22 20 23 26 20 24 22 20 24 25 20 24 23 20 25 15 20 25 26 20 26 23 20 26 28 20 26 24 20 26 25 20 28 22 20 28 22 21 14 24 21 18 24 21 19 20 21 20 18 21 20 26 21 21 21 21 21 21 21 21 25 21 22 16 21 22 23 21 23 28 21 24 21 21 24 24 21 24 19 21 25 22 21 25 24 21 26 26 21 26 23 21 28 28 21 28 23 22 17 26 22 19 24 22 19 18 22 20 19 22 20 26 22 21 23 22 21 23 22 22 24 22 22 24 22 22 20 22 23 24 22 23 26 22 23 19 22 23 22 22 24 24 22 24 19 22 24 23 22 25 19 22 25 26 22 25 25 22 25 28 22 25 25 22 26 21 22 26 25 22 28 16 22 28 21 23 14 25 23 21 23 23 22 21 23 22 28 23 22 27 23 23 22 23 23 24 23 23 25 23 23 26 23 23 26 23 23 28 23 24 23 23 24 23 23 24 22 23 24 20 23 24 20 23 24 26 23 24 27 23 26 24 23 26 26 23 27 28 23 28 22 23 28 27 23 28 27 23 28 24 24 18 26 24 18 23 24 19 21 24 20 24 24 21 26 24 23 23 24 23 24 24 23 26 24 23 26 24 23 25 24 23 25 24 23 24 24 24 25 24 24 26 24 24 25 24 24 27 24 24 22 24 25 25 24 25 25 24 26 25 24 26 28 24 26 25 24 26 28 24 26 25 24 26 24 24 27 26 24 27 21 24 28 23 24 28 25 25 19 23 25 20 24 25 23 26 25 25 27 25 26 20 25 26 27 25 26 24 25 26 28 25 26 28 25 28 25 25 28 26 25 28 25 26 18 22 26 21 24 26 24 27 26 24 25 26 25 26 26 26 22 27 23 24 27 23 28 27 25 23 27 25 28 27 25 24 28 16 27 28 21 24 28 24 25 28 24 27 28 26 23 28 26 28 28 28 28 28 28
Names of X columns:
AMS.E1 AMS.E2 AMS.E3
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
1 seconds
R Server
Big Analytics Cloud Computing Center
Click here to blog (archive) this computation