Re: [R] package to fit mixtures of student-t distributions

2017-06-29 Thread Mark Leeds
Hi: The R package below may be of use to you.

https://journal.r-project.org/archive/2009-1/RJournal_2009-1_Ardia+et+al.pdf


On Thu, Jun 29, 2017 at 12:15 PM, Ranjan Maitra  wrote:

> Would package "teigen" help?
>
> Ranjan
>
> On Thu, 29 Jun 2017 14:41:34 +0200 vare vare via R-help <
> r-help@r-project.org> wrote:
>
> > Hello!
> >
> > I am new to R (before used python exclusively and would actually call
> the R solution for this issue inside a python notebook, hope that doesn’t
> disqualify me right of the batch).
> >
> > Right now I am  looking for a piece of software  to fit a 1D data sample
> to a mixture of t-distributions.
> >
> > I searched quite a while already and it seems to be that this is a
> somehwat obscure endeavor as most search results turn up for mixture of
> gaussians (what I am not interested here).
> >
> > The most promising candidates so far are the "AdMit" and "MitSEM" R
> packages. However I do not know R and find the description of these
> packages rather comlple and it seems their core objective is not the
> fitting of mixtures of t’s but instead use this as a step to accomplish
> something else.
> >
> > This is in a nutshell what I want the software to accomplish:
> >
> > Fitting a mixture of t-distributions to some data and estimate the
> "location" "scale" and "degrees of freedom" for each.
> >
> > I hope someone can point me to a simple package, I can’t believe that
> this is such an obscure use case.
> >
> > Thanks!
> >
> > __
> > R-help@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.
>
> --
> Important Notice: This mailbox is ignored: e-mails are set to be deleted
> on receipt. Please respond to the mailing list if appropriate. For those
> needing to send personal or professional e-mail, please use appropriate
> addresses.
>
> __
> R-help@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]]

__
R-help@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.

Re: [R] Different date formats in one column

2017-06-29 Thread Farnoosh Sheikhi via R-help
Thanks Jeff. This is a nice way of solving this problem. What about the cases 
with 0015-02-21?Many thanks. Best,Farnoosh

 

On Wednesday, June 28, 2017 10:49 PM, Jeff Newmiller 
 wrote:
 

 I doubt your actual file looks like the mess that made it to my email 
software (below) because you posted HTML-format email. Read the Posting 
Guide, and in particular figure out how to send plain text email.

You might try the "anytime" contributed package, though I suspect it too 
will choke on your mess. Otherwise, that will pretty much leave only a 
brute-force series of regular expression tests to recognize which date 
format patterns you have, and even that may not be able to get them all 
right unless you know something that limits the range of possible formats.

Below is an example of how this can be done. There are many tutorials on 
the internet that describe regular expressions... they are not unique to 
R.

#-
dta <- read.table( text=
"DtStr
020917
2/22/17
May-2-2015
May-12-15
", header=TRUE, as.is=TRUE )

dta$Dt <- as.Date( NA )

idx <- grepl( 
"^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-[0-9]+-[0-9]{4}$", 
dta$DtStr, perl=TRUE, ignore.case = TRUE )
dta$Dt[ idx ] <- as.Date( dta$DtStr[ idx ], format="%B-%d-%Y" )

idx <- grepl( 
"^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-[0-9]+-[0-9]{2}$", 
dta$DtStr, perl=TRUE, ignore.case = TRUE )
dta$Dt[ idx ] <- as.Date( dta$DtStr[ idx ], format="%B-%d-%y" )

idx <- grepl( "^(0[1-9]|1[0-2])[0-9]{2}[0-9]{2}$", dta$DtStr, perl=TRUE )
dta$Dt[ idx ] <- as.Date( dta$DtStr[ idx ], format="%m%d%y" )

idx <- grepl( "^([1-9]|1[0-2])/[0-9]{1,2}/[0-9]{2}$", dta$DtStr, perl=TRUE 
)
dta$Dt[ idx ] <- as.Date( dta$DtStr[ idx ], format="%m/%d/%y" )


On Wed, 28 Jun 2017, Farnoosh Sheikhi via R-help wrote:

> Hi, 
> I have a data set with various date formats in one column and not sure how to 
> unify it.Here is a few formats:
> 02091702/22/170221201703/17/160015-08-239/2/1500170806May-2-201522-March-2014
> I tried parse_date_time from lubridate library but it failed.Thanks so much. 
> Best,Farnoosh
>
>
>     [[alternative HTML version deleted]]
>
> __
> R-help@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.

---
Jeff Newmiller                        The    .      .  Go Live...
DCN:        Basics: ##.#.      ##.#.  Live Go...
                                      Live:  OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.      #.O#.  with
/Software/Embedded Controllers)              .OO#.      .OO#.  rocks...1k
---

   
[[alternative HTML version deleted]]

__
R-help@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.

Re: [R] Different date formats in one column

2017-06-29 Thread Farnoosh Sheikhi via R-help
Hi Christoph,
There is "," between dates.Many thanks. Best,Farnoosh

 

On Wednesday, June 28, 2017 9:05 PM, Christoph Puschmann 
 wrote:
 

 Hey,

Are all the dates connected? So no comma or space btw?

Regards,

Christoph

> On 29 Jun 2017, at 2:02 pm, Farnoosh Sheikhi via R-help 
>  wrote:
> 
> Hi, 
> I have a data set with various date formats in one column and not sure how to 
> unify it.Here is a few formats:
> 02091702/22/170221201703/17/160015-08-239/2/1500170806May-2-201522-March-2014
> I tried parse_date_time from lubridate library but it failed.Thanks so much. 
> Best,Farnoosh
> 
> 
>    [[alternative HTML version deleted]]
> 
> __
> R-help@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]]

__
R-help@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.

[R] Packages for Learning Algorithm Independent Branch and Bound for Feature Selection

2017-06-29 Thread Alex Byrley
I am looking for packages that can run a branch-and-bound algorithm to
maximize a distance measure (such as Bhattacharyya or Mahalanobis) on a set
of features.

I would like this to be learning algorithm independent, so that the method
just looks at the features, and selects the subset of a user-defined size
that maximizes a distance criteria such as those stated above.

Can anyone give some suggestions?

Alex Byrley
Graduate Student
Department of Electrical Engineering
235 Davis Hall
(716) 341-1802

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] package to fit mixtures of student-t distributions

2017-06-29 Thread vare vare via R-help
I don’t see how neither a) or b) applies to this question nor the technical 
merit of the remark about  mixture models.

Do you have a suggestion for a more appropriate forum for this issue/question? 
(stackoverflow basically sent me here).

Kind regards

> On 29. Jun 2017, at 16:58, Bert Gunter  wrote:
> 
> Offlist, because this is (a) an opinion and (b) about statistics and
> therefore offtopic.
> 
> I don't know whether any such package exists, but I would predict that
> this is likely to be overdetermined (too many parameters) and
> therefore unlikely to be a successful strategy. Fitting a mixture of
> Gaussians is already difficult enough.
> 
> Feel free to ignore, of course, and no need to reply.
> 
> 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 Thu, Jun 29, 2017 at 5:41 AM, vare vare via R-help
>  wrote:
>> Hello!
>> 
>> I am new to R (before used python exclusively and would actually call the R 
>> solution for this issue inside a python notebook, hope that doesn’t 
>> disqualify me right of the batch).
>> 
>> Right now I am  looking for a piece of software  to fit a 1D data sample to 
>> a mixture of t-distributions.
>> 
>> I searched quite a while already and it seems to be that this is a somehwat 
>> obscure endeavor as most search results turn up for mixture of gaussians 
>> (what I am not interested here).
>> 
>> The most promising candidates so far are the "AdMit" and "MitSEM" R 
>> packages. However I do not know R and find the description of these packages 
>> rather comlple and it seems their core objective is not the fitting of 
>> mixtures of t’s but instead use this as a step to accomplish something else.
>> 
>> This is in a nutshell what I want the software to accomplish:
>> 
>> Fitting a mixture of t-distributions to some data and estimate the 
>> "location" "scale" and "degrees of freedom" for each.
>> 
>> I hope someone can point me to a simple package, I can’t believe that this 
>> is such an obscure use case.
>> 
>> Thanks!
>> 
>> __
>> R-help@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.

__
R-help@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.

Re: [R] package to fit mixtures of student-t distributions

2017-06-29 Thread Ranjan Maitra
Would package "teigen" help?

Ranjan

On Thu, 29 Jun 2017 14:41:34 +0200 vare vare via R-help  
wrote:

> Hello!
> 
> I am new to R (before used python exclusively and would actually call the R 
> solution for this issue inside a python notebook, hope that doesn’t 
> disqualify me right of the batch).
> 
> Right now I am  looking for a piece of software  to fit a 1D data sample to a 
> mixture of t-distributions.
> 
> I searched quite a while already and it seems to be that this is a somehwat 
> obscure endeavor as most search results turn up for mixture of gaussians 
> (what I am not interested here).
> 
> The most promising candidates so far are the "AdMit" and "MitSEM" R packages. 
> However I do not know R and find the description of these packages rather 
> comlple and it seems their core objective is not the fitting of mixtures of 
> t’s but instead use this as a step to accomplish something else.
> 
> This is in a nutshell what I want the software to accomplish:
> 
> Fitting a mixture of t-distributions to some data and estimate the "location" 
> "scale" and "degrees of freedom" for each.
> 
> I hope someone can point me to a simple package, I can’t believe that this is 
> such an obscure use case.
> 
> Thanks!
> 
> __
> R-help@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.

-- 
Important Notice: This mailbox is ignored: e-mails are set to be deleted on 
receipt. Please respond to the mailing list if appropriate. For those needing 
to send personal or professional e-mail, please use appropriate addresses.

__
R-help@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.

Re: [R] Different date formats in one column

2017-06-29 Thread Jeff Newmiller
Left as an exercise for the student. 
-- 
Sent from my phone. Please excuse my brevity.

On June 29, 2017 7:25:36 PM EDT, Farnoosh Sheikhi  wrote:
>Thanks Jeff. This is a nice way of solving this problem. What about the
>cases with 0015-02-21?Many thanks. Best,Farnoosh
>
> 
>
>On Wednesday, June 28, 2017 10:49 PM, Jeff Newmiller
> wrote:
> 
>
> I doubt your actual file looks like the mess that made it to my email 
>software (below) because you posted HTML-format email. Read the Posting
>
>Guide, and in particular figure out how to send plain text email.
>
>You might try the "anytime" contributed package, though I suspect it
>too 
>will choke on your mess. Otherwise, that will pretty much leave only a 
>brute-force series of regular expression tests to recognize which date 
>format patterns you have, and even that may not be able to get them all
>
>right unless you know something that limits the range of possible
>formats.
>
>Below is an example of how this can be done. There are many tutorials
>on 
>the internet that describe regular expressions... they are not unique
>to 
>R.
>
>#-
>dta <- read.table( text=
>"DtStr
>020917
>2/22/17
>May-2-2015
>May-12-15
>", header=TRUE, as.is=TRUE )
>
>dta$Dt <- as.Date( NA )
>
>idx <- grepl( 
>"^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-[0-9]+-[0-9]{4}$", 
>dta$DtStr, perl=TRUE, ignore.case = TRUE )
>dta$Dt[ idx ] <- as.Date( dta$DtStr[ idx ], format="%B-%d-%Y" )
>
>idx <- grepl( 
>"^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-[0-9]+-[0-9]{2}$", 
>dta$DtStr, perl=TRUE, ignore.case = TRUE )
>dta$Dt[ idx ] <- as.Date( dta$DtStr[ idx ], format="%B-%d-%y" )
>
>idx <- grepl( "^(0[1-9]|1[0-2])[0-9]{2}[0-9]{2}$", dta$DtStr, perl=TRUE
>)
>dta$Dt[ idx ] <- as.Date( dta$DtStr[ idx ], format="%m%d%y" )
>
>idx <- grepl( "^([1-9]|1[0-2])/[0-9]{1,2}/[0-9]{2}$", dta$DtStr,
>perl=TRUE 
>)
>dta$Dt[ idx ] <- as.Date( dta$DtStr[ idx ], format="%m/%d/%y" )
>
>
>On Wed, 28 Jun 2017, Farnoosh Sheikhi via R-help wrote:
>
>> Hi, 
>> I have a data set with various date formats in one column and not
>sure how to unify it.Here is a few formats:
>>
>02091702/22/170221201703/17/160015-08-239/2/1500170806May-2-201522-March-2014
>> I tried parse_date_time from lubridate library but it failed.Thanks
>so much. Best,Farnoosh
>>
>>
>>     [[alternative HTML version deleted]]
>>
>> __
>> R-help@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.
>
>---
>Jeff Newmiller                        The    .      .  Go
>Live...
>DCN:        Basics: ##.#.      ##.#.  Live
>Go...
>                                      Live:  OO#.. Dead: OO#..  Playing
>Research Engineer (Solar/Batteries            O.O#.      #.O#.  with
>/Software/Embedded Controllers)              .OO#.      .OO#. 
>rocks...1k
>---
>
>   

__
R-help@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.

[R] plot3D color ramp not working as expected

2017-06-29 Thread Waichler, Scott R
Hi, I want to use a discrete color ramp with plot3D, and show NA values as 
white (default).  I get unexpected results per the following.

# as in help(slice3D) example:
par(mfrow = c(2,2))
x <- y <- z <- seq(-1, 1, by = 0.1)
grid <- mesh(x, y, z)
colvar <- with(grid, x*exp(-x^2 - y^2 - z^2))
slice3D (x, y, z, colvar = colvar, theta = 60)
#
# use three discrete classes and colors instead of a continuous ramp
slice3D(x, y, z, colvar = colvar, theta = 60,
col = c("blue", "green", "red"), breaks = c(-0.5, -0.1, 0.1, 0.5))
# now set a vertical slice of the cube to NA
colvar[10,,] <- NA
# displays as expected; default NAcol = "white"
slice3D (x, y, z, colvar = colvar, theta = 60) 
# does not display as expected--notice
# the colors shifted down in value, with NA and -0.5 to -0.1 now both white.
slice3D(x, y, z, colvar = colvar, theta = 60,
col = c("blue", "green", "red"),
breaks = c(-0.5, -0.1, 0.1, 0.5))

Please help.  Thanks,
Scott

Scott Waichler, PhD
Pacific Northwest National Laboratory
scott.waich...@pnnl.gov
Richland, Washington, USA

__
R-help@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.


Re: [R] about reading files in order

2017-06-29 Thread lily li
Thanks also.

On Thu, Jun 29, 2017 at 2:12 PM, Adams, Jean  wrote:

> Thanks for that answer.
> I was not aware of gtools::mixedsort
> 
> function.
>
> Jean
>
> On Thu, Jun 29, 2017 at 2:47 PM, Henrik Bengtsson <
> henrik.bengts...@gmail.com> wrote:
>
>> You can use:
>>
>> > files <- list.files(path = "folder01")
>> > files <- gtools::mixedsort(files)
>>
>> to order the files in a "human-friendly" order rather than
>> lexicographic order (which sort() provides).
>>
>> FYI 1; it's preferred to use file.path("folder01", list[i]) rather
>> than paste('folder01',lists[i],sep='/').
>>
>> FYI 2; if you use list.files(path = "folder01", full.names = TRUE),
>> you get the full paths rather name just the file names, i.e. you don't
>> have to use file.path().
>>
>> /Henrik
>>
>> On Thu, Jun 29, 2017 at 12:04 PM, lily li  wrote:
>> > Hi R users,
>> > I have a question about opening the txt files and putting them into a
>> > matrix. The txt files are in the folder01, while they have the name
>> > file.1.txt, file.2.txt, file.3.txt, etc. There are about 200 such text
>> > files. Each txt file contains one value inside. When I tried to use the
>> > code below, I found that the txt files are not in order, from 1, 2, 3,
>> to
>> > 200. Rather, they are in the order 1, 10, 100, 101, etc. How to change
>> it
>> > so that they are in order? Thanks for your help.
>> >
>> > temp <- list.files('folder01',pattern="*.txt"
>> > name.list <-lapply(paste('folder01',temp,sep='/'),read.table,head=F)
>> > library(data.table)
>> > files.matrix <-rbindlist(name.list)
>> >
>> > Also, when use the code below, how to complete it so that the values of
>> the
>> > files are stored in a matrix?
>> > lists = list.files('folder01')
>> > for (i in 1:length(lists)){
>> >   file <- read.table(paste('folder01',lists[i],sep='/'),head=F)
>> >   print(file)
>> > }
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > __
>> > R-help@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/posti
>> ng-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>>
>> __
>> R-help@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/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] about reading files in order

2017-06-29 Thread Adams, Jean
Thanks for that answer.
I was not aware of gtools::mixedsort

function.

Jean

On Thu, Jun 29, 2017 at 2:47 PM, Henrik Bengtsson <
henrik.bengts...@gmail.com> wrote:

> You can use:
>
> > files <- list.files(path = "folder01")
> > files <- gtools::mixedsort(files)
>
> to order the files in a "human-friendly" order rather than
> lexicographic order (which sort() provides).
>
> FYI 1; it's preferred to use file.path("folder01", list[i]) rather
> than paste('folder01',lists[i],sep='/').
>
> FYI 2; if you use list.files(path = "folder01", full.names = TRUE),
> you get the full paths rather name just the file names, i.e. you don't
> have to use file.path().
>
> /Henrik
>
> On Thu, Jun 29, 2017 at 12:04 PM, lily li  wrote:
> > Hi R users,
> > I have a question about opening the txt files and putting them into a
> > matrix. The txt files are in the folder01, while they have the name
> > file.1.txt, file.2.txt, file.3.txt, etc. There are about 200 such text
> > files. Each txt file contains one value inside. When I tried to use the
> > code below, I found that the txt files are not in order, from 1, 2, 3, to
> > 200. Rather, they are in the order 1, 10, 100, 101, etc. How to change it
> > so that they are in order? Thanks for your help.
> >
> > temp <- list.files('folder01',pattern="*.txt"
> > name.list <-lapply(paste('folder01',temp,sep='/'),read.table,head=F)
> > library(data.table)
> > files.matrix <-rbindlist(name.list)
> >
> > Also, when use the code below, how to complete it so that the values of
> the
> > files are stored in a matrix?
> > lists = list.files('folder01')
> > for (i in 1:length(lists)){
> >   file <- read.table(paste('folder01',lists[i],sep='/'),head=F)
> >   print(file)
> > }
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@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.
>
> __
> R-help@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]]

__
R-help@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.


Re: [R] about reading files in order

2017-06-29 Thread Henrik Bengtsson
You can use:

> files <- list.files(path = "folder01")
> files <- gtools::mixedsort(files)

to order the files in a "human-friendly" order rather than
lexicographic order (which sort() provides).

FYI 1; it's preferred to use file.path("folder01", list[i]) rather
than paste('folder01',lists[i],sep='/').

FYI 2; if you use list.files(path = "folder01", full.names = TRUE),
you get the full paths rather name just the file names, i.e. you don't
have to use file.path().

/Henrik

On Thu, Jun 29, 2017 at 12:04 PM, lily li  wrote:
> Hi R users,
> I have a question about opening the txt files and putting them into a
> matrix. The txt files are in the folder01, while they have the name
> file.1.txt, file.2.txt, file.3.txt, etc. There are about 200 such text
> files. Each txt file contains one value inside. When I tried to use the
> code below, I found that the txt files are not in order, from 1, 2, 3, to
> 200. Rather, they are in the order 1, 10, 100, 101, etc. How to change it
> so that they are in order? Thanks for your help.
>
> temp <- list.files('folder01',pattern="*.txt"
> name.list <-lapply(paste('folder01',temp,sep='/'),read.table,head=F)
> library(data.table)
> files.matrix <-rbindlist(name.list)
>
> Also, when use the code below, how to complete it so that the values of the
> files are stored in a matrix?
> lists = list.files('folder01')
> for (i in 1:length(lists)){
>   file <- read.table(paste('folder01',lists[i],sep='/'),head=F)
>   print(file)
> }
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.

__
R-help@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.


[R] about reading files in order

2017-06-29 Thread lily li
Hi R users,
I have a question about opening the txt files and putting them into a
matrix. The txt files are in the folder01, while they have the name
file.1.txt, file.2.txt, file.3.txt, etc. There are about 200 such text
files. Each txt file contains one value inside. When I tried to use the
code below, I found that the txt files are not in order, from 1, 2, 3, to
200. Rather, they are in the order 1, 10, 100, 101, etc. How to change it
so that they are in order? Thanks for your help.

temp <- list.files('folder01',pattern="*.txt"
name.list <-lapply(paste('folder01',temp,sep='/'),read.table,head=F)
library(data.table)
files.matrix <-rbindlist(name.list)

Also, when use the code below, how to complete it so that the values of the
files are stored in a matrix?
lists = list.files('folder01')
for (i in 1:length(lists)){
  file <- read.table(paste('folder01',lists[i],sep='/'),head=F)
  print(file)
}

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Change Rcode for a meta-analysis(netmeta) to use a random effects model instead of a mixed effects model

2017-06-29 Thread Jay Zola
Link Dropbox R code: 
https://www.dropbox.com/s/9u6e89t6dq39r53/Rcode%20metaregression.docx?dl=0

Rcode 
metaregression.docx
www.dropbox.com
Shared with Dropbox




Link Dropbox part of dataset: 
https://www.dropbox.com/s/j1urqzr99bt76ip/Basics%20excel%20file%20complication%20and%20reoperation%20rate.xlsx?dl=0




Van: Viechtbauer Wolfgang (SP) 
Verzonden: donderdag 29 juni 2017 19:47
Aan: Jay Zola; r-help@r-project.org
Onderwerp: RE: Change Rcode for a meta-analysis(netmeta) to use a random 
effects model instead of a mixed effects model

The code in your mail in a mangled mess, since you posted in HTML. Please 
configure your email client to send emails in plain text.

Could you explain what exactly you mean by "Currently it is using a mixed 
effects model. Is it possible to change the code so a random effects model is 
used?"

Best,
Wolfgang

>-Original Message-
>From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jay Zola
>Sent: Thursday, June 29, 2017 19:38
>To: r-help@r-project.org
>Subject: [R] Change Rcode for a meta-analysis(netmeta) to use a random
>effects model instead of a mixed effects model
>
>Hello,
>
>I am writing a meta-analysis on the complication and reoperation rates
>after 5 treatment modalities of a distal radius fracture. I have a code to
>compare the complication and reoperation rates. Currently it is using a
>mixed effects model. Is it possible to change the code so a random effects
>model is used?
>
>Thank you very much,
>
>Jay
>
>R code
>
>library(meta) library(readxl) All <- read_excel("Basics excel file
>complication and reoperation rate.xlsx", sheet=1) names(All) <-
>c("Study_ID","Event_Type","Treatment","Events_n","N","nN") All$Treatment
><- factor(All$Treatment, levels=c("PC","EF","IMN","KW","VPO")) # Outcomes
>Complications <- subset(All, Event_Type=="Complications") Reoperations <-
>subset(All, Event_Type=="Reoperations") # Comparison of treatment effects
>to gold standard in the Complications subset mtpr1 <- metaprop(Events_n,
>N, Study_ID, data = Complications) meta::metareg(mtpr1, ~Treatment) #
>Comparison of treatment effects to gold standard in the Reoperations
>subset mtpr2 <- metaprop(Events_n, N, Study_ID, data = Reoperations)
>meta::metareg(mtpr2, ~Treatment) # Comparison of treatment effects to gold
>standard in the All dataset # Interaction effects have been considered
>mtpr <- metaprop(Events_n, N, Study_ID, data = All) meta::metareg(mtpr,
>~Treatment*Event_Type)
>
>A part of the dataset:
>
>Study| Event Type| Treatment| Number of Events (n)| N| n/N|
>Kumaravel| Complications| EF| 3| 23| 0,1304348|
>Franck| Complications| EF| 2| 20| 0,1|
>Schonnemann| Complications| EF| 8| 30| 0,267|
>Aita| Complications| EF| 1| 16| 0,0625|
>Hove| Complications| EF| 31| 39| 0,7948718|
>Andersen| Complications| EF| 26| 75| 0,347|
>Krughaug| Complications| EF| 22| 75| 0,293|
>Moroni| Complications| EF| 0| 20| 0|
>Plate| Complications| IMN| 3| 30| 0,1|
>Chappuis| Complications| IMN| 4| 16| 0,25|
>Gradl| Complications| IMN| 12| 66| 0,1818182|
>Schonnemann| Complications| IMN| 6| 31| 0,1935484|
>Aita| Complications| IMN| 1| 16| 0,0625|
>Dremstrop| Complications| IMN| 17| 44| 0,3863636|
>Wong| Complications| PC| 1| 30| 0,033|
>Kumaravel| Complications| PC| 4| 25| 0,16|
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@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]]

__
R-help@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.


Re: [R] Change Rcode for a meta-analysis(netmeta) to use a random effects model instead of a mixed effects model

2017-06-29 Thread Viechtbauer Wolfgang (SP)
The code in your mail in a mangled mess, since you posted in HTML. Please 
configure your email client to send emails in plain text. 

Could you explain what exactly you mean by "Currently it is using a mixed 
effects model. Is it possible to change the code so a random effects model is 
used?"

Best,
Wolfgang

>-Original Message-
>From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jay Zola
>Sent: Thursday, June 29, 2017 19:38
>To: r-help@r-project.org
>Subject: [R] Change Rcode for a meta-analysis(netmeta) to use a random
>effects model instead of a mixed effects model
>
>Hello,
>
>I am writing a meta-analysis on the complication and reoperation rates
>after 5 treatment modalities of a distal radius fracture. I have a code to
>compare the complication and reoperation rates. Currently it is using a
>mixed effects model. Is it possible to change the code so a random effects
>model is used?
>
>Thank you very much,
>
>Jay
>
>R code
>
>library(meta) library(readxl) All <- read_excel("Basics excel file
>complication and reoperation rate.xlsx", sheet=1) names(All) <-
>c("Study_ID","Event_Type","Treatment","Events_n","N","nN") All$Treatment
><- factor(All$Treatment, levels=c("PC","EF","IMN","KW","VPO")) # Outcomes
>Complications <- subset(All, Event_Type=="Complications") Reoperations <-
>subset(All, Event_Type=="Reoperations") # Comparison of treatment effects
>to gold standard in the Complications subset mtpr1 <- metaprop(Events_n,
>N, Study_ID, data = Complications) meta::metareg(mtpr1, ~Treatment) #
>Comparison of treatment effects to gold standard in the Reoperations
>subset mtpr2 <- metaprop(Events_n, N, Study_ID, data = Reoperations)
>meta::metareg(mtpr2, ~Treatment) # Comparison of treatment effects to gold
>standard in the All dataset # Interaction effects have been considered
>mtpr <- metaprop(Events_n, N, Study_ID, data = All) meta::metareg(mtpr,
>~Treatment*Event_Type)
>
>A part of the dataset:
>
>Study| Event Type| Treatment| Number of Events (n)| N| n/N|
>Kumaravel| Complications| EF| 3| 23| 0,1304348|
>Franck| Complications| EF| 2| 20| 0,1|
>Schonnemann| Complications| EF| 8| 30| 0,267|
>Aita| Complications| EF| 1| 16| 0,0625|
>Hove| Complications| EF| 31| 39| 0,7948718|
>Andersen| Complications| EF| 26| 75| 0,347|
>Krughaug| Complications| EF| 22| 75| 0,293|
>Moroni| Complications| EF| 0| 20| 0|
>Plate| Complications| IMN| 3| 30| 0,1|
>Chappuis| Complications| IMN| 4| 16| 0,25|
>Gradl| Complications| IMN| 12| 66| 0,1818182|
>Schonnemann| Complications| IMN| 6| 31| 0,1935484|
>Aita| Complications| IMN| 1| 16| 0,0625|
>Dremstrop| Complications| IMN| 17| 44| 0,3863636|
>Wong| Complications| PC| 1| 30| 0,033|
>Kumaravel| Complications| PC| 4| 25| 0,16|
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@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.

__
R-help@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.


[R] Change Rcode for a meta-analysis(netmeta) to use a random effects model instead of a mixed effects model

2017-06-29 Thread Jay Zola
Hello,


I am writing a meta-analysis on the complication and reoperation rates after 5 
treatment modalities of a distal radius fracture. I have a code to compare the 
complication and reoperation rates. Currently it is using a mixed effects 
model. Is it possible to change the code so a random effects model is used?


Thank you very much,


Jay



R code


library(meta) library(readxl) All <- read_excel("Basics excel file complication 
and reoperation rate.xlsx", sheet=1) names(All) <- 
c("Study_ID","Event_Type","Treatment","Events_n","N","nN") All$Treatment <- 
factor(All$Treatment, levels=c("PC","EF","IMN","KW","VPO")) # Outcomes 
Complications <- subset(All, Event_Type=="Complications") Reoperations <- 
subset(All, Event_Type=="Reoperations") # Comparison of treatment effects to 
gold standard in the Complications subset mtpr1 <- metaprop(Events_n, N, 
Study_ID, data = Complications) meta::metareg(mtpr1, ~Treatment) # Comparison 
of treatment effects to gold standard in the Reoperations subset mtpr2 <- 
metaprop(Events_n, N, Study_ID, data = Reoperations) meta::metareg(mtpr2, 
~Treatment) # Comparison of treatment effects to gold standard in the All 
dataset # Interaction effects have been considered mtpr <- metaprop(Events_n, 
N, Study_ID, data = All) meta::metareg(mtpr, ~Treatment*Event_Type)


A part of the dataset:

Study| Event Type| Treatment| Number of Events (n)| N| n/N|
Kumaravel| Complications| EF| 3| 23| 0,1304348|
Franck| Complications| EF| 2| 20| 0,1|
Schonnemann| Complications| EF| 8| 30| 0,267|
Aita| Complications| EF| 1| 16| 0,0625|
Hove| Complications| EF| 31| 39| 0,7948718|
Andersen| Complications| EF| 26| 75| 0,347|
Krughaug| Complications| EF| 22| 75| 0,293|
Moroni| Complications| EF| 0| 20| 0|
Plate| Complications| IMN| 3| 30| 0,1|
Chappuis| Complications| IMN| 4| 16| 0,25|
Gradl| Complications| IMN| 12| 66| 0,1818182|
Schonnemann| Complications| IMN| 6| 31| 0,1935484|
Aita| Complications| IMN| 1| 16| 0,0625|
Dremstrop| Complications| IMN| 17| 44| 0,3863636|
Wong| Complications| PC| 1| 30| 0,033|
Kumaravel| Complications| PC| 4| 25| 0,16|


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Creating two groups of random numbers

2017-06-29 Thread Michael Dewey
Please do not cross post as people waste time replying on one forum not 
knowing you have already received excellent advice on another.


On 29/06/2017 14:44, Naike Wang wrote:

Hi all,
I want to create two groups of random numbers to calculate proportions. The
first group is to represent the number of cases in a study. The second
group is to represent the sample size of the study. Apparently, the sample
size is going to have to be bigger or equal to the number of cases, but the
sample size of a study is not necessarily greater than the number of cases
of another study. Here's an example:

study casestotal
117 28
248 70
387 92
415 17



Notice that the sample size of the first study is 28, which is bigger than
the number of cases of this study, but is smaller than the number of cases
of the second study.

How do I create a data set like this?

Best,
Naike

[[alternative HTML version deleted]]

__
R-help@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.

---
This email has been checked for viruses by AVG.
http://www.avg.com




--
Michael
http://www.dewey.myzen.co.uk/home.html

__
R-help@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.


Re: [R] Creating two groups of random numbers

2017-06-29 Thread Boris Steipe
I'd do it this way ... let me know if you need explanations.

minSize <- 15
maxSize <- 100
minSample <- 0.1
maxSample <- 0.8

# setup dataframe with totals, and cases as fractions
myStudies <- data.frame(study = 1:Nstudies,
cases = runif(Nstudies,
  min = minSample,
  max = maxSample),
total = sample(minSize:maxSize,
   Nstudies,
   replace = TRUE))

# convert case fractions of totals to integers
myStudies$cases <- round(myStudies$cases * myStudies$total)


Cheers,
Boris



> On Jun 29, 2017, at 9:44 AM, Naike Wang  wrote:
> 
> Hi all,
> I want to create two groups of random numbers to calculate proportions. The
> first group is to represent the number of cases in a study. The second
> group is to represent the sample size of the study. Apparently, the sample
> size is going to have to be bigger or equal to the number of cases, but the
> sample size of a study is not necessarily greater than the number of cases
> of another study. Here's an example:
> 
> study casestotal
> 117 28
> 248 70
> 387 92
> 415 17
> 
> 
> 
> Notice that the sample size of the first study is 28, which is bigger than
> the number of cases of this study, but is smaller than the number of cases
> of the second study.
> 
> How do I create a data set like this?
> 
> Best,
> Naike
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@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.

__
R-help@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.


Re: [R] package to fit mixtures of student-t distributions

2017-06-29 Thread Bert Gunter
Offlist, because this is (a) an opinion and (b) about statistics and
therefore offtopic.

I don't know whether any such package exists, but I would predict that
this is likely to be overdetermined (too many parameters) and
therefore unlikely to be a successful strategy. Fitting a mixture of
Gaussians is already difficult enough.

Feel free to ignore, of course, and no need to reply.

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 Thu, Jun 29, 2017 at 5:41 AM, vare vare via R-help
 wrote:
> Hello!
>
> I am new to R (before used python exclusively and would actually call the R 
> solution for this issue inside a python notebook, hope that doesn’t 
> disqualify me right of the batch).
>
> Right now I am  looking for a piece of software  to fit a 1D data sample to a 
> mixture of t-distributions.
>
> I searched quite a while already and it seems to be that this is a somehwat 
> obscure endeavor as most search results turn up for mixture of gaussians 
> (what I am not interested here).
>
> The most promising candidates so far are the "AdMit" and "MitSEM" R packages. 
> However I do not know R and find the description of these packages rather 
> comlple and it seems their core objective is not the fitting of mixtures of 
> t’s but instead use this as a step to accomplish something else.
>
> This is in a nutshell what I want the software to accomplish:
>
> Fitting a mixture of t-distributions to some data and estimate the "location" 
> "scale" and "degrees of freedom" for each.
>
> I hope someone can point me to a simple package, I can’t believe that this is 
> such an obscure use case.
>
> Thanks!
>
> __
> R-help@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.

__
R-help@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.

[R] package to fit mixtures of student-t distributions

2017-06-29 Thread vare vare via R-help
Hello!

I am new to R (before used python exclusively and would actually call the R 
solution for this issue inside a python notebook, hope that doesn’t disqualify 
me right of the batch).

Right now I am  looking for a piece of software  to fit a 1D data sample to a 
mixture of t-distributions.

I searched quite a while already and it seems to be that this is a somehwat 
obscure endeavor as most search results turn up for mixture of gaussians (what 
I am not interested here).

The most promising candidates so far are the "AdMit" and "MitSEM" R packages. 
However I do not know R and find the description of these packages rather 
comlple and it seems their core objective is not the fitting of mixtures of t’s 
but instead use this as a step to accomplish something else.

This is in a nutshell what I want the software to accomplish:

Fitting a mixture of t-distributions to some data and estimate the "location" 
"scale" and "degrees of freedom" for each.

I hope someone can point me to a simple package, I can’t believe that this is 
such an obscure use case.

Thanks!

__
R-help@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.

[R] Creating two groups of random numbers

2017-06-29 Thread Naike Wang
Hi all,
I want to create two groups of random numbers to calculate proportions. The
first group is to represent the number of cases in a study. The second
group is to represent the sample size of the study. Apparently, the sample
size is going to have to be bigger or equal to the number of cases, but the
sample size of a study is not necessarily greater than the number of cases
of another study. Here's an example:

study casestotal
117 28
248 70
387 92
415 17



Notice that the sample size of the first study is 28, which is bigger than
the number of cases of this study, but is smaller than the number of cases
of the second study.

How do I create a data set like this?

Best,
Naike

[[alternative HTML version deleted]]

__
R-help@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.


[R] Creating two groups of random numbers

2017-06-29 Thread Naike Wang
Hi all,
I want to create two groups of random numbers to calculate proportions. The
first group is to represent the number of cases in a study. The second
group is to represent the sample size of the study. Apparently, the sample
size is going to have to be bigger or equal to the number of cases, but the
sample size of a study is not necessarily greater than the number of cases
of another study. Here's an example:

study  casestotal
1 17 28
2 48 70
3 87 92
4 15 17

Notice that the sample size of the first study is 28, which is bigger than
the number of cases of this study, but is smaller than the number of cases
of the second study.

How do I create a data set like this?

Best,
Naike

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] help needed for RInside with Qt

2017-06-29 Thread Santosh Kumar
Hi Bert and Jeff,

Thanks a lot for pointing it out. It is a commercial application. I would
be distributing it. This makes R out of consideration.

Thanks again for saving much time and effort.

On Thu, Jun 29, 2017 at 10:22 AM, Jeff Newmiller 
wrote:

> If you adhere to the terms of the license for R you should be okay
> legally. If you use contributed packages they may have additional
> requirements. However, these terms are often overlooked by programmers
> targeting Windows, hence Bert's caution.
>
> As to the content of the original post itself, it is off-topic for this
> list... it belongs in R-devel (but you may need to study the Posting Guide
> more thoroughly (use plain text at least) and clearly communicate your
> licensing intentions to elicit help there. You probably also ought to
> carefully read the R Installation and Administration Manual and indicate
> why that document did not answer your questions.
> --
> Sent from my phone. Please excuse my brevity.
>
> On June 29, 2017 12:32:40 AM EDT, Bert Gunter 
> wrote:
> >Is this application meant to be commercial? If so, R's open source
> >license probably would forbid you to use it. I defer to those with
> >real legal knowledge on this point, but you should check it. If it is
> >not meant to be commercial, then ignore -- I have nothing useful to
> >offer you.
> >
> >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 Wed, Jun 28, 2017 at 1:36 PM, Santosh Kumar
> > wrote:
> >> Hello,
> >>
> >> I am developing an application using Qt framework and C++. I want to
> >use R
> >> as statistics engine of my application. After doing some search on
> >> internet; I came to the conclusion that RCPP, MPI with RInside is
> >what I
> >> need. The next logical task was to quickly tryout "qtdensity" project
> >of
> >> RInside, for understanding the build and other settings. I hit some
> >> roadblock here and got little confused. I have following quaries:
> >>
> >> 1. I am using Qt  5.8 MSVC and would like to distribute both 64 bit
> >as well
> >> as 32 bit application.
> >> 2. Can I use binary distribution provided on CRAN with this version
> >of Qt?
> >> 3. If not then; do I need to build R myself with MinGW and Qt too
> >with the
> >> same version of MinGW?
> >> 4. regarding make file modifications how should I set R_HOME env.
> >variable?
> >> Currently my R is installed in "C:\Program Files\R\R-3.4.0" If I set
> >env
> >> variable R_HOME = "C:\Program Files\R\R-3.4.0"I get QMake error:
> >The
> >> system cannot find the path specified.
> >>
> >> Any help will be much appreciated.
> >>
> >> Thanks,
> >> Santosh
> >>
> >> [[alternative HTML version deleted]]
> >>
> >> __
> >> R-help@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.
> >
> >__
> >R-help@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]]

__
R-help@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.


Re: [R] Different date formats in one column

2017-06-29 Thread Christoph Puschmann
Hey,

Are all the dates connected? So no comma or space btw?

Regards,

Christoph

> On 29 Jun 2017, at 2:02 pm, Farnoosh Sheikhi via R-help 
>  wrote:
> 
> Hi, 
> I have a data set with various date formats in one column and not sure how to 
> unify it.Here is a few formats:
> 02091702/22/170221201703/17/160015-08-239/2/1500170806May-2-201522-March-2014
> I tried parse_date_time from lubridate library but it failed.Thanks so much. 
> Best,Farnoosh
> 
> 
>[[alternative HTML version deleted]]
> 
> __
> R-help@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.

__
R-help@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.


Re: [R] R package for scorecard development

2017-06-29 Thread Michael Friendly

Hi

I'm sure there are valid reasons for wanting to use a scorecard model,
but a more straightforward approach would just be a logistic regression
or logistic discriminant analysis.

Compared to that, a scorecard model can be considered to be throwing 
away information by binning the predictors.  It is similar to what scale
developers often do by simply summing up item (0/1) scores on the 
assumption that they all should be equally weighted, rather than using 
something like factor or component weights.


Just a thought.  If you do come up with a scorecard model, it would at
least be useful to compare it with a logistic model.

-Michael

On 6/28/17 1:26 PM, Nikhil Abhyankar wrote:

Hello all,

Is there any R package that can develop a scorecard model for a binary
target variable?

More details:
I want to create a scorecard based on the raw data I have.

I have a binary target variable and a few numeric and character input
variables.

I want to bin the variables and assign a score to each of the bins.

Each subject will be scored based on the bin it falls in for each variable.

All such scores from each of the variables will be added up to get the
final score.

There will be a cutoff score to decide which of the two classes of response
the subject falls into.

I fount and tested the smbinning package. However, it only gives the bins
for a single variable at a time.

How can I get a full scorecard model?

Thanks
Nikhil

[[alternative HTML version deleted]]



__
R-help@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.


Re: [R] Help : glm p-values for a factor predictor

2017-06-29 Thread Fox, John
Hi Michael,

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Michael
> Friendly
> Sent: Thursday, June 29, 2017 9:04 AM
> To: Benoît PELE ; r-help@r-project.org
> Subject: Re: [R] Help : glm p-values for a factor predictor
> 
> On 6/29/17 11:13 AM, Benoît PELE wrote:
> > My question is about the factor predictors with several levels. R
> > provides only the pvalues for each level whereas i need an overall
> > pvalue for testing the predictor.
> 
> What you ask is provided by anova() -- type I tests, and car::Anova() -- Type 
> II
> & III tests.
> 
> Factors in stepwise methods must be handled specially, to allow all levels to
> be included/excluded together.  I don't know of R software that does this.

The step() function and stepAIC() in MASS both keep terms together and obey 
marginality.

Best,
 John

> 
> HTH
> 
> -Michael
> 
> __
> R-help@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.
__
R-help@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.

Re: [R] Help : glm p-values for a factor predictor

2017-06-29 Thread Michael Friendly

On 6/29/17 11:13 AM, Benoît PELE wrote:

My question is about the factor predictors with several levels. R provides
only the pvalues for each level whereas i need an overall pvalue for
testing the predictor.


What you ask is provided by anova() -- type I tests, and car::Anova() -- 
Type II & III tests.


Factors in stepwise methods must be handled specially, to allow all 
levels to be included/excluded together.  I don't know of R software 
that does this.


HTH

-Michael

__
R-help@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.

Re: [R] Help : glm p-values for a factor predictor

2017-06-29 Thread Benoît PELE
Thank you for your answer.

The used code is the next one :

champ_model<-c("y","categ_juridique","Indic_CTRLAUTRE_RPOS","Indic_CTRLAUTRE_RNEG","Indic_CTRLCCA_RPOS",
 
"Indic_CTRLCCA_RNEG","Indic_CTRLCPAP_RPOS","Indic_CTRLCPAP_RNEG","Indic_CTRLLCTI_RPOS",
 
"Indic_Changement_NomLogiciel","Indic_Changement_NomEditeur","Changt_NomEditeurPaie",
 
"Changt_NomLogicielPaie","Infoabs_NomEditeurPaie","Infoabs_NomLogicielPaie",
 
"Indic_Decla_comple","Indic_Decla_AnnuRempl","class_ape","class_Logiciel","class_Editeur",
 
"moda_delai_soldeN_1","moda_delai_soldeN_2","moda_delai_soldeN_3","moda_delai_soldeN_4",
  "moda_delai_soldeN_5",
 
"moda_anciennete_debitN_1","moda_anciennete_debitN_2","moda_anciennete_debitN_3",
  "moda_anciennete_debitN_4","moda_anciennete_debitN_5",
  "moda_moy_anciennete_debit","moda_std_anciennete_debit",
  "moda_moy_delai_solde","moda_std_delai_solde",
 
var_cluster_Arome,var_cluster_BRC,var_cluster_Cedre,var_cluster_cntx2,var_cluster_ctrl,
 
var_cluster_DADS_assiette2,var_cluster_DADS_avantage2,var_cluster_DADS_contrat2,
  var_cluster_DADS_salarie2,var_cluster_Sequoia)

--> The predictors between quotes (excepted y) are qualitative ; others 
are groups of continuous predictors

Var_model<-paste0("y ~ ", paste(champ_model_cont[-1],collapse=" + "))
Logit_appr<-glm(formula=Var_model,family=binomial(link="logit"),data=pop_ctrl_siren_cca2017_appr)

--> The results of this glm do not provide overall pvalues for the 
qualitative predictors, only one pvalue by modality. And for selecting the 
qualitative predictors, i need that overall pvalue that SAS for example 
provides with PROC LOGISTIC.

Benoit Pel�.




De :"Bob O'Hara" 
A : Beno�t PELE , 
Cc :r-help 
Date :  29/06/2017 11:46
Objet : Re: [R] Help : glm p-values for a factor predictor



It might help if you provided the code you used. It's possible that
you didn't use direction="backward" in stepAIC(). Or if you did, it
was still running, so whatever else you try will still be slow. The
statement "R provides only the pvalues for each level" is wrong: look
at the anova() function.

Bob

On 29 June 2017 at 11:13, Beno�t PELE  wrote:
> Hello,
>
> i am a newby on R and i am trying to make a backward selection on a
> binomial-logit glm on a large dataset (69000 lines for 145 predictors).
>
> After 3 days working, the stepAIC function did not terminate. I do not
> know if that is normal but i would like to try computing a "homemade"
> backward with a repeated glm ; at each step, the predictor with the max
> pvalue would be excluded until reaching a set of 20 predictors for
> example.
>
> My question is about the factor predictors with several levels. R 
provides
> only the pvalues for each level whereas i need an overall pvalue for
> testing the predictor.
>
> On internet, the only solution i found suggests to compute a Khi2
> log-likelihood test between the complete model and the model without the
> factor predictor to emphasize its relevance.
>
> Do you know other ways? Another R package managing this kind of issue?
>
> Thank you and best regards, Benoit.
> [[alternative HTML version deleted]]
>
> __
> R-help@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.



-- 
Bob O'Hara
NOTE NEW ADDRESS!!!
Institutt for matematiske fag
NTNU
7491 Trondheim
Norway

Mobile: +49 1515 888 5440
Journal of Negative Results - EEB: www.jnr-eeb.org


[[alternative HTML version deleted]]

__
R-help@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.

Re: [R] Changing ggplot2 legend key/title to custom text

2017-06-29 Thread PIKAL Petr
Hi

I usually use google. It is quite powerful.

Search
ggplot legend title

results in
http://www.cookbook-r.com/Graphs/Legends_(ggplot2)/

from which you could find a way how to modify legend.

library(ggplot2)
bp <- ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group)) + 
geom_boxplot()
bp
bp + scale_fill_discrete(name="Experimental\nCondition",
  breaks=c("ctrl", "trt1", "trt2"),
  labels=c("Control", "Treatment 1", "Treatment 2"))


For plotmath (subscripts, ...) see

?plotmath

e.g.

plot(1,1, main=expression("sex"[2]), sub=expression("sex"^"2"))
text(1,.8,expression(over("sex", "sex"[2])))

Cheers
Petr

> -Original Message-
> From: BARLAS Marios 247554 [mailto:marios.bar...@cea.fr]
> Sent: Thursday, June 29, 2017 1:28 PM
> To: PIKAL Petr 
> Cc: r-help@r-project.org
> Subject: RE: Changing ggplot2 legend key/title to custom text
>
> Hi Petr and thanks for your reply,
>
> That's the problem I don't want to modify the labels of my legends but the 
> title
> of the legend in itself inserting my custom text :)
>
> Take for example the 1st graph in this tutorial
> http://www.sthda.com/english/wiki/ggpubr-r-package-ggplot2-based-
> publication-ready-plots
> I want to change the "sex" in "sex subscript 2" or " (sex/sex[2]+Q)
>
> Thanks again,
>
> Marios Barlas
> PhD Candidate
> CMOS & Memory Integration
> Advanced Memory Group
>
> Leti, technology research institute
> Commissariat à l’énergie atomique et aux énergies alternatives T. +33 4 38 78
> 11 50 M. +33 6 02 61 83 49 www.leti.fr  | Leti is a member of the Carnot
> Institutes network
>
> -Message d'origine-
> De : PIKAL Petr [mailto:petr.pi...@precheza.cz] Envoyé : jeudi 29 juin 2017
> 13:08 À : BARLAS Marios 247554 ; r-help@r-
> project.org Objet : RE: Changing ggplot2 legend key/title to custom text
>
> Hi
>
> There are plenty of examples
> https://stackoverflow.com/questions/6202667/how-to-use-subscripts-in-
> ggplot2-legends-r
> https://stackoverflow.com/questions/19507742/using-expressionpaste-to-
> insert-math-notation-into-a-ggplot-legend
>
> which you can modify.
>
> If you say
>
> "but it wont' seem to work"
>
> how can we know what does it mean?
>
> Plotmath expressions are rather tricky, especially if you do not use them 
> often.
> You need some experimenting.
>
> Cheers
> Petr
>
> > -Original Message-
> > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of BARLAS
> > Marios 247554
> > Sent: Thursday, June 29, 2017 11:47 AM
> > To: r-help@r-project.org
> > Subject: [R] Changing ggplot2 legend key/title to custom text
> >
> > Hi all,
> >
> > ok I have this issue:
> >
> > I want to change my graphs legends to custom text, often requiring the
> > use of superscripts/subscripts I tried to use this instruction I found on 
> > stack
> overflow:
> >
> > labs(x = "R(Ohm)", y= "CDF", aesthetic= " Content (%)" )
> >
> > but it wont' seem to work.
> >
> > Also tried bquote for super/ subscripts
> >
> > xlab(bquote(~x~/(~x~ + ~MO[2]~)* '(%)'))
> >
> > but I get an error that the / operator is not recognized.
> >
> > Any ideas on how I can solve these issues ?
> >
> > Thanks in advance,
> > Marios Barlas
> >
> > __
> > R-help@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.
>
> 
> Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou
> určeny pouze jeho adresátům.
> Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně
> jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze
> svého systému.
> Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email
> jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
> Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či
> zpožděním přenosu e-mailu.
>
> V případě, že je tento e-mail součástí obchodního jednání:
> - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, 
> a to
> z jakéhokoliv důvodu i bez uvedení důvodu.
> - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout;
> Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany 
> příjemce s
> dodatkem či odchylkou.
> - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným
> dosažením shody na všech jejích náležitostech.
> - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost
> žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo
> písemně pověřen a takové pověření nebo plná moc byly adresátovi tohoto
> emailu případně osobě, kterou adresát zastupuje, předloženy nebo jejich
> existence je adresátovi či osobě jím zastoupené 

Re: [R] Changing ggplot2 legend key/title to custom text

2017-06-29 Thread BARLAS Marios 247554
Hi Petr and thanks for your reply,

That's the problem I don't want to modify the labels of my legends but the 
title of the legend in itself inserting my custom text :) 

Take for example the 1st graph in this tutorial
http://www.sthda.com/english/wiki/ggpubr-r-package-ggplot2-based-publication-ready-plots
I want to change the "sex" in "sex subscript 2" or " (sex/sex[2]+Q)

Thanks again,

Marios Barlas
PhD Candidate
CMOS & Memory Integration
Advanced Memory Group

Leti, technology research institute 
Commissariat à l’énergie atomique et aux énergies alternatives
T. +33 4 38 78 11 50 M. +33 6 02 61 83 49
www.leti.fr  | Leti is a member of the Carnot Institutes network
 
-Message d'origine-
De : PIKAL Petr [mailto:petr.pi...@precheza.cz] 
Envoyé : jeudi 29 juin 2017 13:08
À : BARLAS Marios 247554 ; r-help@r-project.org
Objet : RE: Changing ggplot2 legend key/title to custom text

Hi

There are plenty of examples
https://stackoverflow.com/questions/6202667/how-to-use-subscripts-in-ggplot2-legends-r
https://stackoverflow.com/questions/19507742/using-expressionpaste-to-insert-math-notation-into-a-ggplot-legend

which you can modify.

If you say

"but it wont' seem to work"

how can we know what does it mean?

Plotmath expressions are rather tricky, especially if you do not use them 
often. You need some experimenting.

Cheers
Petr

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of BARLAS 
> Marios 247554
> Sent: Thursday, June 29, 2017 11:47 AM
> To: r-help@r-project.org
> Subject: [R] Changing ggplot2 legend key/title to custom text
>
> Hi all,
>
> ok I have this issue:
>
> I want to change my graphs legends to custom text, often requiring the 
> use of superscripts/subscripts I tried to use this instruction I found on 
> stack overflow:
>
> labs(x = "R(Ohm)", y= "CDF", aesthetic= " Content (%)" )
>
> but it wont' seem to work.
>
> Also tried bquote for super/ subscripts
>
> xlab(bquote(~x~/(~x~ + ~MO[2]~)* '(%)'))
>
> but I get an error that the / operator is not recognized.
>
> Any ideas on how I can solve these issues ?
>
> Thanks in advance,
> Marios Barlas
>
> __
> R-help@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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement 

Re: [R] Extraneous full stop in csv read

2017-06-29 Thread Duncan Murdoch

On 28/06/2017 7:30 PM, John wrote:

I ran into a puzzling minor behaviour I would like to understand.
Reading in a csv file, I find an extraneous "." after a column header,
"in" [short for "inches"] thus, "in.". Is this due to "in" being
reserved?  I initially blamed this on RStudio or to processing the data
through LibreCalc. However, the same result occurs in a console R
session.  Sending the file to the console via less reveals no strange
characters in the first line.  The data is California statewide
rainfall which was screen captured from the Western Regional Climate
Center web site.

First 15 lines including header line:

"yr","mo","Data","in"
1895,1,8243,8.243
1895,2,2265,2.265
1895,3,2340,2.34
1895,4,1014,1.014
1895,5,1281,1.281
1895,6,58,0.058
1895,7,156,0.156
1895,8,140,0.14
1895,9,1087,1.087
1895,10,322,0.322
1895,11,1331,1.331
1895,12,2428,2.428
1896,1,7156,7.156
1896,2,712,0.712
1896,3,2982,2.982

File read in as follows:

x <- read.csv('DRI-mo-prp.csv', header = T)

Structure:

 str(x)
'data.frame':   1469 obs. of  4 variables:
 $ yr  : int  1895 1895 1895 1895 1895 1895 1895 1895 1895 1895 ...
 $ mo  : int  1 2 3 4 5 6 7 8 9 10 ...
 $ Data: int  8243 2265 2340 1014 1281 58 156 140 1087 322 ...
 $ in. : num  8.24 2.27 2.34 1.01 1.28 ...
[note "in" is now "in."]


Yes, "in" is not a valid variable name, because of its syntactic use. 
You can stop this correction by setting check.names=FALSE in your call 
to read.csv.  This will make it a little tricky to deal with in some 
situations, e.g.


> x <- data.frame(4)
> names(x) <- "in"
> x
  in
1  4
> x$in
Error: unexpected 'in' in "x$in"

but you can work around this problem: x[, "in"] and x$`in` are both fine.

Duncan Murdoch

__
R-help@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.


Re: [R] Changing ggplot2 legend key/title to custom text

2017-06-29 Thread PIKAL Petr
Hi

There are plenty of examples
https://stackoverflow.com/questions/6202667/how-to-use-subscripts-in-ggplot2-legends-r
https://stackoverflow.com/questions/19507742/using-expressionpaste-to-insert-math-notation-into-a-ggplot-legend

which you can modify.

If you say

"but it wont' seem to work"

how can we know what does it mean?

Plotmath expressions are rather tricky, especially if you do not use them 
often. You need some experimenting.

Cheers
Petr

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of BARLAS
> Marios 247554
> Sent: Thursday, June 29, 2017 11:47 AM
> To: r-help@r-project.org
> Subject: [R] Changing ggplot2 legend key/title to custom text
>
> Hi all,
>
> ok I have this issue:
>
> I want to change my graphs legends to custom text, often requiring the use of
> superscripts/subscripts I tried to use this instruction I found on stack 
> overflow:
>
> labs(x = "R(Ohm)", y= "CDF", aesthetic= " Content (%)" )
>
> but it wont' seem to work.
>
> Also tried bquote for super/ subscripts
>
> xlab(bquote(~x~/(~x~ + ~MO[2]~)* '(%)'))
>
> but I get an error that the / operator is not recognized.
>
> Any ideas on how I can solve these issues ?
>
> Thanks in advance,
> Marios Barlas
>
> __
> R-help@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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by the recipient.
__
R-help@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.

[R] Changing ggplot2 legend key/title to custom text

2017-06-29 Thread BARLAS Marios 247554
Hi all, 

ok I have this issue: 

I want to change my graphs legends to custom text, often requiring the use of 
superscripts/subscripts
I tried to use this instruction I found on stack overflow: 

labs(x = "R(Ohm)", y= "CDF", aesthetic= " Content (%)" )

but it wont' seem to work. 

Also tried bquote for super/ subscripts 

xlab(bquote(~x~/(~x~ + ~MO[2]~)* '(%)'))

but I get an error that the / operator is not recognized. 

Any ideas on how I can solve these issues ? 

Thanks in advance,
Marios Barlas

__
R-help@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.


Re: [R] Help : glm p-values for a factor predictor

2017-06-29 Thread Bob O'Hara
It might help if you provided the code you used. It's possible that
you didn't use direction="backward" in stepAIC(). Or if you did, it
was still running, so whatever else you try will still be slow. The
statement "R provides only the pvalues for each level" is wrong: look
at the anova() function.

Bob

On 29 June 2017 at 11:13, Benoît PELE  wrote:
> Hello,
>
> i am a newby on R and i am trying to make a backward selection on a
> binomial-logit glm on a large dataset (69000 lines for 145 predictors).
>
> After 3 days working, the stepAIC function did not terminate. I do not
> know if that is normal but i would like to try computing a "homemade"
> backward with a repeated glm ; at each step, the predictor with the max
> pvalue would be excluded until reaching a set of 20 predictors for
> example.
>
> My question is about the factor predictors with several levels. R provides
> only the pvalues for each level whereas i need an overall pvalue for
> testing the predictor.
>
> On internet, the only solution i found suggests to compute a Khi2
> log-likelihood test between the complete model and the model without the
> factor predictor to emphasize its relevance.
>
> Do you know other ways? Another R package managing this kind of issue?
>
> Thank you and best regards, Benoit.
> [[alternative HTML version deleted]]
>
> __
> R-help@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.



-- 
Bob O'Hara
NOTE NEW ADDRESS!!!
Institutt for matematiske fag
NTNU
7491 Trondheim
Norway

Mobile: +49 1515 888 5440
Journal of Negative Results - EEB: www.jnr-eeb.org

__
R-help@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.

[R] Help : glm p-values for a factor predictor

2017-06-29 Thread Benoît PELE
Hello, 

i am a newby on R and i am trying to make a backward selection on a 
binomial-logit glm on a large dataset (69000 lines for 145 predictors). 

After 3 days working, the stepAIC function did not terminate. I do not 
know if that is normal but i would like to try computing a "homemade" 
backward with a repeated glm ; at each step, the predictor with the max 
pvalue would be excluded until reaching a set of 20 predictors for 
example. 

My question is about the factor predictors with several levels. R provides 
only the pvalues for each level whereas i need an overall pvalue for 
testing the predictor. 

On internet, the only solution i found suggests to compute a Khi2 
log-likelihood test between the complete model and the model without the 
factor predictor to emphasize its relevance. 

Do you know other ways? Another R package managing this kind of issue? 

Thank you and best regards, Benoit. 
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Finding optim.R function

2017-06-29 Thread ProfJCNash
The codes were taken from the 2nd edition of my book Compact Numerical
Methods for Computers, where they are in Pascal. They were converted by
p2c to c, so are pretty opaque and likely difficult to modify. Moreover,
they are based on 1970s codes I wrote for the first edition. Why not
look at optimr (CRAN) or the more extensive optimrx (R-forge) where
there are calls to pure R versions with improvements in the codes as
well as bounds constraints on parameters for some. If you have
suggestions or queries about the newer codes, contact me off-list and
we'll see what can be done.

JN (who will be at UseR! next week)


On 2017-06-27 12:46 PM, Tauras Vilgalys wrote:
> Hello, could anybody direct me where to find code for optim.R? I was able to 
> find the C code at http://docs.rexamine.com/R-devel/optim_8c.html, but the R 
> version would be easier for me to work with and modify.
> 
> 
> Thank you!
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@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.
>

__
R-help@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.


Re: [R] R package for scorecard development

2017-06-29 Thread Suzen, Mehmet
I suggest you to have a look at this R document:
https://cran.r-project.org/doc/contrib/Sharma-CreditScoring.pdf

On 28 June 2017 at 13:26, Nikhil Abhyankar  wrote:
> Hello all,
>
> Is there any R package that can develop a scorecard model for a binary
> target variable?
>
> More details:
> I want to create a scorecard based on the raw data I have.
>
> I have a binary target variable and a few numeric and character input
> variables.
>
> I want to bin the variables and assign a score to each of the bins.
>
> Each subject will be scored based on the bin it falls in for each variable.
>
> All such scores from each of the variables will be added up to get the
> final score.
>
> There will be a cutoff score to decide which of the two classes of response
> the subject falls into.
>
> I fount and tested the smbinning package. However, it only gives the bins
> for a single variable at a time.
>
> How can I get a full scorecard model?
>
> Thanks
> Nikhil
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.

__
R-help@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.