הבנת סינטקס של פונקציה בR

17 views
Skip to first unread message

Amit Oc Amit Oc

unread,
May 15, 2013, 2:00:46 PM5/15/13
to israel-r-user-group
שלום,
יש פונקציה שאני לא כ"כ מבין עד הסוף את הסינטקס שלה. 
זה מסוג השאלות שניתן לשאול כאן?

תודה,
עמית אוסי

Tal Galili

unread,
May 15, 2013, 2:25:31 PM5/15/13
to israel-r-...@googlegroups.com
היי עמית,
כן, אתה מוזמן לנסות :)



----------------Contact Details:-------------------------------------------------------
Contact me: Tal.G...@gmail.com
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English)
----------------------------------------------------------------------------------------------



--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Amit Oc Amit Oc

unread,
May 15, 2013, 2:40:20 PM5/15/13
to israel-r-user-group
function (z, m, nullGroups = NA) 
{
    e = m
    if (any(is.na(nullGroups))) {
        nullGroups = rep(FALSE, length(e$mu))
        nullGroups[1] = TRUE
    }
    A = matrix(z, length(z), length(e$mu))
    ri = A - matrix(e$mu, length(z), length(e$mu), byrow = TRUE)
    ri = ri/matrix(e$sig, length(z), length(e$sig), byrow = TRUE)
    le = -A - matrix(e$mu, length(z), length(e$mu), byrow = TRUE)
    le = le/matrix(e$sig, length(z), length(e$sig), byrow = TRUE)
    pRi = 1 - pnorm(ri)
    pLe = pnorm(le)
    pMix2sd = (pRi + pLe) * matrix(e$pi, length(z), length(e$pi), 
        byrow = TRUE)
    nullProb = rowSums(matrix(pMix2sd[, nullGroups], ncol = sum(nullGroups)))
    overallProb = rowSums(pMix2sd)
    twoSided = ((nullProb/overallProb) * (z >= 0) + rep(sum(e$pi[nullGroups]), 
        length(z)) * (z < 0))
    ppRi = pRi * matrix(e$pi, length(z), length(e$pi), byrow = TRUE)
    right = rowSums(matrix(ppRi[, nullGroups], ncol = sum(nullGroups)))/rowSums(ppRi)
    ppRi = pnorm(ri) * matrix(e$pi, length(z), length(e$pi), 
        byrow = TRUE)
    left = rowSums(matrix(ppRi[, nullGroups], ncol = sum(nullGroups)))/rowSums(ppRi)
    return(list(FDRTwoSided = twoSided, FDRleft = left, FDRright = right))
}
<environment: namespace:mixfdr>

בערך מnullProb  לא הבנתי. 
תודה רבה :)


2013/5/15 Tal Galili <tal.g...@gmail.com>

Tal Galili

unread,
May 15, 2013, 4:34:18 PM5/15/13
to israel-r-...@googlegroups.com
היי עמית,
השאלה לא כל כך ברורה לי.
כמה שאלות מנחות:
מה שם הפונקציה? מאיזו חבילה היא?
האם אתה מבין מה הפונקציה אמורה לעשות?
איזה מהפרמטרים שלה אתה לא מבין?

תודה,
טל




On Wed, May 15, 2013 at 9:40 PM, Amit Oc Amit Oc <amito...@gmail.com> wrote:
מnullProb  

Amit Oc Amit Oc

unread,
May 15, 2013, 4:42:07 PM5/15/13
to israel-r-user-group

מה שם הפונקציה? 
מאיזו חבילה היא?
חבילה mixfdr שם הפונקציה tailFDRMixModel
האם אתה מבין מה הפונקציה אמורה לעשות?
כן, לאמוד את זנב הmixture FDR כפי שמוגדר במאמר מסוים (לא הFDR הרגיל)
איזה מהפרמטרים שלה אתה לא מבין?
אני לא מאוד מתמצא בR. 
אני צריך תרגום לכל שורה (מה היא עושה) 

שכחתי לציין שאובייקט e מכיל מיו, סיגמה, וpi.

אשמח לעזרה, גם אם חלקית,
עמית


2013/5/15 Tal Galili <tal.g...@gmail.com>
Reply all
Reply to author
Forward
0 new messages