Sorry, this does not work.
Dear All,
I am having trouble with P value conversion for my data. I tried following this post but could not understand how I can get the P value out of LogP value or -log10 (p-value). Please share your experience I can get P value out of the data in either R or excel.
rsid CHR LOGPVALUE
rs3243810 1 3.835343448
rs3287090 1 3.835343448
rs3283061 1 2.225202326
rs3393481 1 2.225202326
Regards
Devender
2 answers
Hi,
To obtain the p-value from the -log10(p-value) you can try (assuming that you are working from R, and the example data that you presented is called data):
data$pvalue <- 10**-(data$LOGPVALUE)
You can apply the formula on excel too: https://stackoverflow.com/questions/53913175/how-to-do-an-inverse-log-transformation-in-r
I hope this helps,
António
I'm assuming a few things here:
- Your data was in CSV format, which you read into a data.frame in R using something like
read.tableorread.csv - The "log" transform was base-2
- The data.frame column names are the same as you mention above
- Your data.frame is named
df
log_base <- 2 #Change this if your log is base-10 or is a natural log (base e)
df$PVALUE <- log_base ^ -df$LOGPVALUE
Dear Sir, I tried the above method but it leads to P-value greater than 1.
Your base is probably not 2 then. The ** and ^ operators are equivalent - now that Antonio's solution works for you, use it and remember that there are two options to exponentiate in R.
> 2 ** 10
[1] 1024
> 2 ^ 10
[1] 1024
Log in to answer this question.
You need to know which base you're using for your log.