[R] Syntax roccomp-using R

Hamzah Hasyim h@mz@h@h@@yim @ending from gm@il@com
Sun Apr 8 22:39:23 CEST 2018


*Dear Bert, *

Thank you very much for your feedback and the useful link https://rseek.org/
and https://www.r-bloggers.com/calculating-auc-the-area-under-a-roc-curve/.
Actually, I want to know different performance between Stata and R, in
multilevel logistic regression. For this purposes, I replicate ".do" file
use Stata in
http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0153778. The
nice journal not only gives ".do" file but also ".dta" file for Stata
user. Fyi,
I succeed running my dataset accordingly approach that use in the nice
article.

In Model ii, by adding the random effects of the clusters (neighbourhoods)
only, I perform a multilevel logistic regression. Adding the neighbourhoods
a random effect considerably increase the DA of the model. If the AU-ROC
increases. This means the neighbourhoods have a relevant (observational)
General Contextual Effect on the individual outcome. That is, knowledge on
the clusters where the individuals reside is relevant for classifying
individuals. That is, for distinguishing those with from those without the
outcome. In Model iii, as expected, the AU-ROC remains similar to Model ii
after including a neighbourhoods level variable as a fixed effect. Model ii
represents the “ceiling” of the explanatory power of the clusters. However,
particularly both syntax in the steps below, the process taking time very
long, particularly for a data set with the 130,585 observation that I have.

I trust can be replicate the syntax Stata below into the script language of
R under your advice. I want to to know the performance of R to analyse in
the syntax " roccomp".  Unfortunately, the process still not finished in
this step yet at the moment.


. * FIGURE 1 - AU-ROC
.
********************************************************************************
.  roccomp Y  r1m1p r1m2p, graph summary

. * FIGURE 3 - AU-ROC
.
********************************************************************************
. roccomp Y  r2m1p r2m2p, graph summary


Abbreviations
Y      = The dependent (or responding) variable
AUC    = Area Under the Curve.
AUROC  = Area Under the Receiver Operating Characteristic curve.
ROC    = Receiver operating characteristic
r1m1p  =  Pr(malaria)
r1m2p  = Predicted mean
r1m3p  = Predicted mean


In addition, I saw in
https://cran.r-project.org/web/packages/auRoc/index.html, and in
https://www.rdocumentation.org/packages/limma/versions/3.28.14/topics/auROC
,  there is an issue regarding auROC.

Hopefully with install "CRAN - Package auRoc", I can be running the
"roccomp" used the plug-in. In addition, I can compute areas under ROC
curves using the R Commander. However, the R Commander doesn't include ROC
curves, but a Google search suggests that the RcmdrPlugin.EZR, a plug-in
package for the R Commander, includes ROC curves and may do what I want.
Isn't it?


Again thank you very much, I appreciate it.


Best wishes


Hamzah


On 8 April 2018 at 16:41, Bert Gunter <bgunter.4567 at gmail.com> wrote:

> 1. *If* this is homework, we do not do homework here.
>
> 2. Please read and follow the posting guide linked below to get a
> useful answer. In general, we expect posters to provide code showing
> their attempt to solve the problem, rather than expecting to be
> provided complete solutions. See also instructions for providing a
> small reproducible example.
>
> 3. Search! e.g. on the rseek.org site, inputting "AUC" gave this, among
> others:
> https://www.r-bloggers.com/calculating-auc-the-area-under-a-roc-curve/
>
> Cheers,
> Bert
>
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along
> and sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Sat, Apr 7, 2018 at 5:01 PM, Hamzah Hasyim <hamzah.hasyim at gmail.com>
> wrote:
> > Dear User R
> >
> >
> > It's been a pleasure talking with you. I am newcomer use R. Would you
> > please help me how to translate the script below to "R" script?
> >
> >
> > * Area under receiver operating characteristic (AU-ROC)
> > predict r1m1p, p
> > roctab malaria r1m1p, graph summary
> >
> >
> > * Area under receiver operating characteristic (AU-ROC) curve
> > predict r1m2p, mu
> > roctab malaria r1m2p, graph summary
> >
> > ************************************************************
> > ********************
> > * FIGURE 1 - AU-ROC
> > ************************************************************
> > ********************
> >
> > roccomp malaria r1m1p r1m2p, graph
> >
> >
> > * Area under receiver operating characteristic (AU-ROC)
> > predict r2m1p, p
> > roctab malaria r2m1p, graph summary
> >
> >
> > * Area under receiver operating characteristic (AU-ROC) curve
> > predict r1m2p, mu
> > roctab malaria r1m2p, graph summary
> >
> >
> > ************************************************************
> > ********************
> > * FIGURE 3 - AU-ROC
> > ************************************************************
> > ********************
> > roccomp malaria r2m1p r2m2p, graph
> >
> >
> >
> > Best regards,
> >
> >
> >
> > Hamzah
> >
> > Description of data-set
> >
> > ------------------------------------------------------------
> > ----------------------
> >               storage   display    value
> > variable name   type    format     label      variable label
> > ------------------------------------------------------------
> > ----------------------
> >
> > malaria         float   %48.0g     malaria    Participants who had
> diagnosed
> >                                                 malaria by health
> > professionals
> > _est_r1m1       byte    %8.0g                 esample() from estimates
> store
> > r1m1p           float   %9.0g                 Pr(malaria)
> > r1m2p           float   %9.0g                 Predicted mean
> > r1m3p           float   %9.0g                 Predicted mean
> > _est_r1m2       byte    %8.0g                 esample() from estimates
> store
> > r1m2use         float   %9.0g                 S.E. of empirical Bayes
> means
> > for
> >                                                 _cons[district]
> > r1m2u           float   %9.0g                 empirical Bayes means for
> >                                                 _cons[district]
> > pickone         byte    %8.0g                 tag(district)
> > r1m2urank       float   %9.0g                 rank of (r1m2u)
> > _est_r1m3       byte    %8.0g                 esample() from estimates
> store
> > r1m3use         float   %9.0g                 S.E. of empirical Bayes
> means
> > for
> >                                                 _cons[district]
> > r1m3u           float   %9.0g                 empirical Bayes means for
> >                                                 _cons[district]
> > r1m3urank       float   %9.0g                 rank of (r1m3u)
> > _est_r2m1       byte    %8.0g                 esample() from estimates
> store
> > r2m1p           float   %9.0g                 Pr(malaria)
> > r2m2p           float   %9.0g                 Predicted mean
> > r2m3p           float   %9.0g                 Predicted mean
> > _est_r2m2       byte    %8.0g                 esample() from estimates
> store
> > r2m2use         float   %9.0g                 S.E. of empirical Bayes
> means
> > for
> >                                                 _cons[district]
> > r2m2u           float   %9.0g                 empirical Bayes means for
> >                                                 _cons[district]
> > r2m2urank       float   %9.0g                 rank of (r2m2u)
> > _est_r2m3       byte    %8.0g                 esample() from estimates
> store
> > r2m3use         float   %9.0g                 S.E. of empirical Bayes
> means
> > for
> >                                                 _cons[district]
> > r2m3u           float   %9.0g                 empirical Bayes means for
> >                                                 _cons[district]
> > r2m3urank       float   %9.0g                 rank of (r2m3u)
> > ------------------------------------------------------------
> >
> >
> >
> >
> >
> > Respectfully,
> >
> >
> >
> > Hamzah
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>

	[[alternative HTML version deleted]]




More information about the R-help mailing list