In data set, I want to change each element to p value

67 views Asked by At
 c<- c(1.88, 2.33, -2.4, -0.6)
 dim(c)<-c(2,2)

I have a data set, 9X12 matrix. The data set is standardized to be normal, so I can compare each element.

For better comparing, I want to change each value to p-value.

How can I make it? (Please use above matrix.)

Please let me know.

1

There are 1 answers

0
flodel On BEST ANSWER

Don't use c for a variable name (you know better):

A <- c(1.88, 2.33, -2.4, -0.6)
dim(A) <- c(2,2)

You are looking for pnorm:

pnorm(A)
#           [,1]        [,2]
# [1,] 0.9699460 0.008197536
# [2,] 0.9900969 0.274253118