Re: [R] A general question about using Bayes' Theorem for calculating the probability of The End of Human Technological Civilisation

2019-03-19 Thread Philip Rhoades

David,


On 2019-03-20 12:38, David Winsemius wrote:

On 3/19/19 12:49 PM, Jeff Newmiller wrote:

Highly off topic. Try StackOverflow.


As it stands it's off-topic for SO. (You would just be making more
work for those of us who know the rules but need 4 close votes for
migration.)  Better would be immediately posting at CrossValidated.com
(i.e., stats.stackexchange.com)



Thanks - I will check that out . .

P.



--

David.



On March 19, 2019 10:42:24 AM PDT, Philip Rhoades  
wrote:

People,

I have only a general statistics understanding and have never 
actually

used Bayes' Theorem for any real-world problem.  My interest lies in
developing some statistical approach for addressing the subject above
and it seems to me that BT is what I should be looking at?  However,
what I am specifically interested in is how such a work-up would be
developed for a year-on-year situation eg:

I think it is likely that TEHTC could be triggered by a multi-gigaton
release of methane from the Arctic Ocean and the Siberian Permafrost 
in


any Northern Hemisphere Summer from now on (multiple physical and
non-physical, human positive feedback loops would then kick in).

So, say my estimate (Bayesian Prior) is that for this coming (2019) 
NHS


the chance of this triggering NOT occurring is x%.  The manipulation 
is


then done to calculate the posterior for 2019 - but for every
successive
year (given the state of the world), isn't it true that the chance of 
a


triggering NOT occurring in the NHS MUST go down? - ie it is just an
argument about the scale of the change from year to year?

It seems to be that the posterior for one year becomes the prior for
the
next year?  Once the prior gets small enough people won't bother with
the calculations anyway . .

Does anyone know of any existing work on this topic?  I want to write 
a


plain-English doc about it but I want to have the stats clear in my
head
. .

Thanks,

Phil.


--
Philip Rhoades

PO Box 896
Cowra  NSW  2794
Australia
E-mail:  p...@pricom.com.au

__
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] A general question about using Bayes' Theorem for calculating the probability of The End of Human Technological Civilisation

2019-03-19 Thread David Winsemius



On 3/19/19 12:49 PM, Jeff Newmiller wrote:

Highly off topic. Try StackOverflow.



As it stands it's off-topic for SO. (You would just be making more work 
for those of us who know the rules but need 4 close votes for 
migration.)  Better would be immediately posting at CrossValidated.com 
(i.e., stats.stackexchange.com)


--

David.



On March 19, 2019 10:42:24 AM PDT, Philip Rhoades  wrote:

People,

I have only a general statistics understanding and have never actually
used Bayes' Theorem for any real-world problem.  My interest lies in
developing some statistical approach for addressing the subject above
and it seems to me that BT is what I should be looking at?  However,
what I am specifically interested in is how such a work-up would be
developed for a year-on-year situation eg:

I think it is likely that TEHTC could be triggered by a multi-gigaton
release of methane from the Arctic Ocean and the Siberian Permafrost in

any Northern Hemisphere Summer from now on (multiple physical and
non-physical, human positive feedback loops would then kick in).

So, say my estimate (Bayesian Prior) is that for this coming (2019) NHS

the chance of this triggering NOT occurring is x%.  The manipulation is

then done to calculate the posterior for 2019 - but for every
successive
year (given the state of the world), isn't it true that the chance of a

triggering NOT occurring in the NHS MUST go down? - ie it is just an
argument about the scale of the change from year to year?

It seems to be that the posterior for one year becomes the prior for
the
next year?  Once the prior gets small enough people won't bother with
the calculations anyway . .

Does anyone know of any existing work on this topic?  I want to write a

plain-English doc about it but I want to have the stats clear in my
head
. .

Thanks,

Phil.


__
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] high p values

2019-03-19 Thread Marc Schwartz via R-help
Hi,

Since folks are taking the time to point out some subtle issues here, taking an 
example from the UCLA Stats web site:

https://stats.idre.ucla.edu/other/mult-pkg/faq/general/faq-why-is-the-mann-whitney-significant-when-the-medians-are-equal/

Grp1 <- rep(c(-2, 0, 5), each = 20)
Grp2 <- rep(c(-1, 0, 10), each = 20)

> Grp1
 [1] -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2  0  0
[23]  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  5  5  5  5
[45]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
> Grp2
 [1] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  0  0
[23]  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 10 10 10 10
[45] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10

> median(Grp1)
[1] 0
> median(Grp2)
[1] 0

> wilcox.test(Grp1, Grp2)

Wilcoxon rank sum test with continuity correction

data:  Grp1 and Grp2
W = 1400, p-value = 0.03096
alternative hypothesis: true location shift is not equal to 0


So, in contrast to the original problem, here is an example where you have 
equal medians, but a significant test result.

The key concept is that the Wilcoxon Rank Sum test is not strictly a test of 
differences in medians. That is, the null hypothesis for the test is not that 
the medians are equal, and you are either accepting or rejecting that null. 

Javed, I would suggest spending some time with a good tutorial on 
non-parametric statistics.

Regards,

Marc Schwartz


> On Mar 19, 2019, at 6:25 PM, Jim Lemon  wrote:
> 
> Hi Javed,
> Easy.
> 
> A<-c(2000,2100,2300,2400,6900,7000,7040,7050,7060)
> median(A)
> [1] 6900
> B<-c(3300,3350,3400,3450,3500,7000,7100,7200,7300)
> median(B)
> [1] 3500
> wilcox.test(A,B,paired=FALSE)
> 
>   Wilcoxon rank sum test with continuity correction
> 
> data:  A and B
> W = 26.5, p-value = 0.233
> alternative hypothesis: true location shift is not equal to 0
> 
> Jim
> 
> On Wed, Mar 20, 2019 at 3:48 AM javed khan  wrote:
>> 
>> Hi
>> 
>> This is my function:
>> 
>> wilcox.test(A,B, data = data, paired = FALSE)
>> 
>> It gives me high p value, though the median of A column is 6900 and B
>> column is 3500.
>> 
>> Why it gives p value high if there is a difference in the median?
>> 
>> Regards

__
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] plot.xmean.ordinaly vs plot() in package "rms"

2019-03-19 Thread Jeff Newmiller
No. Do not call plot.xmean.ordinaly() if the argument is not of class 
xmean.ordinaly, because that function assumes that it is such an object.

That is one reason why it is better to call plot() than to be more specific.

On March 19, 2019 3:29:11 PM PDT, Kim Jacobsen  wrote:
>Mailing list now included (apologies, first time I post anything so not
>quite sure how it works).
>
>You are quite right, it was a typo. I meant to write that
>plot.xmean.ordinaly(). So please let me correct my last statement: the
>plot.xmean.ordinaly() command and plot() command are interchangeable as
>long as x is an object x of class "xmean.ordinaly", and
>plot.xmean.ordinaly() is best used if the object is not of class
>"xmean.ordinaly" or if you are unsure what class it it. Is this a
>correct
>encapsulation?
>
>
>On Sun, 17 Mar 2019 at 14:38, Jeff Newmiller 
>wrote:
>
>> Please keep the mailing list included in the thread.
>>
>> I can't tell if you do understand and are just being sloppy, or if
>you are
>> completely confused, because xmean.ordinaly() and
>plot.xmean.ordinaly() are
>> two completely different symbols in R.
>>
>> As for being "safe"... you may choose to be specific or not, but plot
>and
>> plot.xmean.ordinaly are both equally "safe" to call, and being too
>specific
>> can cause problems sometimes as well.
>>
>> On March 17, 2019 6:40:10 AM PDT, Kim Jacobsen
>
>> wrote:
>> >Dear Jeff,
>> >
>> >Thank you so much! So if I understand the S3 object documents
>> >correctly,
>> >the xmean.ordinaly() command and plot() command are interchangeable
>as
>> >long
>> >as x is an object x of class "xmean.ordinaly"? So would I be right
>to
>> >think
>> >that I might as well just xmean.ordinaly() to be safe?
>> >
>> >Many thanks,
>> >
>> >
>> >
>> >On Sun, 17 Mar 2019 at 02:08, Jeff Newmiller
>
>> >wrote:
>> >
>> >> Read up on S3 object orientation[1]. If you have an object x of
>class
>> >> "xmean.ordinaly" then writing
>> >>
>> >> plot(x)
>> >>
>> >> will end up invoking the plot.xmean.ordinaly function rather than
>the
>> >> plot.default function in base graphics. This is broadly true
>> >throughout R.
>> >>
>> >> [1] http://adv-r.had.co.nz/S3.html
>> >>
>> >> On March 16, 2019 11:03:06 AM PDT, Kim Jacobsen
>> >
>> >> wrote:
>> >> >Would anyone be able to explain what the difference is between
>> >> >plot.xmean.ordinaly and plot() in the "rms" package? (for the
>> >purposes
>> >> >of
>> >> >testing the proportional odds assumption in ordinal models). In
>the
>> >> >package
>> >> >document (https://cran.r-project.org/web/packages/rms/rms.pdf)
>they
>> >> >seem
>> >> >both to be used interchangeably.
>> >> >
>> >> >Thank you!
>> >>
>> >> --
>> >> Sent from my phone. Please excuse my brevity.
>> >>
>>
>> --
>> Sent from my phone. Please excuse my brevity.
>>

-- 
Sent from my phone. Please excuse my brevity.

__
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] Fwd: high p values

2019-03-19 Thread Jim Lemon
Hi Javed,
Easy.

A<-c(2000,2100,2300,2400,6900,7000,7040,7050,7060)
median(A)
[1] 6900
B<-c(3300,3350,3400,3450,3500,7000,7100,7200,7300)
median(B)
[1] 3500
wilcox.test(A,B,paired=FALSE)

   Wilcoxon rank sum test with continuity correction

data:  A and B
W = 26.5, p-value = 0.233
alternative hypothesis: true location shift is not equal to 0

Jim

On Wed, Mar 20, 2019 at 3:48 AM javed khan  wrote:
>
> Hi
>
> This is my function:
>
> wilcox.test(A,B, data = data, paired = FALSE)
>
> It gives me high p value, though the median of A column is 6900 and B
> column is 3500.
>
> Why it gives p value high if there is a difference in the median?
>
> Regards
>
> [[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] A general question about using Bayes' Theorem for calculating the probability of The End of Human Technological Civilisation

2019-03-19 Thread Jeff Newmiller
Highly off topic. Try StackOverflow.

On March 19, 2019 10:42:24 AM PDT, Philip Rhoades  wrote:
>People,
>
>I have only a general statistics understanding and have never actually 
>used Bayes' Theorem for any real-world problem.  My interest lies in 
>developing some statistical approach for addressing the subject above 
>and it seems to me that BT is what I should be looking at?  However, 
>what I am specifically interested in is how such a work-up would be 
>developed for a year-on-year situation eg:
>
>I think it is likely that TEHTC could be triggered by a multi-gigaton 
>release of methane from the Arctic Ocean and the Siberian Permafrost in
>
>any Northern Hemisphere Summer from now on (multiple physical and 
>non-physical, human positive feedback loops would then kick in).
>
>So, say my estimate (Bayesian Prior) is that for this coming (2019) NHS
>
>the chance of this triggering NOT occurring is x%.  The manipulation is
>
>then done to calculate the posterior for 2019 - but for every
>successive 
>year (given the state of the world), isn't it true that the chance of a
>
>triggering NOT occurring in the NHS MUST go down? - ie it is just an 
>argument about the scale of the change from year to year?
>
>It seems to be that the posterior for one year becomes the prior for
>the 
>next year?  Once the prior gets small enough people won't bother with 
>the calculations anyway . .
>
>Does anyone know of any existing work on this topic?  I want to write a
>
>plain-English doc about it but I want to have the stats clear in my
>head 
>. .
>
>Thanks,
>
>Phil.

-- 
Sent from my phone. Please excuse my brevity.

__
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] A general question about using Bayes' Theorem for calculating the probability of The End of Human Technological Civilisation

2019-03-19 Thread David Winsemius
Actually the list is not moderated in the usual sense of the word. If 
you subscribe, your posts are not moderated. Only your first posting 
after subscription would be moderated, but for the purpose of preventing 
persons with obvious spamming goals.


And there are several different moderators. If I had seen that posting, 
I might have rejected it.


--

David.


On 3/19/19 11:06 AM, Evan Cooch wrote:
Just curious -- if R-help is a moderated list (which  in theory , it 
is -- my posts have been 'modertated', to the degree that they aren't 
released to the list until someone approves them), and if these 
'statistics discussion' questions are inappropriate to the mission (as 
described), then...why isn't the 'moderator' (him/her/they) blocking 
on submission?


On 3/19/2019 1:59 PM, David Winsemius wrote:
Rhelp is not a forum for discussions of statistics. Instead it is for 
persons who have specific questions about the use of R.


Please read the list info page where you started the subscription 
process. And do read the Posting Guide. Both these are linked at the 
bottom of this response.


There are Web accessible forums that are set up to statistics.



__
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] A general question about using Bayes' Theorem for calculating the probability of The End of Human Technological Civilisation

2019-03-19 Thread Marc Schwartz via R-help



> On Mar 19, 2019, at 2:06 PM, Evan Cooch  wrote:
> 
> Just curious -- if R-help is a moderated list (which  in theory , it is -- my 
> posts have been 'modertated', to the degree that they aren't released to the 
> list until someone approves them), and if these 'statistics discussion' 
> questions are inappropriate to the mission (as described), then...why isn't 
> the 'moderator' (him/her/they) blocking on submission?
> 
> On 3/19/2019 1:59 PM, David Winsemius wrote:
>> Rhelp is not a forum for discussions of statistics. Instead it is for 
>> persons who have specific questions about the use of R.
>> 
>> Please read the list info page where you started the subscription process. 
>> And do read the Posting Guide. Both these are linked at the bottom of this 
>> response.
>> 
>> There are Web accessible forums that are set up to statistics.
>> 
> 

Evan,

While I cannot speak for the R-Help moderators, which is a 'larger' group, I am 
a co-moderator for R-Devel.

The initial moderation occurs when someone who has not subscribed to the list 
sends a post. The list software captures the post and sends the moderators a 
notification that there is a post from a non-subscriber requiring manual review.

If the post is not relevant to the specific R list and should be sent to 
another R list, where it is better suited given the focus of the topic, the 
post will be rejected and the poster informed of the reason. If it is not truly 
R related, per se, then a recommendation to send the post to StackExchange or 
similar will be send back to the poster, with a rejection of the post.

Once a sender's e-mail account has been approved to post, which generally means 
that they have both subscribed to the list in question and have sent at least 
one relevant post to the list, future posts are typically no longer moderated.

It is possible that once in a while, a moderator will miss something in the 
post content and approve it going to the list, but that should be a rare event.

A search of the R-Help archives suggests that Philip has posted previously, 
going to back at least 2011, which is likely why this particular post managed 
to not be moderated.

Regards,

Marc Schwartz

__
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] Fwd: high p values

2019-03-19 Thread William Dunlap via R-help
Any reasonable test of whether two samples differ should be scale and
location invariant.  E.g., if you measure temperature it should not matter
if you units are degrees Fahrenheit or micro-Kelvins.  Thus saying the
medians are 3500 and 6200 is equivalent to saying they are 100.035 and
100.062: it does not tell use how different the samples are.  You need to
consider how much overlap there is.

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Tue, Mar 19, 2019 at 9:48 AM javed khan  wrote:

> Hi
>
> This is my function:
>
> wilcox.test(A,B, data = data, paired = FALSE)
>
> It gives me high p value, though the median of A column is 6900 and B
> column is 3500.
>
> Why it gives p value high if there is a difference in the median?
>
> Regards
>
> [[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] A general question about using Bayes' Theorem for calculating the probability of The End of Human Technological Civilisation

2019-03-19 Thread Evan Cooch
Just curious -- if R-help is a moderated list (which  in theory , it is 
-- my posts have been 'modertated', to the degree that they aren't 
released to the list until someone approves them), and if these 
'statistics discussion' questions are inappropriate to the mission (as 
described), then...why isn't the 'moderator' (him/her/they) blocking on 
submission?


On 3/19/2019 1:59 PM, David Winsemius wrote:
Rhelp is not a forum for discussions of statistics. Instead it is for 
persons who have specific questions about the use of R.


Please read the list info page where you started the subscription 
process. And do read the Posting Guide. Both these are linked at the 
bottom of this response.


There are Web accessible forums that are set up to statistics.



__
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] A general question about using Bayes' Theorem for calculating the probability of The End of Human Technological Civilisation

2019-03-19 Thread David Winsemius
Rhelp is not a forum for discussions of statistics. Instead it is for 
persons who have specific questions about the use of R.


Please read the list info page where you started the subscription 
process. And do read the Posting Guide. Both these are linked at the 
bottom of this response.


There are Web accessible forums that are set up to statistics.

--

David.

On 3/19/19 10:42 AM, Philip Rhoades wrote:

People,

I have only a general statistics understanding and have never actually 
used Bayes' Theorem for any real-world problem.  My interest lies in 
developing some statistical approach for addressing the subject above 
and it seems to me that BT is what I should be looking at?  However, 
what I am specifically interested in is how such a work-up would be 
developed for a year-on-year situation eg:


I think it is likely that TEHTC could be triggered by a multi-gigaton 
release of methane from the Arctic Ocean and the Siberian Permafrost 
in any Northern Hemisphere Summer from now on (multiple physical and 
non-physical, human positive feedback loops would then kick in).


So, say my estimate (Bayesian Prior) is that for this coming (2019) 
NHS the chance of this triggering NOT occurring is x%.  The 
manipulation is then done to calculate the posterior for 2019 - but 
for every successive year (given the state of the world), isn't it 
true that the chance of a triggering NOT occurring in the NHS MUST go 
down? - ie it is just an argument about the scale of the change from 
year to year?


It seems to be that the posterior for one year becomes the prior for 
the next year?  Once the prior gets small enough people won't bother 
with the calculations anyway . .


Does anyone know of any existing work on this topic?  I want to write 
a plain-English doc about it but I want to have the stats clear in my 
head . .


Thanks,

Phil.


__
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] A general question about using Bayes' Theorem for calculating the probability of The End of Human Technological Civilisation

2019-03-19 Thread Philip Rhoades

People,

I have only a general statistics understanding and have never actually 
used Bayes' Theorem for any real-world problem.  My interest lies in 
developing some statistical approach for addressing the subject above 
and it seems to me that BT is what I should be looking at?  However, 
what I am specifically interested in is how such a work-up would be 
developed for a year-on-year situation eg:


I think it is likely that TEHTC could be triggered by a multi-gigaton 
release of methane from the Arctic Ocean and the Siberian Permafrost in 
any Northern Hemisphere Summer from now on (multiple physical and 
non-physical, human positive feedback loops would then kick in).


So, say my estimate (Bayesian Prior) is that for this coming (2019) NHS 
the chance of this triggering NOT occurring is x%.  The manipulation is 
then done to calculate the posterior for 2019 - but for every successive 
year (given the state of the world), isn't it true that the chance of a 
triggering NOT occurring in the NHS MUST go down? - ie it is just an 
argument about the scale of the change from year to year?


It seems to be that the posterior for one year becomes the prior for the 
next year?  Once the prior gets small enough people won't bother with 
the calculations anyway . .


Does anyone know of any existing work on this topic?  I want to write a 
plain-English doc about it but I want to have the stats clear in my head 
. .


Thanks,

Phil.
--
Philip Rhoades

PO Box 896
Cowra  NSW  2794
Australia
E-mail:  p...@pricom.com.au

__
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] Fwd: high p values

2019-03-19 Thread S Ellison
> This is my function:
> 
> wilcox.test(A,B, data = data, paired = FALSE)
> 
> It gives me high p value, though the median of A column is 6900 and B
> column is 3500.
> 
> Why it gives p value high if there is a difference in the median?

Perhaps becuase a) because you are testing the wrong data or b) there isn't a 
significant difference 

a) You are probably not using the data you think you are. Check ?wilcox.test; 
the 'data' argument is specific to the formula method. That needs a formula as 
the first argument, not a numeric vector. What you've done is apply the 
default, and 'data' has been ignored. So A and B are whatever was lying around 
in your current environment, not what is in 'data'.  ('data' is a terrible name 
for a data frame, by the way, as 'data' is an R function). 

After that:
- How many data points do you have in each group?
- How much do the two groups overlap?

If the answers are 'not many' or 'lots' (in that order), and especially if both 
apply, you can't expect a significant test result.

S Ellison


***
This email and any attachments are confidential. Any use...{{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.


Re: [R] looking for 'tied rows' in dataframe

2019-03-19 Thread Evan Cooch
Good suggestion, and for my purposes, will solve the problem. Thanks!

On 3/18/2019 12:37 PM, Ben Tupper wrote:
> Hi,
>
> Might you replaced 'T' with a numeric value that signals the TRUE case 
> without rumpling your matrix?  0 might be a good choice as it is never an 
> index for a 1-based indexing system.
>
> hold=apply(test,1,which.max)
> hold[apply(test,1,isUnique)==FALSE] <- 0
> hold
> [1] 1 2 0
>   
>
>
>> On Mar 17, 2019, at 8:17 PM, Evan Cooch  wrote:
>>
>> Solved --
>>
>> hold=apply(test,1,which.max)
>>  hold[apply(test,1,isUnique)==FALSE] <- 'T'
>>
>> Now, all I need to do is figure out how to get <- 'T' from turning 
>> everything in the matrix to a string.
>>
>>
>> On 3/17/2019 8:00 PM, Evan Cooch wrote:
>>> Got relatively close - below:
>>>
>>> On 3/17/2019 7:39 PM, Evan Cooch wrote:
 Suppose I have the following sort of structure:

 test <- matrix(c(2,1,1,2,2,2),3,2,byrow=T)

 What I need to be able to do is (i) find the maximum value for each row, 
 (ii) find the column containing the max, but (iii) if the maximum value is 
 a tie (in this case, all numbers of the row are the same value), then I 
 want which.max (presumably, a tweaked version of what which.max does) to 
 reurn a T for the row where all values are the same.

 Parts (i) and (ii) seem easy enough:

 apply(test,1,max)  --- gives me the maximum values
 apply(test,1,which.max) --- gives me the column

 But, standard which.max doesn't handles ties/duplicates in a way that 
 serves my need. It defaults to returning the first column containing the 
 maximum value.

 What I'd like to end up with is, ultimately, something where 
 apply(test,1,which.max) yields 1,2,T  (rather than 1,2,1).

 So, a function which does what which.max currently does if the elements of 
 the row differ, but which returns a T (or some such) if in fact the row 
 values are all the same.

 I've tried a bunch of things, to know avail. Closest I got was to use a 
 function to test for whether or not a vector

 isUnique <- function(vector){
   return(!any(duplicated(vector)))
  }

 which returns TRUE if values of vector all unique. So

 apply(test,1,isUnique)

 returns

 [1]  TRUE  TRUE FALSE

 but I'm stuck beyond this.
>>> The following gets me pretty close,
>>>
>>> test_new <- test
>>> test_new[which(apply(test,1,isUnique)==FALSE),] <- 'T'
>>>
>>> but is clunky.
>>>
>>>
>>>
>>>
>>>
>>>
>> __
>> 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.
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
>
> Ecological Forecasting: https://eco.bigelow.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] Fwd: high p values

2019-03-19 Thread Patrick (Malone Quantitative)
We've had this conversation.

A) This is off-topic for R-Help. Your question is about the statistical test, 
not about the R coding.

B) A difference in sample statistics, whether or not it "looks" large, is not 
sufficient for statistical significance.

On 3/19/19, 12:48 PM, "R-help on behalf of javed khan" 
 wrote:

Hi

This is my function:

wilcox.test(A,B, data = data, paired = FALSE)

It gives me high p value, though the median of A column is 6900 and B
column is 3500.

Why it gives p value high if there is a difference in the median?

Regards

[[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] Fwd: high p values

2019-03-19 Thread javed khan
Hi

This is my function:

wilcox.test(A,B, data = data, paired = FALSE)

It gives me high p value, though the median of A column is 6900 and B
column is 3500.

Why it gives p value high if there is a difference in the median?

Regards

[[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 with sitar growth model

2019-03-19 Thread Rayt Chiruka
I want to obtain the individual biological parameters (ie age at takeoff,
final height velocity at takeoff) after a sitar model. (I do understand a
sitar model fits a mean curve for the population).

I have managed to obtain the parameters for one individual using the code
below,

  library(sitar)
  data(heights)
  library(tidyverse)

  m1 <- sitar(x=age, y=height, id=id, data=heights, df=5)

  #velocity at takeoff for individual 1

 (vel_attoff<-getPeakTrough(plot_v(m1, subset=age < 14 &id==1) ,
peak=FALSE))

What I want is to produce a dataframe with the id and the velocity at
takeoff for each individual in the dataset.
I have tried to do this

  for (i in seq_along(heights[1])){
   print(getPeakTrough(plot_v(m1, subset=age < 14 & id==i) ,
peak=FALSE))
}

But it prints only one x and y  value

Any assistance will be greatly appreciated

-- 
R T CHIRUKA
University of Fort Hare
Statistics Department
Box X 1314
Alice
5700
South Africa

[[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] Obtaining individual parameters from a sitar growth model.

2019-03-19 Thread Rayt Chiruka
I want to obtain the individual biological parameters (ie age at takeoff,
final height velocity at takeoff) after a sitar model. (I do understand a
sitar model fits a mean curve for the population).



I have managed to obtain the parameters for one individual using the code
below,





library(sitar)

data(heights)

library(tidyverse)

m1 <- sitar(x=age, y=height, id=id, data=heights, df=5)



#velocity at takeoff for individual 1



(vel_attoff<-getPeakTrough(plot_v(m1, subset=age < 14 & id==1) ,
peak=FALSE))





What I want is to produce a dataframe with the id and the velocity at
takeoff for each individual in the dataset.



I have tried to do this



for (i in seq_along(heights[1])){

print(getPeakTrough(plot_v(m1, subset=age < 14 & id==i) ,
peak=FALSE))

}



But it prints only one x and y  value



Any assistance will be greatly appreciated.


-- 
R T CHIRUKA
University of Fort Hare
Statistics Department
Box X 1314
Alice
5700
South Africa

[[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] ?grid::grid-package doesn't find the grid-package help page

2019-03-19 Thread William Sones
Wow! I've never come across this approach before. This will keep me reading for 
a good few days. 

Thanks Duncan!

-Original Message-
From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] 
Sent: 18 March 2019 19:45
To: Jeff Newmiller ; r-help@r-project.org; William 
Sones 
Subject: Re: [R] ?grid::grid-package doesn't find the grid-package help page

On 18/03/2019 1:00 p.m., Jeff Newmiller wrote:
> Try
> 
> ?grid::`grid-package`
> 
> The "-" is not a legal character in a bare symbol.

Or

package?grid::grid

which makes use of the rarely used "type" argument to "?".

Duncan Murdoch

> 
> On March 18, 2019 9:35:17 AM PDT, William Sones 
>  wrote:
>> Hi
>>
>> I've entered the command "?grid::grid-package" on two computers over 
>> here and they both direct me to the Arithmetic {base} site 
>> (http://127.0.0.1:30753/library/base/html/Arithmetic.html).
>>
>> Shouldn't this command direct me to the grid-package {grid} site 
>> (something like 
>> https://stat.ethz.ch/R-manual/R-devel/library/grid/html/grid-package.html)?
>>
>> This has been performed on R versions 3.5.2 and 3.5.3 (Windows).
>>
>> I couldn't find mention of this in Bugzilla, so thought it best to 
>> confirm whether this warrants documentation as a bug, or whether 
>> alternative methods are preferred for addressing similar (minor) 
>> issues.
>>
>> Thanks
>>
>> Will
>>
>> William Sones
>> Medical Statistician
>>
>> Email:
>> william.so...@ndorms.ox.ac.uk
>> Tel: 01865 227887
>>
>> Oxford Clinical Trials Research Unit
>> Botnar Research Centre
>> Nuffield Department of Orthopaedics, Rheumatology & Musculoskeletal 
>> Sciences University of Oxford Windmill Road Oxford, OX3 7LD
>>
>>
>>  [[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] Fw: problem with nlsLM function

2019-03-19 Thread akshay kulkarni
Dear duncan,
Sorry to bother you with such a silly mistake I 
didn,t notice it!
Sent: Tuesday, March 19, 2019 6:01 PM
To: akshay kulkarni; R help Mailing list
Subject: Re: [R] Fw: problem with nlsLM function

On 19/03/2019 8:26 a.m., akshay kulkarni wrote:
>
> dear members,
>  also,I can provide HM1,HM2 and HM3 if needed
>
> 
> From: R-help  on behalf of akshay kulkarni 
> 
> Sent: Tuesday, March 19, 2019 5:43 PM
> To: R help Mailing  list
> Subject: [R] problem with nlsLM function
>
> dear members,
>  I am getting the "singular gradient error" when I use 
> nls for a function of two variables:
>> formulaDH5
> HM1 ~ (a + (b * ((HM2 + 0.3)^(1/2 + (A * sin(w * HM3 + a) +
>  C)
>
> HM1 is the response variable, and HM2 and HM3 are predictors.
>
> The problem is I get the same error even when I use nlsLM(in the minpack.lm 
> package):
>
>> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 0.43143, b = 2,A = 
>> 0.09,w = 0.8,a = 0.01,C = 0.94))

You have "a" twice in your start list.  That's bound to cause trouble...

Duncan Murdoch


> Error in nlsModel(formula, mf, start, wts) :
>singular gradient matrix at initial parameter estimates
>> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 1, b = 2,A = 0.09,w = 
>> 0.8,a = 0.01,C = 0.94))
> Error in nlsModel(formula, mf, start, wts) :
>singular gradient matrix at initial parameter estimates
>> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 1, b = 2,A = 0.09,w = 
>> 0.8,a = 0.01,C = 2))
> Error in nlsModel(formula, mf, start, wts) :
>singular gradient matrix at initial parameter estimates
>
> I came to know that nlsLM converges when nls throws a singular gradient 
> error. What is happening above? Can the problem get  solved if I use nls.lm 
> function(in the minpack.lm package) instead?
>
> very many thanks for your time and effort
> yours sincerely,
> AKSHAY M KULKARNI
>
>  [[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.
>


[[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] Fw: problem with nlsLM function

2019-03-19 Thread Duncan Murdoch

On 19/03/2019 8:26 a.m., akshay kulkarni wrote:


dear members,
 also,I can provide HM1,HM2 and HM3 if needed


From: R-help  on behalf of akshay kulkarni 

Sent: Tuesday, March 19, 2019 5:43 PM
To: R help Mailing  list
Subject: [R] problem with nlsLM function

dear members,
 I am getting the "singular gradient error" when I use nls 
for a function of two variables:

formulaDH5

HM1 ~ (a + (b * ((HM2 + 0.3)^(1/2 + (A * sin(w * HM3 + a) +
 C)

HM1 is the response variable, and HM2 and HM3 are predictors.

The problem is I get the same error even when I use nlsLM(in the minpack.lm 
package):


nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 0.43143, b = 2,A = 0.09,w = 
0.8,a = 0.01,C = 0.94))


You have "a" twice in your start list.  That's bound to cause trouble...

Duncan Murdoch



Error in nlsModel(formula, mf, start, wts) :
   singular gradient matrix at initial parameter estimates

nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 1, b = 2,A = 0.09,w = 0.8,a 
= 0.01,C = 0.94))

Error in nlsModel(formula, mf, start, wts) :
   singular gradient matrix at initial parameter estimates

nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 1, b = 2,A = 0.09,w = 0.8,a 
= 0.01,C = 2))

Error in nlsModel(formula, mf, start, wts) :
   singular gradient matrix at initial parameter estimates

I came to know that nlsLM converges when nls throws a singular gradient error. 
What is happening above? Can the problem get  solved if I use nls.lm 
function(in the minpack.lm package) instead?

very many thanks for your time and effort
yours sincerely,
AKSHAY M KULKARNI

 [[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-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] problem with nlsLM function

2019-03-19 Thread akshay kulkarni
dear members,
I am getting the "singular gradient error" when I use nls 
for a function of two variables:
> formulaDH5
HM1 ~ (a + (b * ((HM2 + 0.3)^(1/2 + (A * sin(w * HM3 + a) +
C)

HM1 is the response variable, and HM2 and HM3 are predictors.

The problem is I get the same error even when I use nlsLM(in the minpack.lm 
package):

> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 0.43143, b = 2,A = 0.09,w 
> = 0.8,a = 0.01,C = 0.94))
Error in nlsModel(formula, mf, start, wts) :
  singular gradient matrix at initial parameter estimates
> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 1, b = 2,A = 0.09,w = 
> 0.8,a = 0.01,C = 0.94))
Error in nlsModel(formula, mf, start, wts) :
  singular gradient matrix at initial parameter estimates
> nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 1, b = 2,A = 0.09,w = 
> 0.8,a = 0.01,C = 2))
Error in nlsModel(formula, mf, start, wts) :
  singular gradient matrix at initial parameter estimates

I came to know that nlsLM converges when nls throws a singular gradient error. 
What is happening above? Can the problem get  solved if I use nls.lm 
function(in the minpack.lm package) instead?

very many thanks for your time and effort
yours sincerely,
AKSHAY M KULKARNI

[[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] data frame solution

2019-03-19 Thread Andras Farkas via R-help
Hello All,

wonder if you have thoughts on a clever solution for this code:



df       <- data.frame(a = c(6,1), b = c(1000,1200), c =c(-1,3)) 

#the caveat here is that the number of rows for df can be anything from 1 row 
to in the hundreds. I kept it to 2 to have minimal reproducible

t<-seq(-5,24,0.1) #min(t) will always be <=df$c[1], which is the value that is 
always going to equal to min(df$c)

times1 <- c(rbind(df$c[1],df$c[1]+df$a[1]),max(t)) #length of times1 will 
always be 3, see times2 is of length 4

input1   <- c(rbind(df$b[1]/df$a[1],rep(0,length(df$b[1]))),0) #length of 
input1 will always be 3, see input2 is of length 4

out1 
<-data.frame(t,ifelse(t>=times1[1]&t=times1[2]&t=times2[1]&t=times2[2]&t=times2[3]&thttps://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.