similar to: resampling issue

Displaying 20 results from an estimated 6000 matches similar to: "resampling issue"

2010 Sep 29
2
repeat a function
I have R randomly sampling my array made up of 2 columns of data. Here is my code randomly sampling 5 different rows from my dataset to create a new dataset of 8 rows of data: testdat<-growth[sample(5,8,replace=T),] Now I want to tell R to repeat this function 50 times and give me the output. I have been searching the internet and have been unable to figure this out. Any advice
2010 Sep 29
1
next step in randomly sampling
Thanks to the people on this list I was able to fix my code for randomly sampling. Thanks. Now, I am moving on to the next step and I ran into another snag. I have a large dataset but I am starting with a small made-up dataset until I figure it out. I have two columns of data (age and length). I got R to read my data called growth which is the age and length for 10 fish: >
2010 Sep 29
2
fitting model to resampled data
I apologize if this comes across as confusing. I will try to explain my situation as best I can. I have R bootstrapping my growth data for fish. It's resampling my database of age and length data and then produces several new datasets for me. In this case, it's resampling my data to create three new datasets of age and length data. Here is my code with my original data called
2010 Sep 29
2
need help with ramdomly sampling some data
I am trying to get R to randomly select values from my dataset (i.e. bootstrapping) with replacement. However, my attempts at this have been unsuccessful. Here is a basic example of what I am doing: I have a data vector of 8 values (i.e. data= 2,5,9,4,5,6,7,8). I used the sample function and it worked. However, it only repeated my values in the exact same order as the dataset. It did not
2010 Sep 28
1
ramdom sampling from a dataset
I am trying to get R to pick random integers from my dataset (i.e. bootstrapping) with replacement. However, my attempts at this have been unsuccessful. Here is a basic example of what I am doing: I have a data vector of 8 integers (data= 2,5,9,4,5,6,7,8). I used the sample function and it worked but it only repeated my values in the exact same order. It did not randomly sample them. Here
2010 Oct 01
4
cleaning up a vector
I calculated a large vector. Unfortunately, I have some measurement error in my data and some of the values in the vector are erroneous. I ended up wih some Infs and NaNs in the vector. I would like to filter out the Inf and NaN values and only keep the values in my vector that range from 1 to 20. Is there a way to filter out Infs and NaNs in R and end up with a clean vector? Mike
2010 Oct 02
1
[Fwd: RE: maximum likelihood problem]
I forgot to add that I first gave a starting value for K. Nonlinear least squares won't work because my errors are not normally distributed. Any advide on my maximum likelihood function would be greatly appreciated. ---------------------------- Original Message ---------------------------- Subject: RE: [R] maximum likelihood problem From: "Ravi Varadhan" <rvaradhan at
2010 Oct 01
3
maximum likelihood problem
I am trying to figure out how to run maximum likelihood in R. Here is my situation: I have the following equation: equation<-(1/LR-(exp(-k*T)*LM)*(1-exp(-k))) LR, T, and LM are vectors of data. I want to R to change the value of k to maximize the value of equation. My attempts at optim and optimize have been unsuccessful. Are these the recommended functions that I should use to maximize
2008 Sep 24
4
rowSums()
Say I have the following data: testDat <- data.frame(A = c(1,NA,3), B = c(NA, NA, 3)) > testDat A B 1 1 NA 2 NA NA 3 3 3 rowsums() with na.rm=TRUE generates the following, which is not desired: > rowSums(testDat[, c('A', 'B')], na.rm=T) [1] 1 0 6 rowsums() with na.rm=F generates the following, which is also not desired: > rowSums(testDat[, c('A',
2009 Dec 10
2
different randomForest performance for same data
Hello, I came across a problem when building a randomForest model. Maybe someone can help me. I have a training- and a testdataset with a discrete response and ten predictors (numeric and factor variables). The two datasets are similar in terms of number of predictor, name of variables and datatype of variables (factor, numeric) except that only one predictor has got 20 levels in the training
2011 Jan 17
1
Replacing rows in a data frame
R-helpers, Below is a simple example of some output that I am getting while trying to work with a data frame in R 2.12.1 for Mac. ----- > testdat <- data.frame(matrix(ncol=10, nrow=10)) > colnames(testdat) <- c('a','b','c','d','e','f','g','h','i','j') > testdat[seq(1,10,3),] <-
2007 May 25
1
Speeding up resampling of rows from a large matrix
I'm trying to: Resample with replacement pairs of distinct rows from a 120 x 65,000 matrix H of 0's and 1's. For each resampled pair sum the resulting 2 x 65,000 matrix by column: 0 1 0 1 ... + 0 0 1 1 ... _______ = 0 1 1 2 ... For each column accumulate the number of 0's, 1's and 2's over the resamples to obtain a 3 x 65,000 matrix G. For those
2017 Aug 19
2
bootstrap subject resampling: resampled subject codes surface as list/vector indices
I'm implementing a custom bootstrap resampling procedure in R. This procedure resamples clusters of data points obtained by different subjects in an experiment. Since the bootstrap samples need to have the same size as the original dataset, `target.set.size`, I select speakers compute their data point contributions to make sure I have a set of the right size. set.seed(1)
2011 Mar 12
1
Column order in stacking/unstacking
Dear R users, I'm having some problems with the stack() and unstack() functions, and wondered if you could help. I have a large data frame (400 rows x 2000 columns), which I need to reduce to a single column of values (and therefore 800000 rows), so that I can use it in other operations (e.g., generating predictions from a GLM object). However, the problem I'm having can be reproduced
2011 Feb 15
3
expected behavior when parsing lines with special characters
Say I have a tab-delimited table I want to read into R. What should I expect to happen if some of the entries contain the character " ' "? I thought it would read the file fine, but that is not what happens. Instead, all the values in between two " ' "s get read into one field, and things are just seriously messed up. Is this a bug, and besides removing the offending
2017 Aug 19
0
bootstrap subject resampling: resampled subject codes surface as list/vector indices
I din't have the patience to go through your missive in detail, but do note that it is not reproducible, as you have not provided a "data" object. You **are** asked to provide a small reproducible example by the posting guide. Of course, others with more patience and/or more smarts may not need the reprex to figure out what's going on. But if not ... Cheers, Bert Bert Gunter
2010 Jul 12
1
Robust regression error: Too many singular resamples
Hello. I've got a dataset that may have outliers in both x and y. While I am not at all familiar with robust regression, it looked like the function lmrob in package robustbase should handle this situation. When I try to use it, I get: Too many singular resamples Aborting fast_s_w_mem() Looking into it further, it appears that for an indicator variable in one of my interaction terms, 98%
2011 Apr 13
3
predict()
Hi, I am experimenting with the function predict() in two versions of R and the R extension package "survival". library(survival) set.seed(123) testdat=data.frame(otime=rexp(10),event=rep(0:1,each=5),x=rnorm(10)) testfm=as.formula('Surv(otime,event)~x') testfun=function(dat,fm) { predict(coxph(fm,data=dat),type='lp',newdata=dat) } # Under R 2.11.1 and
2011 Apr 13
3
predict()
Hi, I am experimenting with the function predict() in two versions of R and the R extension package "survival". library(survival) set.seed(123) testdat=data.frame(otime=rexp(10),event=rep(0:1,each=5),x=rnorm(10)) testfm=as.formula('Surv(otime,event)~x') testfun=function(dat,fm) { predict(coxph(fm,data=dat),type='lp',newdata=dat) } # Under R 2.11.1 and
2008 Mar 14
2
Multiple should_receive(:render).with
I''m trying to specify that a particular view must render two different partials. My spec looks like: describe AClass do it do template.should_receive(:render).with(:partial => ''foo'', :locals => { ... }) ... end describe ''some conditional case'' do it do template.should_receive(:render).with(:partial =>