Re: [R] fit lognorm to cdf data

2017-07-10 Thread PIKAL Petr
Hi

I thought that fitdistr is used when I have original data, something like

dat <- rlnorm(1000)

but I have just five values (proc, size) as showed in my example. Actually 
those data are similar like results from sieving for which I can use package 
sievetest but as they do not follow Rosin Rammler distribution the results were 
unsatisfactory. Therefore I wanted to try fit lognormal for which Peter gave me 
answer.

Thanks.
Petr

> -Original Message-
> From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us]
> Sent: Monday, July 10, 2017 9:55 PM
> To: r-help@r-project.org; PIKAL Petr ; r-help@r-
> project.org
> Subject: Re: [R] fit lognorm to cdf data
>
> * fitdistr?
>
> * it seems unusual (to me) to fit directly to the data with lognormal... 
> fitting a
> normal to the log of the data seems more in keeping with the assumptions
> associated with that distribution.
> --
> Sent from my phone. Please excuse my brevity.
>
> On July 10, 2017 7:27:47 AM PDT, PIKAL Petr  wrote:
> >Dear all
> >
> >I am struggling to fit data which form something like CDF by lognorm.
> >
> >Here are my data:
> >
> >proc <- c(0.9, 0.84, 0.5, 0.16, 0.1)
> >size <- c(0.144, 0.172, 0.272, 0.481, 0.583) plot(size, proc,
> >xlim=c(0,1), ylim=c(0,1)) fit<-nls(proc~SSfpl(size, 1, 0, xmid, scal),
> >start=list(xmid=0.2,
> >scal=.1))
> >lines(seq(0,1,.01), predict(fit,
> >newdata=data.frame(sito=seq(0,1,.01))), col=2)
> >
> >I tried to fit with SSfpl, which is let say close but probably not
> >enough. I tried to find how to fit lognorm CDF to my data but did not
> >find an easy solution.
> >
> >Before I start to invent wheel I ask for some hints. I thought about
> >using optim together with plnorm or to feed nls with lognorm function
> >but maybe somebody already solved such task.
> >
> >Best regards
> >Petr
> >
> >


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

Re: [R] fit lognorm to cdf data

2017-07-10 Thread PIKAL Petr
Hi

Great. I did not think that such combination is posssible.

Thanks.
Petr

> -Original Message-
> From: peter dalgaard [mailto:pda...@gmail.com]
> Sent: Tuesday, July 11, 2017 1:11 AM
> To: PIKAL Petr 
> Cc: r-help@r-project.org
> Subject: Re: [R] fit lognorm to cdf data
>
> How about
>
> proc <- c(0.9, 0.84, 0.5, 0.16, 0.1)
> size <- c(0.144, 0.172, 0.272, 0.481, 0.583)
> plot(size, proc, xlim=c(0,1), ylim=c(0,1))
> fit<-nls(proc~plnorm(size, log(xmid), sdlog, lower=FALSE), 
> start=list(xmid=0.2,
> sdlog=.1))
> summary(fit)
> lines(fitted(fit)~size)
>
> -pd
>
> > On 10 Jul 2017, at 16:27 , PIKAL Petr  wrote:
> >
> > Dear all
> >
> > I am struggling to fit data which form something like CDF by lognorm.
> >
> > Here are my data:
> >
> > proc <- c(0.9, 0.84, 0.5, 0.16, 0.1)
> > size <- c(0.144, 0.172, 0.272, 0.481, 0.583)
> > plot(size, proc, xlim=c(0,1), ylim=c(0,1))
> > fit<-nls(proc~SSfpl(size, 1, 0, xmid, scal), start=list(xmid=0.2, scal=.1))
> > lines(seq(0,1,.01), predict(fit, newdata=data.frame(sito=seq(0,1,.01))), 
> > col=2)
> >
> > I tried to fit with SSfpl, which is let say close but probably not enough. 
> > I tried
> to find how to fit lognorm CDF to my data but did not find an easy solution.
> >
> > Before I start to invent wheel I ask for some hints. I thought about using
> optim together with plnorm or to feed nls with lognorm function but maybe
> somebody already solved such task.
> >
> > Best regards
> > Petr
> >
> > 
> > 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.
>
> --
> Peter Dalgaard, Professor,
> Center for 

Re: [R] Help documentation of "The Studentized range Distribution"

2017-07-10 Thread Ursula Garczarek
Dear Peter and Jeff,

I admit I was not precise in what I really wanted. It was more a report that 
the documentation is confusing, than really asking for help. Still, I was only 
97% sure that it was not my fault, so I remained cautious.

So, my suggestion would be to say under the header usage just as it is now:

ptukey(q, nmeans, df, nranges = 1, lower.tail = TRUE, log.p = FALSE)
qtukey(p, nmeans, df, nranges = 1, lower.tail = TRUE, log.p = FALSE)

but in the description of parameters

qnow and future: vector of quantiles
pnow and future: vector of probabilities
nmeansnow: sample size for range (same for each group) future: number of means 
resp. groups of which the mean is compared
dfnow: degrees of freedom for s (see below)future: degrees of freedom for the 
estimation of the pooled variance
(Ursula's comment: "see below" is not true, I was looking for it...)
Nranges: now: number of groups whose maximum range is considered future: ? 
(nmeans*(nmeans-1)/2)??


The description for Nranges actually was putting me on the wrong foot as to me 
the description really sounds like what is really nmeans. I still am not sure 
what this parameter does, as in my context it does not seem to be necessary.

The example I worked through is in context of post-hoc testing in an one way 
balanced ANOVA and for all pairwise comparisons

With 5 groups, and n=10 subjects per group, and a significance level of a=0.95 
one would use a critical value of

C = qtukey(0.95, nmeans=5, df = 5*(10-1)) /sqrt(2) = 4.01842 /sqrt(2)

(Example from SAS documentation on multiple comparison procedures)

I also checked against a tabulation in my old statistic books for more 
examples, and thus was pretty sure that nmeans is the number of means and 
nranges is something else, which you do not really specify for the post-hoc 
testing.


And my actual code so far is:
library(tidyverse)

g=2:10
alpha=c(0.025,0.05)
n=10:50
delta = 1
(grid <- expand.grid(alpha,g,n))

dt <- grid %>% as_tibble()
names(dt) <- c("Var1" = "alpha", "Var2" = "ngroups", "Var3" = "nIngroups")


dt <- dt %>% mutate(ctuk = 1/sqrt(2) * qtukey(1-alpha, ngroups, 
ngroups*(nIngroups-1)))
dt <- dt %>% mutate(cbon = 
qt(1-alpha/(ngroups*(ngroups-1)),ngroups*(nIngroups-1)))
dtwide <- dt %>% mutate(cnon = qt(1-alpha/2,ngroups*(nIngroups-1)))
dtlong <- dtwide %>% gather(method,cvalue,cnon,cbon,ctuk)

Hope this is better!

Kind regards,

Ursula

-Original Message-
From: peter dalgaard [mailto:pda...@gmail.com]
Sent: 10 July 2017 11:46
To: Jeff Newmiller 
Cc: R-help Mailing List ; Ursula Garczarek 

Subject: Re: [R] Help documentation of "The Studentized range Distribution"

Well, it is clear enough that the problem is in interpreting the documentation. 
However, when you claim you tested something, and found it inconsistent with 
tables, it would be advisable to back it up with examples!

The description in the help files and in the sources is admittedly confusing. 
The original paper has this, rather more clear, description in the abstract:

"We consider the probability distribution of the maximum of r statistics each 
distributed as the Studentized range of means calculated from c random samples 
of size n from normal populations. The rc samples are assumed to be mutually 
independent and a common pooled—within—samplevariance is used throughout."

So the connection is nranges == r, and nmeans == c. (n never actually factors 
in because sqrt(n) is part of the standardization)

For the typical application, r is 1 for the usual studentized range 
distribution. E.g. for two large groups:

> qtukey(.95,2,df=Inf)
[1] 2.771808

As there is only one difference to consider, this should be distributed like 
the absolute value of the difference between two standard normals, and yes: We 
get our old friend 1.96 from

> qtukey(.95,2,df=Inf)/sqrt(2)
[1] 1.959964

It is less than fortunate that the help file speaks of "sample size for range". 
It is marginally defensible, because it is about the standardized range of a 
sample _of means_, but it is likely to confuse the actual reader into believing 
that it has to do with the sample size for each mean.

-pd

> On 10 Jul 2017, at 05:04 , Jeff Newmiller  wrote:
>
> We cannot help you understand what you are doing if you do not show us what 
> you are doing.  Here are some discussions about how to communicate questions 
> about R [1][2][3].
>
> [1]
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-repro
> ducible-example
>
> [2] http://adv-r.had.co.nz/Reproducibility.html
>
> [3] https://cran.r-project.org/web/packages/reprex/index.html
> --
> Sent from my phone. Please excuse my brevity.
>
> On July 6, 2017 11:36:47 AM PDT, Ursula Garczarek 
>  wrote:
>> Dear all,
>> I wanted to compare Bonferroni vs TukeyHSD correction over a range of
>> groups and group sizes, and wanted to use the 

Re: [R] fit lognorm to cdf data

2017-07-10 Thread peter dalgaard
How about

proc <- c(0.9, 0.84, 0.5, 0.16, 0.1)
size <- c(0.144, 0.172, 0.272, 0.481, 0.583)
plot(size, proc, xlim=c(0,1), ylim=c(0,1))
fit<-nls(proc~plnorm(size, log(xmid), sdlog, lower=FALSE), start=list(xmid=0.2, 
sdlog=.1))
summary(fit)
lines(fitted(fit)~size)

-pd

> On 10 Jul 2017, at 16:27 , PIKAL Petr  wrote:
> 
> Dear all
> 
> I am struggling to fit data which form something like CDF by lognorm.
> 
> Here are my data:
> 
> proc <- c(0.9, 0.84, 0.5, 0.16, 0.1)
> size <- c(0.144, 0.172, 0.272, 0.481, 0.583)
> plot(size, proc, xlim=c(0,1), ylim=c(0,1))
> fit<-nls(proc~SSfpl(size, 1, 0, xmid, scal), start=list(xmid=0.2, scal=.1))
> lines(seq(0,1,.01), predict(fit, newdata=data.frame(sito=seq(0,1,.01))), 
> col=2)
> 
> I tried to fit with SSfpl, which is let say close but probably not enough. I 
> tried to find how to fit lognorm CDF to my data but did not find an easy 
> solution.
> 
> Before I start to invent wheel I ask for some hints. I thought about using 
> optim together with plnorm or to feed nls with lognorm function but maybe 
> somebody already solved such task.
> 
> Best regards
> Petr
> 
> 
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
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, 

Re: [R] fit lognorm to cdf data

2017-07-10 Thread Jeff Newmiller
* fitdistr?

* it seems unusual (to me) to fit directly to the data with lognormal... 
fitting a normal to the log of the data seems more in keeping with the 
assumptions associated with that distribution.
-- 
Sent from my phone. Please excuse my brevity.

On July 10, 2017 7:27:47 AM PDT, PIKAL Petr  wrote:
>Dear all
>
>I am struggling to fit data which form something like CDF by lognorm.
>
>Here are my data:
>
>proc <- c(0.9, 0.84, 0.5, 0.16, 0.1)
>size <- c(0.144, 0.172, 0.272, 0.481, 0.583)
>plot(size, proc, xlim=c(0,1), ylim=c(0,1))
>fit<-nls(proc~SSfpl(size, 1, 0, xmid, scal), start=list(xmid=0.2,
>scal=.1))
>lines(seq(0,1,.01), predict(fit,
>newdata=data.frame(sito=seq(0,1,.01))), col=2)
>
>I tried to fit with SSfpl, which is let say close but probably not
>enough. I tried to find how to fit lognorm CDF to my data but did not
>find an easy solution.
>
>Before I start to invent wheel I ask for some hints. I thought about
>using optim together with plnorm or to feed nls with lognorm function
>but maybe somebody already solved such task.
>
>Best regards
>Petr
>
>
>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-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] Problems with time formats when importing data using readHTMLTable

2017-07-10 Thread Jeff Newmiller
Not reproducible. [1][2][3] If our answers don't seem to apply to your 
situation, it will likely be because you did not explain your question clearly. 

Not plain text. This is a plain text mailing list,  and the best-case scenario 
when you let your email program send HTML is that what you saw is not what we 
see (worst case is your email is scrambled on our end).

Have you read the documentation for the function you are using? In particular, 
what about the colClasses argument? If you don't let readHTMLTable guess what 
the format is (have it read in as character data) then you have a fighting 
chance to get it right yourself, e.g.

as.POSIXct( "2017-07-10 14:04 (UTC)", format="%Y-%m-%d %H:%M (UTC)", tz="UTC" )

-

[1] 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

[2] http://adv-r.had.co.nz/Reproducibility.html

[3] https://cran.r-project.org/web/packages/reprex/index.html
-- 
Sent from my phone. Please excuse my brevity.

On July 10, 2017 8:31:30 AM PDT, Cristina Silva  wrote:
>Hi,
>
>I am extracting positions data from the marine traffic website. The 
>table has a "Timestamp" column which, in the browser, appears with the 
>format -mm-dd HH:MM (UTC), e.g. 2017-07-10 14:04 (UTC).
>
>When I import the table, the same date "2017-07-10 14:04 (UTC)" appears
>
>as "1499696500149969650021 minutes ago", This is the more recent date 
>and time. Older records, as e.g. "2017-07-09 17:02 (UTC)" appear as
>e.g. 
>"1499619726149961972621 hours, 59 minutes ago".
>
>I don't know how to convert these data to the time formats used in R 
>(POSIXct).
>
>The script is very simple and worked before:
>
>library(XML)
>x <- readHTMLTable('url')
>
>where the 'url' is the link to the website with the specification of
>the 
>vessel.
>
>I appreciate any help.
>
>Cristina
>
>-- 
>Cristina Silva
>Divisão de Modelação e Gestão de Recursos Pesqueiros
>Av. Dr. Alfredo Magalhães Ramalho
>1495-165 Lisboa
>@: csi...@ipma.pt 
>#: +351 213027096 
>
>
>   [[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] helix spring in R

2017-07-10 Thread Duncan Murdoch

On 10/07/2017 8:41 AM, Eliza B wrote:

Dear useRs,


Is there a way to draw helix spring in R of desired diameter and number of 
turns?


Yes, use rgl's cylinder3d function.  (Or lines3d if you don't want any 
volume.)


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] helix spring in R

2017-07-10 Thread Jeff Newmiller
This is an excellent opportunity for you to tell us why rseeek.org and Google 
search results did not address your needs, which may either answer your 
question without our help or help us to understand your needs better. 

I will also comment that a "spring" is usually more complex than just a 
"helix", since the pitch gets smaller near the ends, so adding this word may be 
hindering your chance if getting responses rather than helping.

And learn to post using plain text format. The more complex your question gets, 
the more important this nitpicky detail becomes. 
-- 
Sent from my phone. Please excuse my brevity.

On July 10, 2017 5:41:43 AM PDT, Eliza B  wrote:
>Dear useRs,
>
>
>Is there a way to draw helix spring in R of desired diameter and number
>of turns?
>
>
>regards,
>
>
>Eliza
>
>   [[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] PAM Clustering

2017-07-10 Thread Ulrik Stervbo
Hi Sema,

read.csv2 use ',' as the decimal separator. Since '.' is used in your file,
everything becomes a character which in turn makes pam complain that what
you pass to the function isn't numeric.

Use read.csv2("data.csv", dec = ".") and it should work.

You can also use class(d) to check the class of the matrix before you pass
it to pam().

See ?read.table for more options.

There is a base function called 'data', so naming a variable data is a poor
choice.

HTH
Ulrik

On Mon, 10 Jul 2017 at 17:25 Sema Atasever  wrote:

> Dear Authorized Sir / Madam,
>
> I have an R script file in which it includes PAM Clustering codes:
>
> *when i ran R script i am getting this error:*
> *Error in pam(d, 10) : x is not a numeric dataframe or matrix.*
> *Execution halted*
>
> How can i fix this error?
>
> Thanks in advance.
> ​
>  data.csv
> <
> https://drive.google.com/file/d/0B4rY6f4kvHeCcVpLRTQ5VDhDNUk/view?usp=drive_web
> >
> ​
>
> *pam.R*
> data <- read.csv2("data.csv")
> attach(data)
> d=as.matrix(data)
> library(cluster)
> cluster.pam = pam(d,10)
> table(cluster.pam$clustering)
>
> filenameclu = paste("clusters", ".txt")
> write.table(cluster.pam$clustering, file=filenameclu,sep=",")
>
> [[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] add a color bar

2017-07-10 Thread David L Carlson
The .png file I've attached will show you how to send plain text messages with 
Yahoo mail. This mailing list is text only so that it can be used by virtually 
any email client anywhere in the world. Your attachment did not make the trip. 
The list is picky about attachments and accepts some graphics files and plain 
text files. Just paste your code into your message or make sure it has a .txt 
extension. It should include reproducible data so that we can run it. If you 
cannot send all or part of your data, make something up that illustrates your 
problem.

Figures plotted on screen are limited to the resolution of a computer screen, 
pretty low. You probably want to plot to a graphics device that saves the file 
so that you can specify a higher resolution. The R command

?device

should get you started.

-
David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77840-4352



-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Alaios via 
R-help
Sent: Monday, July 10, 2017 4:08 AM
To: R-help Mailing List 
Subject: [R] add a color bar

Hi all,the code you will find at the bottom of the screen creates a 3d diagram 
of antenna measurements. I am adding also to this Figure a color bar,and I 
wanted to ask you if I can add a color bar (which package?) that will scale as 
the windows is maximized. My current color bar is a bit too rought and gets 
pixelized each time I maximize the window.
Any suggestions?I would like to thank you for your replyRegardsAlex
[[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] Problems with time formats when importing data using readHTMLTable

2017-07-10 Thread Cristina Silva
Hi,

I am extracting positions data from the marine traffic website. The 
table has a "Timestamp" column which, in the browser, appears with the 
format -mm-dd HH:MM (UTC), e.g. 2017-07-10 14:04 (UTC).

When I import the table, the same date "2017-07-10 14:04 (UTC)" appears 
as "1499696500149969650021 minutes ago", This is the more recent date 
and time. Older records, as e.g. "2017-07-09 17:02 (UTC)" appear as e.g. 
"1499619726149961972621 hours, 59 minutes ago".

I don't know how to convert these data to the time formats used in R 
(POSIXct).

The script is very simple and worked before:

library(XML)
x <- readHTMLTable('url')

where the 'url' is the link to the website with the specification of the 
vessel.

I appreciate any help.

Cristina

-- 
Cristina Silva
Divisão de Modelação e Gestão de Recursos Pesqueiros
Av. Dr. Alfredo Magalhães Ramalho
1495-165 Lisboa
@: csi...@ipma.pt 
#: +351 213027096 


[[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] helix spring in R

2017-07-10 Thread Eliza B
Dear useRs,


Is there a way to draw helix spring in R of desired diameter and number of 
turns?


regards,


Eliza

[[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] filtering of CO2 observation time series residuals using FFT

2017-07-10 Thread Yogesh Tiwari via R-help
Hi,

I have CO2 observations time series, I can calculate residuals by removing
seasonal cycle and trend. But how to filter residuals using Fast Fourier
Transform (FFT) which transforms the data into the frequency domain. And
then apply a low pass filter function to the frequency data, then transform
the filtered data to the real domain using an inverse FFT.

Can anyone working on carbon cycle research, have R script which can do
above analysis.
You can take example of Mauna Loa CO2 time series and do filtering.

Great Thanks,

Best Regards,
Yogesh

[[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] PAM Clustering

2017-07-10 Thread Sema Atasever
Dear Authorized Sir / Madam,

I have an R script file in which it includes PAM Clustering codes:

*when i ran R script i am getting this error:*
*Error in pam(d, 10) : x is not a numeric dataframe or matrix.*
*Execution halted*

How can i fix this error?

Thanks in advance.
​
 data.csv

​

*pam.R*
data <- read.csv2("data.csv")
attach(data)
d=as.matrix(data)
library(cluster)
cluster.pam = pam(d,10)
table(cluster.pam$clustering)

filenameclu = paste("clusters", ".txt")
write.table(cluster.pam$clustering, file=filenameclu,sep=",")

[[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] add a color bar

2017-07-10 Thread Alaios via R-help
Hi all,the code you will find at the bottom of the screen creates a 3d diagram 
of antenna measurements. I am adding also to this Figure a color bar,and I 
wanted to ask you if I can add a color bar (which package?) that will scale as 
the windows is maximized. My current color bar is a bit too rought and gets 
pixelized each time I maximize the window.
Any suggestions?I would like to thank you for your replyRegardsAlex
[[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] Revolutions blog: June 2017 roundup

2017-07-10 Thread David Smith via R-help
Since 2008, Microsoft (formerly Revolution Analytics) staff and guests
have written about R every weekday at the Revolutions blog
(http://blog.revolutionanalytics.com) and every month I post a summary
of articles from the previous month of particular interest to readers
of r-help.

In case you missed them, here are some articles related to R from the
month of June:

R 3.4.1 "Single Candle" has been released:
http://blog.revolutionanalytics.com/2017/06/r-341-single-candle-released.html

The Scientific Computing Coordinator at the FDA explains how R is used at
the FDA and by sponsors for clinical trial submissions:
http://blog.revolutionanalytics.com/2017/06/r-fda.html

Several useful tips related to including images in Rmarkdown documents:
http://blog.revolutionanalytics.com/2017/06/rmarkdown-tricks.html

A review of one of R's best features -- its community:
http://blog.revolutionanalytics.com/2017/06/r-community.html

It's now possible to include interactive visualizations (such as those
created with plotly and htmlwidgets) in Power BI reports:
http://blog.revolutionanalytics.com/2017/06/interactive-r-visuals-in-power-bi.html

The Azure Data Science Virtual Machine for Windows now supports GPU-based
computations with Microsoft R, Tensorflow, and other included software:
http://blog.revolutionanalytics.com/2017/06/dsvm-update.html

The 2017 Burtch Works survey of data science software popularity shows R
leading, Python gaining, and SAS declining:
http://blog.revolutionanalytics.com/2017/06/burtch-works-survey-2017.html

A video presentation by Ali Zaidi on using the sparklyr package with
Microsoft R Server:
http://blog.revolutionanalytics.com/2017/06/sparklyr-r-server.html

The EARL conference in San Francisco featured applications of R at Pandora,
Pfizer, Amgen, Hitachi, and many other companies:
http://blog.revolutionanalytics.com/2017/06/applications-earl-sf-2017.html

A demo of real-time predictions from a model created with Microsoft R, at a
rate of one million predictions per second:
http://blog.revolutionanalytics.com/2017/06/real-time-predictions.html

The R Epidemics Consortium is a coalition of researchers developing
epidemiology resources for R:
http://blog.revolutionanalytics.com/2017/06/r-epidemics-consortium.html

Syberia is a on open-source framework for orchestrating R scripts in
production:
http://blog.revolutionanalytics.com/2017/06/syberia.html

A from-the-basics guide to accessing open APIs from R, from Locke Data:
http://blog.revolutionanalytics.com/2017/06/interfacing-with-apis.html

Highlights of talks from useR!2017 (recordings will be available in late
July):
http://blog.revolutionanalytics.com/2017/06/user2017-schedule.html

The doAzureParallel package provides a backend to "foreach" that spins up a
parallel-processing cluster on Azure incorporating low-cost low-priority
VMs:
http://blog.revolutionanalytics.com/2017/06/doazureparallel-updated.html

A tutorial on creating dot-density maps in R, an alternative to
choropleths:
http://blog.revolutionanalytics.com/2017/06/how-to-create-dot-density-maps-in-r.html

A free 13-page e-book on using Power BI with R:
http://blog.revolutionanalytics.com/2017/06/power-bi-free-e-book.html

Python edges out R for the first time in the 2017 KDnuggets poll of data
science software usage:
http://blog.revolutionanalytics.com/2017/06/python-and-r-top-2017-kdnuggets-rankings.html

The miner package encourages kids to learn to program in R while
manipulating the world of Minecraft with R functions:
http://blog.revolutionanalytics.com/2017/06/teach-kids-about-r-with-minecraft.html

And some general interest stories (not necessarily related to R):

* A NOAA visualization of 15 years of earthquakes around the globe:
  
http://blog.revolutionanalytics.com/2017/06/because-its-friday-shake-that-globe.html

* The first Mario World level, created in augmented reality:
  
http://blog.revolutionanalytics.com/2017/06/because-its-friday-mario-in-the-park.html

* The "official" ANSI specifications for a dry martini:
  
http://blog.revolutionanalytics.com/2017/06/because-its-friday-dry-martini-specifications.html

* A comparison of urban metro systems, as mapped and to scale:
  http://blog.revolutionanalytics.com/2017/06/subway-maps-to-scale.html

* A disappearing dots illusion:
  
http://blog.revolutionanalytics.com/2017/06/because-its-friday-disappearing-dots.html

As always, thanks for the comments and please keep sending suggestions to
me at david...@microsoft.com or via Twitter (I'm @revodavid).

Cheers,
# David

-- 
David M Smith 
R Community Lead, Microsoft  
Tel: +1 (312) 9205766 (Chicago IL, USA)
Twitter: @revodavid | Blog:  http://blog.revolutionanalytics.com

__
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, 

[R] fit lognorm to cdf data

2017-07-10 Thread PIKAL Petr
Dear all

I am struggling to fit data which form something like CDF by lognorm.

Here are my data:

proc <- c(0.9, 0.84, 0.5, 0.16, 0.1)
size <- c(0.144, 0.172, 0.272, 0.481, 0.583)
plot(size, proc, xlim=c(0,1), ylim=c(0,1))
fit<-nls(proc~SSfpl(size, 1, 0, xmid, scal), start=list(xmid=0.2, scal=.1))
lines(seq(0,1,.01), predict(fit, newdata=data.frame(sito=seq(0,1,.01))), col=2)

I tried to fit with SSfpl, which is let say close but probably not enough. I 
tried to find how to fit lognorm CDF to my data but did not find an easy 
solution.

Before I start to invent wheel I ask for some hints. I thought about using 
optim together with plnorm or to feed nls with lognorm function but maybe 
somebody already solved such task.

Best regards
Petr


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.

Re: [R] dplyr help

2017-07-10 Thread Jeff Newmiller
I am pretty sure that this is not a question about dplyr... it is a question 
about tidyr. Look at the help file ?tidyr::spread.

If I understand your question (I may not,  because you gave no example of 
input/output data), the answer is no, the column names come from the column 
named by the key parameter and the values that fill those columns come from the 
column named by the value parameter. Modify your data frame to contain both 
columns before using this function.

When the function is used outside a pipe chain there is also the first 
argument, the data frame that is being reshaped.

Please post using plain text in the future... this is a plain text mailing 
list,  and HTML email is what-you-see-is-not-what-we-see.
-- 
Sent from my phone. Please excuse my brevity.

On July 10, 2017 1:29:41 AM PDT, Mangalani Peter Makananisa 
 wrote:
>HI all,
>
>Is it possible to use one column spread on multiple columns values.
>
>example
>spread( Key_col, value1:value7)
>
>spreading Key_col to variable value1, value2, ... Value7
>
>Please advise,
>
>Kind regards
>
>Mangalani Peter Makananisa (5786)
>South African Revenue Service (SARS) - HO
>+2782 456 4669 / +2712 422 7357
>
>Please Note: This email and its contents are subject to our email legal
>notice which can be viewed at
>http://www.sars.gov.za/Pages/Email-disclaimer.aspx
>
>   [[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] Help documentation of "The Studentized range Distribution"

2017-07-10 Thread peter dalgaard
Well, it is clear enough that the problem is in interpreting the documentation. 
However, when you claim you tested something, and found it inconsistent with 
tables, it would be advisable to back it up with examples!

The description in the help files and in the sources is admittedly confusing. 
The original paper has this, rather more clear, description in the abstract:

"We consider the probability distribution of the maximum of r statistics each 
distributed as the Studentized range of means calculated from c random samples 
of size n from normal populations. The rc samples are assumed to be mutually 
independent and a common pooled—within—samplevariance is used throughout."

So the connection is nranges == r, and nmeans == c. (n never actually factors 
in because sqrt(n) is part of the standardization)

For the typical application, r is 1 for the usual studentized range 
distribution. E.g. for two large groups:

> qtukey(.95,2,df=Inf)
[1] 2.771808

As there is only one difference to consider, this should be distributed like 
the absolute value of the difference between two standard normals, and yes: We 
get our old friend 1.96 from

> qtukey(.95,2,df=Inf)/sqrt(2)
[1] 1.959964

It is less than fortunate that the help file speaks of "sample size for range". 
It is marginally defensible, because it is about the standardized range of a 
sample _of means_, but it is likely to confuse the actual reader into believing 
that it has to do with the sample size for each mean.

-pd

> On 10 Jul 2017, at 05:04 , Jeff Newmiller  wrote:
> 
> We cannot help you understand what you are doing if you do not show us what 
> you are doing.  Here are some discussions about how to communicate questions 
> about R [1][2][3].
> 
> [1] 
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
> 
> [2] http://adv-r.had.co.nz/Reproducibility.html
> 
> [3] https://cran.r-project.org/web/packages/reprex/index.html
> -- 
> Sent from my phone. Please excuse my brevity.
> 
> On July 6, 2017 11:36:47 AM PDT, Ursula Garczarek 
>  wrote:
>> Dear all,
>> I wanted to compare Bonferroni vs TukeyHSD correction over a range of
>> groups and group sizes, and wanted to use the function qtukey.
>> 
>> In the help documentation it says
>> 
>> qtukey(p, nmeans, df, nranges = 1, lower.tail = TRUE, log.p = FALSE)
>> Arguments
>> q
>> 
>> vector of quantiles.
>> 
>> p
>> 
>> vector of probabilities.
>> 
>> nmeans
>> 
>> sample size for range (same for each group).
>> 
>> df
>> 
>> degrees of freedom for s (see below).
>> 
>> nranges
>> 
>> number of groups whose maximum range is considered.
>> 
>> log.p
>> 
>> logical; if TRUE, probabilities p are given as log(p).
>> 
>> lower.tail
>> 
>> logical; if TRUE (default), probabilities are P[X � x], otherwise, P[X
>>> x].
>> 
>> 
>> But when I test it, "nmeans" actually should be the number of groups,
>> and not "nrange" to fit with tables of the studentized range
>> distribution.
>> 
>> Can that be - it should be a rather old procedure, so I wonder whether
>> I get something completely wrong...
>> 
>> Regards,
>> Ursula
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> This email and any attachments are confidential and may
>> ...{{dropped:8}}
> 
> __
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
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] dplyr help

2017-07-10 Thread PIKAL Petr
Hi

something like

dcast(temp2, minuty~pokus)
?

> dput(temp2)
structure(list(pokus = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 2L,
2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L, 6L, 6L, 7L, 7L, 8L, 8L
), .Label = c("T42", "T43", "T44", "T45", "T46", "T47", "T48",
"T49"), class = "factor"), minuty = structure(c(2L, 3L, 4L, 2L,
3L, 4L, 5L, 6L, 1L, 2L, 3L, 4L, 2L, 3L, 4L, 2L, 3L, 2L, 3L, 2L,
3L, 2L, 3L), .Label = c("180", "240", "300", "360", "420", "480"
), class = "factor")), .Names = c("pokus", "minuty"), row.names = c(NA,
-23L), class = "data.frame")

Cheers
Petr


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Mangalani
> Peter Makananisa
> Sent: Monday, July 10, 2017 10:30 AM
> To: r-help@r-project.org
> Cc: Vito Ricci (vito_ri...@yahoo.com) 
> Subject: [R] dplyr help
>
> HI all,
>
> Is it possible to use one column spread on multiple columns values.
>
> example
> spread( Key_col, value1:value7)
>
> spreading Key_col to variable value1, value2, ... Value7
>
> Please advise,
>
> Kind regards
>
> Mangalani Peter Makananisa (5786)
> South African Revenue Service (SARS) - HO
> +2782 456 4669 / +2712 422 7357
>
> Please Note: This email and its contents are subject to our email legal notice
> which can be viewed at http://www.sars.gov.za/Pages/Email-disclaimer.aspx
>
>   [[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.


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] dplyr help

2017-07-10 Thread Mangalani Peter Makananisa
HI all,

Is it possible to use one column spread on multiple columns values.

example
spread( Key_col, value1:value7)

spreading Key_col to variable value1, value2, ... Value7

Please advise,

Kind regards

Mangalani Peter Makananisa (5786)
South African Revenue Service (SARS) - HO
+2782 456 4669 / +2712 422 7357

Please Note: This email and its contents are subject to our email legal notice 
which can be viewed at http://www.sars.gov.za/Pages/Email-disclaimer.aspx

[[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] Extract XMLAtrributeValue

2017-07-10 Thread Mohan.Radhakrishnan
Hi,

I am trying to extract an attribute value which is like this.

(e.g) class="whQuestion"

The 'extract' function prints this. But I am not sure how to get "whQuestion" 
from that. The type of 'x' in extract
is "character"

[1] "XMLAttributeValue"
   class
"whQuestion"
attr(,"class")

extract <- function(x){
print(x)
}

filteredclasses <-
function(){
classes <- xpathSApply(doc = posts, path = "/*/Posts/Post/@class", extract)
}

Thanks,
Mohan
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.

[[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] Beginner s quwry about cfa in lavaan

2017-07-10 Thread PIKAL Petr
Hi

Fo R basics best what you can do is to go through R intro document. Should be 
located in doc folder.

If you searched
r krippendorff alpha

you should find package irr, which maybe could do what you want (I am not an 
expert in this field).

Cheers
Petr

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Martina
> Hulešová
> Sent: Friday, July 7, 2017 6:53 PM
> To: r-help@r-project.org
> Subject: [R] Beginner s quwry about cfa in lavaan
>
> Dear all,
> I am trying to learn about R. As a Phd student, I would like to use R for
> Krippendorff s alpha and later for a series of CFA. Is there any good
> introduction to these kind of analyses, or could you recommend me some
> tutorials on youtube, for example? I am new to R, so I need something basic ,
> starting from opening the R environment.
> Thank you .
> Martina Hulesova
>
> Odesláno z mého Windows Phone
>
>   [[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.


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.