Re: [R] Changing sign of columns and values

2022-06-11 Thread Jim Lemon
Hi Hana,
I didn't look closely. The simplest rule that I can see is that the
letters (nucleotides?) should be swapped if there has been a sign
change in the beta value. Therefore:

mydf<-read.table(text=
"IDnumber  OA  EA  beta
1   C   A   -0.05
2   GA0.098
3   GT-0.789",
header=TRUE,stringsAsFactors=FALSE)
# logical vector marking the rows to be swapped
swap_letters<-mydf$beta < 0
# save the OA values to be swapped
newEA<-mydf$OA[swap_letters]
# change the OAs to EAs
mydf$OA[swap_letters]<-mydf$EA[swap_letters]
# set the relevant EA values to the old OA values
mydf$EA[swap_letters]<-newEA
# change the beta values
mydf$beta<-abs(mydf$beta)
mydf

Jim



On Sun, Jun 12, 2022 at 9:11 AM hanatezera  wrote:
>
> Dear jim thanks for your help! I want to change also the value of OA and EF 
> simultaneously.
> For instance i am looking the data
> mydf
> IDnumber OA EA  beta
> 11  A  C  0.050
> 22  G  A 0.098
> 33  T   G 0.789
>
> Best,
> Hana
>
>
>
>  Original message 
> From: Jim Lemon 
> Date: 6/12/22 1:59 AM (GMT+03:00)
> To: hanatezera , r-help mailing list 
> 
> Subject: Re: [R] Changing sign of columns and values
>
> Hi Hana,
> I think this is what you want:
>
> # first read in your example
> mydf<-read.table(text=
> "IDnumber  OA  EA  beta
> 1   C   A   -0.05
> 2   GA0.098
> 3   GT-0.789",
> header=TRUE,stringsAsFactors=FALSE)
> # check it
> mydf
> IDnumber OA EA   beta
> 11  C  A -0.050
> 22  G  A  0.098
> 33  G  T -0.789
> # change values of mydf$beta to absolute values
> mydf$beta<-abs(mydf$beta)
> mydf
> IDnumber OA EA  beta
> 11  C  A 0.050
> 22  G  A 0.098
> 33  G  T 0.789
>
> Jim
>
> On Sun, Jun 12, 2022 at 8:27 AM hanatezera  wrote:
> >
> > I have the following data set in data frameIDnumber  OA  EA  beta1  
> >C   A   -0.052 GA
> > 0.0983  GT-0.789I want to 
> > change the sign of negative beta. If the negative value change to postive i 
> > want to switch its EA and OA.My desire result will beIDnumber  OA  EA  
> > beta1 A  C 0.052 G  
> >   A0.0983  T G
> > 0.789Any one can help me with r codes? kind regards,Hana
> > [[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] How to do non-parametric calculations in R

2022-06-11 Thread Tom Woolman
Imagine that it's the year 2022 and you don't know how to look up 
information about performing a Kruskal-Wallis H test.


 It would take you longer to join the listserv and then write such a 
cokamemie email than to open the stats textbook you are supposed to have 
for the course, much less doing a simple search query.



On 2022-06-11 19:19, Ebert,Timothy Aaron wrote:

LOL. Thank goodness I successfully rolled my saving throw and
resisted, at least for this round.
Tim

-Original Message-
From: R-help  On Behalf Of Jeff Newmiller
Sent: Saturday, June 11, 2022 5:27 PM
To: r-help@r-project.org; J C Nash 
Subject: Re: [R] How to do non-parametric calculations in R

[External Email]

Really? But it is such a random list that I thought it was a test of
our ability to resist providing impromptu lectures on off-list-topics,
since we all like to expound on "stuff" even when R isn't needed to
understand them. Or perhaps "A R Lover" just didn't read the Posting
Guide warnings about HTML email, homework, and statistics, and will
soon have done do and be sharing some R code that is giving them an
error.

On June 11, 2022 1:53:37 PM PDT, J C Nash  wrote:

Homework!

On 2022-06-11 10:24, Shantanu Shimpi wrote:

Dear R community,

Please help me in knowing how to do following non-parametric tests:

1.  kruskal-Wallis test
2.  Wilcoxson rank sum test
3.  Lee Cronbac Alpha test
4.  Spearman's Rank correlation test
5.  Henry Garrett method formula calculations
6.  Factor Analysis
7.  Chi square test

Kindly guide me on the above queries in the easiest way.

A R lover,
Col Shantanu.
India.
attitudeshantanu1...@gmail.com

7722030088

 [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mai
lman_listinfo_r-2Dhelp=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVe
AsRzsn7AkP-g=4tM4fJqtbe_uTsyPRnMDpR560AlVh83t9wmvJuUPvfsciEQhPSY5Yb
F8c2Lixwy8=zhlVVKEML3MeOEdjlR2Z1gqYLVcrE0gpEiFPdo0MxNg=
PLEASE do read the posting guide
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.o
rg_posting-2Dguide.html=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kV
eAsRzsn7AkP-g=4tM4fJqtbe_uTsyPRnMDpR560AlVh83t9wmvJuUPvfsciEQhPSY5Y
bF8c2Lixwy8=IRGFPuDAXZu6xEr36GrRy5jeXkI0D62fDLt-FxbIqBs=
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailm
an_listinfo_r-2Dhelp=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeAsRz
sn7AkP-g=4tM4fJqtbe_uTsyPRnMDpR560AlVh83t9wmvJuUPvfsciEQhPSY5YbF8c2Li
xwy8=zhlVVKEML3MeOEdjlR2Z1gqYLVcrE0gpEiFPdo0MxNg=
PLEASE do read the posting guide
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org
_posting-2Dguide.html=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeAsR
zsn7AkP-g=4tM4fJqtbe_uTsyPRnMDpR560AlVh83t9wmvJuUPvfsciEQhPSY5YbF8c2L
ixwy8=IRGFPuDAXZu6xEr36GrRy5jeXkI0D62fDLt-FxbIqBs=
and provide commented, minimal, self-contained, reproducible code.


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

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeAsRzsn7AkP-g=4tM4fJqtbe_uTsyPRnMDpR560AlVh83t9wmvJuUPvfsciEQhPSY5YbF8c2Lixwy8=zhlVVKEML3MeOEdjlR2Z1gqYLVcrE0gpEiFPdo0MxNg=
PLEASE do read the posting guide
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html=DwICAg=sJ6xIWYx-zLMB3EPkvcnVg=9PEhQh2kVeAsRzsn7AkP-g=4tM4fJqtbe_uTsyPRnMDpR560AlVh83t9wmvJuUPvfsciEQhPSY5YbF8c2Lixwy8=IRGFPuDAXZu6xEr36GrRy5jeXkI0D62fDLt-FxbIqBs=
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-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Changing sign of columns and values

2022-06-11 Thread hanatezera
Dear jim thanks for your help! I want to change also the value of OA and EF 
simultaneously.For instance i am looking the datamydf IDnumber OA EA  beta1 
   1  A  C  0.0502    2  G  A 0.0983    3  T   G 0.789Best, Hana        
         
 Original message From: Jim Lemon  Date: 
6/12/22  1:59 AM  (GMT+03:00) To: hanatezera , r-help 
mailing list  Subject: Re: [R] Changing sign of columns 
and values Hi Hana,I think this is what you want:# first read in your 
examplemydf<-read.table(text="IDnumber  OA  EA  beta1   C   A   -0.052  
 G    A    0.0983   G    T    
-0.789",header=TRUE,stringsAsFactors=FALSE)# check itmydf IDnumber OA EA   
beta1    1  C  A -0.0502    2  G  A  0.0983    3  G  T -0.789# 
change values of mydf$beta to absolute valuesmydf$beta<-abs(mydf$beta)mydf 
IDnumber OA EA  beta1    1  C  A 0.0502    2  G  A 0.0983    3  G  
T 0.789JimOn Sun, Jun 12, 2022 at 8:27 AM hanatezera  
wrote:>> I have the following data set in data frameIDnumber  OA  EA  beta1 
    C   A   -0.052 G    A   
 0.0983  G    T    -0.789I want to 
change the sign of negative beta. If the negative value change to postive i 
want to switch its EA and OA.My desire result will beIDnumber  OA  EA  beta1
 A  C 0.052 G    A  
  0.0983  T G    0.789Any one can help 
me with r codes? kind regards,Hana> [[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] Changing sign of columns and values

2022-06-11 Thread Jim Lemon
Hi Hana,
I think this is what you want:

# first read in your example
mydf<-read.table(text=
"IDnumber  OA  EA  beta
1   C   A   -0.05
2   GA0.098
3   GT-0.789",
header=TRUE,stringsAsFactors=FALSE)
# check it
mydf
 IDnumber OA EA   beta
11  C  A -0.050
22  G  A  0.098
33  G  T -0.789
# change values of mydf$beta to absolute values
mydf$beta<-abs(mydf$beta)
mydf
 IDnumber OA EA  beta
11  C  A 0.050
22  G  A 0.098
33  G  T 0.789

Jim

On Sun, Jun 12, 2022 at 8:27 AM hanatezera  wrote:
>
> I have the following data set in data frameIDnumber  OA  EA  beta1
>  C   A   -0.052 GA
> 0.0983  GT-0.789I want to change 
> the sign of negative beta. If the negative value change to postive i want to 
> switch its EA and OA.My desire result will beIDnumber  OA  EA  beta1  
>A  C 0.052 GA
> 0.0983  T G0.789Any one can help 
> me with r codes? kind regards,Hana
> [[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] Changing sign of columns and values

2022-06-11 Thread Bert Gunter
This is a plain text list. Your html post got mangled (see below). You
are more likely to get a useful response if you follow the posting
guide (linked below) and post in plain text.

Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Sat, Jun 11, 2022 at 3:27 PM hanatezera  wrote:
>
> I have the following data set in data frameIDnumber  OA  EA  beta1
>  C   A   -0.052 GA
> 0.0983  GT-0.789I want to change 
> the sign of negative beta. If the negative value change to postive i want to 
> switch its EA and OA.My desire result will beIDnumber  OA  EA  beta1  
>A  C 0.052 GA
> 0.0983  T G0.789Any one can help 
> me with r codes? kind regards,Hana
> [[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] Changing sign of columns and values

2022-06-11 Thread hanatezera
I have the following data set in data frameIDnumber  OA  EA  beta1              
           C       A       -0.052                         G        A        
0.0983                          G        T        -0.789I want to change 
the sign of negative beta. If the negative value change to postive i want to 
switch its EA and OA.My desire result will beIDnumber  OA  EA  beta1            
             A      C     0.052                         G        A        
0.0983                          T         G        0.789Any one can help me 
with r codes? kind regards,Hana
[[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] How to do non-parametric calculations in R

2022-06-11 Thread J C Nash

Homework!

On 2022-06-11 10:24, Shantanu Shimpi wrote:

Dear R community,

Please help me in knowing how to do following non-parametric tests:

1.  kruskal-Wallis test
2.  Wilcoxson rank sum test
3.  Lee Cronbac Alpha test
4.  Spearman's Rank correlation test
5.  Henry Garrett method formula calculations
6.  Factor Analysis
7.  Chi square test

Kindly guide me on the above queries in the easiest way.

A R lover,
Col Shantanu.
India.
attitudeshantanu1...@gmail.com

7722030088

[[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] Interpreting the result of a model with random effects

2022-06-11 Thread Mitchell Maltenfort
Looks like the center effect improves overall accuracy while being
independent of the other terms.

A few things to try

Compare coef(model.fix) to fixef(model.rand).

Add center as a fixed effect to model .fix

Try a conditional logit (clogit from survival)

See how consistent the coefficients are





On Sat, Jun 11, 2022 at 11:14 AM Frank S.  wrote:

> Dear R users,
>
>  I'm analyzing a particular score "y" among several individuals, each of
> which belongs to a center, a factor with three
> different levels (3 possible centers). I have treated the "center" as a
> fixed effect, and as a random term (package lme4):
>
> 1) model.fix <- glm(y ~ var.1 + var.2 + var.3 + var.4 + var.5 + center,
> family = "binomial", data = dat)
> 2) model.rand <- glmer(y ~ var.1 + var.2 + var.3 + var.4 + var.5 + (1 |
> center), family = "binomial", data = dat)
>
> The issue is that both models provide exactly the same coefficients and
> p-values for the 5 baseline variables, so I assumed
> that it was due to the small number of levels (in fact,  too few ).
> However, when computing anova(model.rand, model.fix),
> the output indicates a p-value < 0.001 in favour of the "model.rand".
> What's happening? Should I take the random terms?
>
> Thanks for any help!
>
> Frank S.
>
> [[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.
>
-- 
Sent from Gmail Mobile

[[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] Interpreting the result of a model with random effects

2022-06-11 Thread Frank S .
Dear R users,

 I'm analyzing a particular score "y" among several individuals, each of which 
belongs to a center, a factor with three
different levels (3 possible centers). I have treated the "center" as a fixed 
effect, and as a random term (package lme4):

1) model.fix <- glm(y ~ var.1 + var.2 + var.3 + var.4 + var.5 + center, family 
= "binomial", data = dat)
2) model.rand <- glmer(y ~ var.1 + var.2 + var.3 + var.4 + var.5 + (1 | 
center), family = "binomial", data = dat)

The issue is that both models provide exactly the same coefficients and 
p-values for the 5 baseline variables, so I assumed
that it was due to the small number of levels (in fact,  too few ). However, 
when computing anova(model.rand, model.fix),
the output indicates a p-value < 0.001 in favour of the "model.rand". What's 
happening? Should I take the random terms?

Thanks for any help!

Frank S.

[[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] igraph: layout help

2022-06-11 Thread Rui Barradas

Hello,

The code below is a hack.
First I create a layout ll, then see that vertex K coordinates are in 
the layout matrix 2nd row.


Now, to multiply K's coordinates by a number d>1 will move the point 
away from A. Add that value to the K group and plot.



ll <- layout_with_kk(my.graph)
d <- ll[2, ]*5
ll[c(2, 9:11), ] <- t(t(ll[c(2, 9:11), ]) + d)

plot(my.graph, layout = ll)


Hope this helps,

Rui Barradas

Às 19:20 de 10/06/2022, Brian Smith escreveu:

Hi,

I was trying to make a network plot of this data:


library(igraph)
library(network)

df1 <- data.frame(from="A",to=c("B","C","D","E","F","G"),value=1)
df2 <- data.frame(from="K",to=c("L","M","N"),value=1)
df3 <- data.frame(from="A",to="K",value=3)
my.df <- rbind(df1,df2,df3)

my.graph <- graph_from_data_frame(my.df,directed = F)
plot(my.graph)


What I wanted was for nodes A to G to be very close together (touching each
other). Similarly, nodes K to N should be very close together. The
connecting edge (A to K) between these sets of points/vertices should be
the only edge visible. How should I go about doing this?

Also, how can I change the parameters (node label, node color, etc.) of the
graph?

Any help or link to documentation would be helpful. Or would

thanks!

[[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] A humble request regarding QAMG method in R

2022-06-11 Thread Muhammad Zubair Chishti
Hi, Dear Respected Professors! I hope that you are doing well. Now all
files are in .txt files. Now kindly help me with the following:

I have the R-codes for the "Quantile Augmented Mean Group" method. The
relevant codes and data are attached herewith.
Note: The link to the reference paper is:
https://www.econ.cam.ac.uk/people-files/emeritus/mhp1/fp20/qmg40-rev21.pdf
My Issue:
When I run the given codes to estimate the results for my own data. I have
to face several errors. I humbly request the experts to help me to estimate
the results for my data.
Thank you so much for your precious time.

Regards

Muhammad Zubair Chishti
Ph.D. Student
School of Business,
Zhengzhou University, Henan, China.
My Google scholar link:
https://scholar.google.com/citationshl=en=YPqNJMwJ
My ResearchGate link: https://www.researchgate.net/profile/Muhammad-Chishti
__
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] igraph: layout help

2022-06-11 Thread Brian Smith
Hi,

I was trying to make a network plot of this data:


library(igraph)
library(network)

df1 <- data.frame(from="A",to=c("B","C","D","E","F","G"),value=1)
df2 <- data.frame(from="K",to=c("L","M","N"),value=1)
df3 <- data.frame(from="A",to="K",value=3)
my.df <- rbind(df1,df2,df3)

my.graph <- graph_from_data_frame(my.df,directed = F)
plot(my.graph)


What I wanted was for nodes A to G to be very close together (touching each
other). Similarly, nodes K to N should be very close together. The
connecting edge (A to K) between these sets of points/vertices should be
the only edge visible. How should I go about doing this?

Also, how can I change the parameters (node label, node color, etc.) of the
graph?

Any help or link to documentation would be helpful. Or would

thanks!

[[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.