Hello R Experts! I wonder if anyone is familiar with the wBoot package written by Neil Weiss. I was trying to use the *boot.two.per* function in that package to compute a bootstrapped two-sample hypothesis test for proportion. Here"s the *boot.two.per* script: boot.two.per(x, y, parameter, stacked = TRUE, variable = NULL, null.hyp = NULL, alternative = c("two.sided", "less", "greater"), conf.level = 0.95, type = NULL, R = 9999) The problem is that if I specify *mean* or *median *as the parameter for the test, the script runs fine, but if I specify *proportion*, I get an error message that *proportion* not found Is there another way to specify proportion as the test parameter? Thanks a lot! Janh [[alternative HTML version deleted]]
Look at the function's help page: No help there. The "parameter" argument is not defined in any substantive manner, and no examples other than `parameter=mean` appear in the help page. (Now) Look at the code. The parameter argument is expected to be a function. There is no function named `proportion` in base R that I know of and: > wBoot::proportion Error: 'proportion' is not an exported object from 'namespace:wBoot' > wBoot:::proportion Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : ? object 'proportion' not found The code in the function you are asking about does begin with: ?? { ???? proportion <- mean However, that named entity, `proportion`,? is never referenced in? code that follows, so it appears that the package author started down one path and then abandoned that line of code and did something else. I suspect that the code was written so that `mean` was inteended to deliver a test of equal proportions using the normal approximation to a binomial test. There is a waring in the help page that would apply to situations where the proportion is far from 0.5.? You are advised that not all packages are written with scrupulous quality control and peer review. You should have read the posting guide. It would have told you that you should have addressed your concerns to the package author first, and also posted in plain text. -- David On 11/25/18 12:59 PM, Janh Anni wrote:> Hello R Experts! > > I wonder if anyone is familiar with the wBoot package written by Neil > Weiss. I was trying to use the *boot.two.per* function in that package to > compute a bootstrapped two-sample hypothesis test for proportion. Here"s > the *boot.two.per* script: > > boot.two.per(x, y, parameter, stacked = TRUE, variable = NULL, > > null.hyp = NULL, alternative = c("two.sided", "less", "greater"), > > conf.level = 0.95, type = NULL, R = 9999) > > The problem is that if I specify *mean* or *median *as the parameter for > the test, the script runs fine, but if I specify *proportion*, I get an > error message that *proportion* not found > > Is there another way to specify proportion as the test parameter? > > Thanks a lot! > > Janh > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
This could possibly be a botched attempt at telling "the system" that one could use proportion() as synonymous with mean(). That would obviously fail due to scoping rules, but maybe an earlier version used <<- (?). Anyways, you could take the hint: proportions are just means of 0-1 variables...> On 26 Nov 2018, at 01:06 , David Winsemius <dwinsemius at comcast.net> wrote: > > The code in the function you are asking about does begin with: > > { > > proportion <- mean > > However, that named entity, `proportion`, is never referenced in code that follows, so it appears that the package author started down one path and then abandoned that line of code and did something else.-- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Hello David, Peter, Thank you so much for taking the trouble to look into this. The user guide for the *boot.two.per* function contains this statement: *Obtains an independent-samples confidence interval and (optionally) performs an independent samples* *hypothesis test for the difference between two population means, medians, proportions,* *or some user-defined function, using the percentile bootstrap method*. That was why I assumed it could handle the bootstrapped two-sample test for proportions as well. I actually tried to contact the author before bringing the issue to R-Help, but found that unfortunately he passed away in 2016. Assuming there's no resolution to this problem, would you know of any other package or function that can bootstrap one- and two-sample proportion tests? Thanks again! Janh On Sun, Nov 25, 2018 at 7:06 PM David Winsemius <dwinsemius at comcast.net> wrote:> Look at the function's help page: > > No help there. The "parameter" argument is not defined in any > substantive manner, and no examples other than `parameter=mean` appear > in the help page. > > (Now) Look at the code. The parameter argument is expected to be a > function. There is no function named `proportion` in base R that I know > of and: > > > wBoot::proportion > Error: 'proportion' is not an exported object from 'namespace:wBoot' > > wBoot:::proportion > Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : > object 'proportion' not found > > > The code in the function you are asking about does begin with: > > { > > proportion <- mean > > However, that named entity, `proportion`, is never referenced in code > that follows, so it appears that the package author started down one > path and then abandoned that line of code and did something else. I > suspect that the code was written so that `mean` was inteended to > deliver a test of equal proportions using the normal approximation to a > binomial test. There is a waring in the help page that would apply to > situations where the proportion is far from 0.5. You are advised that > not all packages are written with scrupulous quality control and peer > review. > > You should have read the posting guide. It would have told you that you > should have addressed your concerns to the package author first, and > also posted in plain text. > > -- > > David > > On 11/25/18 12:59 PM, Janh Anni wrote: > > Hello R Experts! > > > > I wonder if anyone is familiar with the wBoot package written by Neil > > Weiss. I was trying to use the *boot.two.per* function in that package to > > compute a bootstrapped two-sample hypothesis test for proportion. Here"s > > the *boot.two.per* script: > > > > boot.two.per(x, y, parameter, stacked = TRUE, variable = NULL, > > > > null.hyp = NULL, alternative = c("two.sided", "less", "greater"), > > > > conf.level = 0.95, type = NULL, R = 9999) > > > > The problem is that if I specify *mean* or *median *as the parameter for > > the test, the script runs fine, but if I specify *proportion*, I get an > > error message that *proportion* not found > > > > Is there another way to specify proportion as the test parameter? > > > > Thanks a lot! > > > > Janh > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at 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 at 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]]