How to calculate Mean of median-centered z-score
0
0
Entering edit mode
3.9 years ago

Hi there,

How is it possible to calculate the Mean of the median-centered z-score? Taking the below script as an example of a data frame. I need to develop a score for each subject. (My dataset is different this is just an example)

Thank you!

Imran

student_id <- seq(1,10)

math <- c(502,600,412,358,495,512,410,625,573,522)

science <- c(95,99,80,82,75,85,80,95,89,86)

english <- c(25,22,18,15,20,28,15,30,27,18)

df_student <- data.frame(student_id,math,science,english)

View(df_student)

z <- scale(df_student[,2:4],center=TRUE,scale=TRUE)

View(z)
R • 1.1k views
ADD COMMENT
0
Entering edit mode

Please explain how this is related to bioinformatics.

ADD REPLY
0
Entering edit mode

I need to develop an immune score related to my research. Unfortunately, my statistic is not that good to solve the problem just applying scale().

ADD REPLY
0
Entering edit mode

You can use scale with median and apply to get to where you need. apply the median function to the scaled dataset along the dimension of interest.

ADD REPLY
0
Entering edit mode

one step more: apply(z,2,median)

ADD REPLY

Login before adding your answer.

Traffic: 1953 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6