[R] How can I overwrite a method in R?

2014-10-09 Thread Tim Hesterberg
How can I create an improved version of a method in R, and have it be used? Short version: I think plot.histogram has a bug, and I'd like to try a version with a fix. But when I call hist(), my fixed version doesn't get used. Long version: hist() calls plot() which calls plot.histogram() which

Re: [R] How can I overwrite a method in R?

2014-10-09 Thread Tim Hesterberg
:10), graphics) hist(1:10) Haley On Thu, Oct 9, 2014 at 1:14 AM, Tim Hesterberg timhesterb...@gmail.com wrote: How can I create an improved version of a method in R, and have it be used? Short version: I think plot.histogram has a bug, and I'd like to try a version with a fix

Re: [R] boot() with glm/gnm on a contingency table

2012-09-12 Thread Tim Hesterberg
of interest on the new table. } When f is called with 1:n, the table it creates should be the same as the original table. When called with a bootstrap sample of values from 1:n, it should create a table corresponding to the bootstrap sample. Tim Hesterberg http://www.timhesterberg.net (resampling

Re: [R] boot() with glm/gnm on a contingency table

2012-09-12 Thread Tim Hesterberg
Le mercredi 12 septembre 2012 à 07:08 -0700, Tim Hesterberg a écrit : One approach is to bootstrap the vector 1:n, where n is the number of individuals, with a function that does: f - function(vectorOfIndices, theTable) { (1) create a new table with the same dimensions, but with the counts

Re: [R] Histogram to KDE

2012-09-06 Thread Tim Hesterberg
bootstrap and jackknife methods won't work right. Tim Hesterberg http://www.timhesterberg.net New: Mathematical Statistics with Resampling and R, Chihara Hesterberg On Fri, Aug 31, 2012 at 12:15 PM, David L Carlson dcarl...@tamu.edu wrote: Using a data.frame x with columns bins and counts: x

[R] [R-pkgs] dataframe package

2012-05-23 Thread Tim Hesterberg
* round(a data frame with numeric and factor columns) rounds the numeric columns and leaves the factor columns unchanged, rather than failing. Tim Hesterberg NEW! Mathematical Statistics with Resampling and R, Chihara Hesterberg http://www.amazon.com/Mathematical-Statistics-Resampling-Laura

Re: [R] Permutation or Bootstrap to obtain p-value for one sample

2011-10-09 Thread Tim Hesterberg
, The permutation test answers the question - given that there is exactly 1 outlier in my combined data, what is the probability that random chance would give a difference as large as I observed. The bootstrap would answer some other question. Tim Hesterberg NEW! Mathematical Statistics with Resampling and R

Re: [R] Extracting components from a 'boot' class output in R

2011-07-24 Thread Tim Hesterberg
' is not an exported object from 'namespace:boot'). Tim Hesterberg Do names(bootObj) to find out what the components are, and use $ or [[ to extract components. Do help(boot) for a description of components of the object (look in the Value section). That is general advice in R, applying to all kinds

Re: [R] Extracting components from a 'boot' class output in R

2011-07-23 Thread Tim Hesterberg
(), return lists with a class added, and you can operate on the object as a list using names(), $, etc. Tim Hesterberg Dear R user, I used the following to do a bootstrap. bootObj-boot(data=DAT, statistic=Lp.est, R=1000,x0=3) I have the following output from the above bootstrap. How can I extract

Re: [R] Question on approximations of full logistic regression model

2011-05-16 Thread Tim Hesterberg
methods have their own biases, particularly in nonlinear applications such as logistic regression. Tim Hesterberg Thank you for your reply, Prof. Harrell. I agree with you. Dropping only one variable does not actually help a lot. I have one more question. During analysis of this model I found

Re: [R] memory and bootstrapping

2011-05-05 Thread Tim Hesterberg
estimated from the original data. And, you can compute the model matrix once and resample rows of that along with y, rather than computing a model matrix from scratch each time. Tim Hesterberg The only reason the boot package will take more memory for 2000 replications than 10 is that it needs

Re: [R] Bootstrap 95% confidence intervals for splines

2011-03-27 Thread Tim Hesterberg
is the range of the middle 95% of the recorded differences. Tim Hesterberg P.S. I think you're mixing up the response and explanatory variables. I'd think of eating hot dogs as the cause (explanatory variable), and waistline as the effect (response, or outcome). P.P.S. I don't like the terms independent

Re: [R] jackknife-after-bootstrap

2010-11-15 Thread Tim Hesterberg
Can someone help me about detection of outliers using jackknife after bootstrap algorithm? A simple procedure is to calculate the mean of the bootstrap statistics for all bootstrap samples that omit the first of the original observations. Repeat for the second, third, ... original observation.

Re: [R] How to do bootstrap for the complex sample design?

2010-11-04 Thread Tim Hesterberg
/~timhesterberg/articles/JSM04-bootknife.pdf All three are undefined for samples of size 1. You need to go to some other bootstrap, e.g. a parametric bootstrap with variability estimated from other data. Tim Hesterberg __ R-help@r-project.org mailing

Re: [R] first post and bootstarpping problems

2010-10-08 Thread Tim Hesterberg
, pValueUpper) Tim Hesterberg __ R-help@r-project.org mailing list 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] make methods work in lapply - remove lapply's environment

2008-09-08 Thread Tim Hesterberg
I've defined my own version of summary.default, that gives a better summary for highly skewed vectors. If I call summary(x) the method is used. If I call summary(data.frame(x)) the method is not used. I've traced this to lapply; this uses the new method: lapply(list(x), function(x)

Re: [R] Coefficients of Logistic Regression from bootstrap - how to get them?

2008-07-27 Thread Tim Hesterberg
for inference (bias, standard error, confidence intervals), not improving on ThetaHat. Tim Hesterberg Hi Doran, Maybe I am wrong, but I think bootstrap is a general resampling method which can be used for different purposes...Usually it works well when you do not have a presentative sample set (maybe

Re: [R] sample size in bootstrap(boot)

2008-06-08 Thread Tim Hesterberg
Statistical Association, 2924-2930. http://home.comcast.net/~timhesterberg/articles/JSM04-bootknife.pdf Tim Hesterberg (formerly of Insightful, now Google, and only now catching up on R-help) Hi Dan, Thanks for response yes i do know that bootstrap samples generated by function boot

Re: [R] applying a function to data frame columns

2008-02-22 Thread Tim Hesterberg
[u = range(v)[1] u = range(v)[2]] }, U = u, V = v) Tim Hesterberg I want to apply this function to the columns of a data frame: u[u = range(v)[1] u = range(v)[2]] where u is the n column data frame under consideration and v is a data frame of values with the same

Re: [R] Does the t.test in R uses Welch procedure or ordinary student t-test?

2008-02-19 Thread Tim Hesterberg
in a rowing boat to find out whether conditions are sufficiently calm for an ocean liner to leave port. (G.E.P. Box, Non-normality and tests on variances, Biometrika, 40 (1953), pp 318-335, quote on page 333; via from Moore McCabe. Tim Hesterberg Dear all I have run t.test(), and get a output

[R] use rowSums or colSums instead of apply!

2008-02-19 Thread Tim Hesterberg
# 3.33 # larger data frame x - matrix(runif(10^5), 10^3) x[ runif(10^5) .99 ] - NA df2 - data.frame(x) system.time( for(i in 1:100) temp - rowSums(is.na(df2)) 100) # .34 system.time( for(i in 1:10^4) temp - apply(df,1,function(x)any(!is.na(x # 3.34 Tim Hesterberg

Re: [R] Sampling

2008-02-07 Thread Tim Hesterberg
Thomas Lumley wrote: On Wed, 6 Feb 2008, Tim Hesterberg wrote: Tim Hesterberg wrote: I'll raise a related issue - sampling with unequal probabilities, without replacement. R does the wrong thing, in my opinion: ... Peter Dalgaard wrote: But is that the right thing? ... (See bottom

Re: [R] R object as a function

2008-01-23 Thread Tim Hesterberg
(colSums( matrix( wt*f(c(xvalues), ...), 10) } Tim Hesterberg On 22/01/2008 5:30 AM, Thomas Steiner wrote: I want to use a function as an argument to ingtegrate it twice. ... Duncan Murdoch wrote: ... The other problem is that integrate is not vectorized, it can only take scalar values for lower

Re: [R] Bootstrap Correlation Coefficient with Moving Block Bootstrap

2007-12-06 Thread Tim Hesterberg
that depend only on y. The answer to your second question is the same as the first - sample blocks of observations, keeping x and y together. Tim Hesterberg Hello. I have got two problems in bootstrapping from dependent data sets. Given two time-series x and y

Re: [R] rowSums() and is.integer()

2007-11-20 Thread Tim Hesterberg
I wrote the original rowSums (in S-PLUS). There, rowSums() does not coerce integer to double. However, one advantage of coercion is to avoid integer overflow. Tim Hesterberg ... So, why does rowSums() coerce to double (behaviour that is undesirable for me