Re: [R] Package 'coin' - How to extract rho
On Wed, 29 Apr 2020, Blume Christine wrote: Dear Achim, Many thanks indeed. Yes, I had thought about this too and, fortunately, the bootstrapping confirms the results from the "normal" test. However, I was wondering whether it is mathematically acceptable to report the pvals from bootstrapping, but non-bootstrapped correlation coefficients. Does someone have an opinion on this? First, coin doesn't do bootstrapping tests, it does permutation tests. Second, reporting the rho coefficient from the original sample is surely ok, no matter whether you used a bootstrap test, unconditional asymptotic test, or permutation test. At least I wouldn't see any reason, not to do so. Best, Z -Ursprüngliche Nachricht- Von: Achim Zeileis Gesendet: Mittwoch, 29. April 2020 13:56 An: Blume Christine Cc: Jim Lemon ; torsten.hoth...@uzh.ch; r-help@r-project.org Betreff: Re: [R] Package 'coin' - How to extract rho Christine, thanks for the example. As far as I can see, the "coin" package does not explicitly compute Spearman's rho. This is probably also the reason why it isn't reported in the test output. Thus, you would have to do this "by hand" using cor(..., method = "spearman"). Hope that helps, Achim On Wed, 29 Apr 2020, Blume Christine wrote: Dear Jim, Many thanks for following up on this. Sure, I can provide a sample code. At the end of the code you see that I extract the p-value and the test statistic. However, I cannot find the correlation coefficient rho anywhere in the object “r”. Best, Christine if(!require(pacman)) install.packages("pacman") pacman::p_load(sn, fGarch, coin) # Happiness central_tendency_sim <- 0 dispersion_sim <- 1 skewness_sim <- 1.5 N_sim <- 1 Happiness <- seq(from = 0, to = 10, length.out = N_sim) # City size central_tendency_sim <- 3 dispersion_sim <- 1 skewness_sim <- 1.5 Citysize <- seq(from = 1, to = 5, length.out = N_sim) # create dataframe datastat <- data.frame(Happiness, Citysize) # Bootstrapped correlation r <- spearman_test(Happiness ~ Citysize, data = datastat, distribution = "approximate", alternative = c("two.sided")) r pvalue(r) statistic(r) -Ursprüngliche Nachricht- Von: Jim Lemon Gesendet: Mittwoch, 29. April 2020 05:53 An: Blume Christine Cc: r-help@r-project.org Betreff: Re: [R] Package 'coin' - How to extract rho Hi Christine, I noticed that your question did not receive a reply. As I don't know exactly what you have tried, it is a bit difficult to suggest a solution. If you are still unable to get this to work, could you provide an example of your present code and data if necessary? Jim On Mon, Apr 27, 2020 at 3:09 AM Blume Christine mailto:christine.bl...@sbg.ac.at>> wrote: I am using the 'coin' package to compute bootstrapped correlations. I am able to extract the p-value with confidence intervals as well as the test statistic Z. However, I am unable to find rho, i.e. the correlation coefficient. Can someone help? Kind regards, Christine [[alternative HTML version deleted]] __ R-help@r-project.org<mailto: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.
Re: [R] Package 'coin' - How to extract rho
Dear Achim, Many thanks indeed. Yes, I had thought about this too and, fortunately, the bootstrapping confirms the results from the "normal" test. However, I was wondering whether it is mathematically acceptable to report the pvals from bootstrapping, but non-bootstrapped correlation coefficients. Does someone have an opinion on this? Best, Christine -Ursprüngliche Nachricht- Von: Achim Zeileis Gesendet: Mittwoch, 29. April 2020 13:56 An: Blume Christine Cc: Jim Lemon ; torsten.hoth...@uzh.ch; r-help@r-project.org Betreff: Re: [R] Package 'coin' - How to extract rho Christine, thanks for the example. As far as I can see, the "coin" package does not explicitly compute Spearman's rho. This is probably also the reason why it isn't reported in the test output. Thus, you would have to do this "by hand" using cor(..., method = "spearman"). Hope that helps, Achim On Wed, 29 Apr 2020, Blume Christine wrote: > Dear Jim, > > > > Many thanks for following up on this. Sure, I can provide a sample code. At > the end of the code you see that I extract the p-value and the test > statistic. However, I cannot find the correlation coefficient rho anywhere in > the object “r”. > > > > Best, > > Christine > > > > if(!require(pacman)) install.packages("pacman") > > pacman::p_load(sn, fGarch, coin) > > > > # Happiness > > central_tendency_sim <- 0 > > dispersion_sim <- 1 > > skewness_sim <- 1.5 > > > > N_sim <- 1 > > > > Happiness <- seq(from = 0, > > to = 10, > > length.out = N_sim) > > > > # City size > > central_tendency_sim <- 3 > > dispersion_sim <- 1 > > skewness_sim <- 1.5 > > > > Citysize <- seq(from = 1, > >to = 5, > >length.out = N_sim) > > > > # create dataframe > > datastat <- data.frame(Happiness, Citysize) > > > > # Bootstrapped correlation > > r <- spearman_test(Happiness ~ Citysize, data = datastat, distribution > = "approximate", alternative = c("two.sided")) > > r > > pvalue(r) > > statistic(r) > > > > > > -Ursprüngliche Nachricht- > Von: Jim Lemon > Gesendet: Mittwoch, 29. April 2020 05:53 > An: Blume Christine > Cc: r-help@r-project.org > Betreff: Re: [R] Package 'coin' - How to extract rho > > > > Hi Christine, > > I noticed that your question did not receive a reply. As I don't know exactly > what you have tried, it is a bit difficult to suggest a solution. If you are > still unable to get this to work, could you provide an example of your > present code and data if necessary? > > > > Jim > > > > On Mon, Apr 27, 2020 at 3:09 AM Blume Christine > mailto:christine.bl...@sbg.ac.at>> wrote: > >> > >> I am using the 'coin' package to compute bootstrapped correlations. I am >> able to extract the p-value with confidence intervals as well as the test >> statistic Z. However, I am unable to find rho, i.e. the correlation >> coefficient. Can someone help? > >> > >> Kind regards, > >> Christine > >> > >> > >> [[alternative HTML version deleted]] > >> > >> __ > >> R-help@r-project.org<mailto: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.
Re: [R] Package 'coin' - How to extract rho
Christine, thanks for the example. As far as I can see, the "coin" package does not explicitly compute Spearman's rho. This is probably also the reason why it isn't reported in the test output. Thus, you would have to do this "by hand" using cor(..., method = "spearman"). Hope that helps, Achim On Wed, 29 Apr 2020, Blume Christine wrote: Dear Jim, Many thanks for following up on this. Sure, I can provide a sample code. At the end of the code you see that I extract the p-value and the test statistic. However, I cannot find the correlation coefficient rho anywhere in the object “r”. Best, Christine if(!require(pacman)) install.packages("pacman") pacman::p_load(sn, fGarch, coin) # Happiness central_tendency_sim <- 0 dispersion_sim <- 1 skewness_sim <- 1.5 N_sim <- 1 Happiness <- seq(from = 0, to = 10, length.out = N_sim) # City size central_tendency_sim <- 3 dispersion_sim <- 1 skewness_sim <- 1.5 Citysize <- seq(from = 1, to = 5, length.out = N_sim) # create dataframe datastat <- data.frame(Happiness, Citysize) # Bootstrapped correlation r <- spearman_test(Happiness ~ Citysize, data = datastat, distribution = "approximate", alternative = c("two.sided")) r pvalue(r) statistic(r) -Ursprüngliche Nachricht- Von: Jim Lemon Gesendet: Mittwoch, 29. April 2020 05:53 An: Blume Christine Cc: r-help@r-project.org Betreff: Re: [R] Package 'coin' - How to extract rho Hi Christine, I noticed that your question did not receive a reply. As I don't know exactly what you have tried, it is a bit difficult to suggest a solution. If you are still unable to get this to work, could you provide an example of your present code and data if necessary? Jim On Mon, Apr 27, 2020 at 3:09 AM Blume Christine mailto:christine.bl...@sbg.ac.at>> wrote: I am using the 'coin' package to compute bootstrapped correlations. I am able to extract the p-value with confidence intervals as well as the test statistic Z. However, I am unable to find rho, i.e. the correlation coefficient. Can someone help? Kind regards, Christine [[alternative HTML version deleted]] __ R-help@r-project.org<mailto: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.
Re: [R] Package 'coin' - How to extract rho
Dear Jim, Many thanks for following up on this. Sure, I can provide a sample code. At the end of the code you see that I extract the p-value and the test statistic. However, I cannot find the correlation coefficient rho anywhere in the object “r”. Best, Christine if(!require(pacman)) install.packages("pacman") pacman::p_load(sn, fGarch, coin) # Happiness central_tendency_sim <- 0 dispersion_sim <- 1 skewness_sim <- 1.5 N_sim <- 1 Happiness <- seq(from = 0, to = 10, length.out = N_sim) # City size central_tendency_sim <- 3 dispersion_sim <- 1 skewness_sim <- 1.5 Citysize <- seq(from = 1, to = 5, length.out = N_sim) # create dataframe datastat <- data.frame(Happiness, Citysize) # Bootstrapped correlation r <- spearman_test(Happiness ~ Citysize, data = datastat, distribution = "approximate", alternative = c("two.sided")) r pvalue(r) statistic(r) -Ursprüngliche Nachricht- Von: Jim Lemon Gesendet: Mittwoch, 29. April 2020 05:53 An: Blume Christine Cc: r-help@r-project.org Betreff: Re: [R] Package 'coin' - How to extract rho Hi Christine, I noticed that your question did not receive a reply. As I don't know exactly what you have tried, it is a bit difficult to suggest a solution. If you are still unable to get this to work, could you provide an example of your present code and data if necessary? Jim On Mon, Apr 27, 2020 at 3:09 AM Blume Christine mailto:christine.bl...@sbg.ac.at>> wrote: > > I am using the 'coin' package to compute bootstrapped correlations. I am able > to extract the p-value with confidence intervals as well as the test > statistic Z. However, I am unable to find rho, i.e. the correlation > coefficient. Can someone help? > > Kind regards, > Christine > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org<mailto: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] Package 'coin' - How to extract rho
Hi Christine, I noticed that your question did not receive a reply. As I don't know exactly what you have tried, it is a bit difficult to suggest a solution. If you are still unable to get this to work, could you provide an example of your present code and data if necessary? Jim On Mon, Apr 27, 2020 at 3:09 AM Blume Christine wrote: > > I am using the 'coin' package to compute bootstrapped correlations. I am able > to extract the p-value with confidence intervals as well as the test > statistic Z. However, I am unable to find rho, i.e. the correlation > coefficient. Can someone help? > > Kind regards, > Christine > > > [[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] Package 'coin' - How to extract rho
I am using the 'coin' package to compute bootstrapped correlations. I am able to extract the p-value with confidence intervals as well as the test statistic Z. However, I am unable to find rho, i.e. the correlation coefficient. Can someone help? Kind regards, Christine [[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.