hits=10>
Dr John Hillier
Senior Lecturer & NERC Knowledge Exchange Fellow (Insurance Sector)
Geography and Environment
Loughborough University
01509 223727
________
From: Bert Gunter
Sent: 09 January 2019 23:37:01
To: Jeff Newmiller
Cc: R-help; John Hillier
Subject: Re
John:
Clarification: Do you mean you just want an "irregular" subset of your
*given* data values/times, or do you want times randomly over the series
duration for which you will construct values, which is what Jeff described.
The former is trivial: see ?sample with the "replace" argument = FALSE
The key to accomplishing this is to clarify how you want to address selecting
values between the existing points, but there are many base R functions and
packages that address this problem. In general the methods fall into two
categories: interpolation and smoothing. Interpolation includes piece
Dear All,
I would appreciate a quick pointer in the right direction (e.g. www page I
could look at, or indicator of which function within a package).
The problem: I have a regular time series of values x at times t (i.e. t, x). I
would like to sample them at irregular, known times - this is a
Thank you!
I have used the replicate function. In fact, I had just found the solution when
I received your answers.
Best regards,
Rita
_
Rita Gamito
Centro de Oceanografia
Faculdade de Ciências, Universidade de Lisboa
Campo Grande, 1749-016 Lisboa, Portugal
e
Hello,
The best way seems to be ?replicate.
set.seed(3997) # make it reproducible
x <- rnorm(1002) # make up some data
sim <- replicate(1000, sample(x, 20))
colSds <- function(x, na.rm = FALSE) apply(x, 2, sd, na.rm = na.rm)
mu <- colMeans(sim)
sigma <- colSds(sim)
Hope this helps,
Rui
Hi.
See ?sample, ?replicate,?colMeans, ?plot..
Here is the simple example:
sample(1:1000,20)
replicate(5, sample(1:1000,20))
colMeans(replicate(5, sample(1:1000,20)))
Andrija
On Wed, Jul 31, 2013 at 1:23 PM, Rita Gamito wrote:
> Could anyone tell me how,from a pool of 1002 observations (one
Could anyone tell me how,from a pool of 1002 observations (one variable), can
I resample 1000 samples of 20 observations?
And then calculate the mean and standard deviation between 2, 3, 4, ..., 1000
samples and plot them?
Thank you!
_
Rita Gamito
Centro de
You can use, 'sample' function for sampling and may consider using
partition clustering for selecting your regions, see Cluster task view:
http://cran.r-project.org/web/views/Cluster.html
On 4 December 2012 00:53, KoopaTrooper wrote:
> I am using package ks() to build 3D representations of bird
I am using package ks() to build 3D representations of bird territories and
calculate territory volume from spatial data (simply x, y, and z
coordinates). What I want to do is determine at what sample size (#
locations collected) does the territory volume stop increasing. This should
give me an ide
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Vikram Chhatre
> Sent: Thursday, May 10, 2012 4:57 PM
> To: r-help@r-project.org
> Subject: [R] Resampling question
>
> Hello -
>
> I have a popu
No, it will not, except possibly by chance: if the draws of sample are
IID (and they are supposed to be) there's no reason to expect them not
to overlap.
If you want that -- and I'm not sure it's totally on the level
bootstrapping-wise -- you need to decide which ones to remove all in
one fell swo
Hello -
I have a population of 100 individuals that I would like to bootstrap
10 times, every time removing 5 *different* individuals.
So far, I have done the following:
pop <- read.table('mypop.txt', header=FALSE)
replicate(10, sample(pop, 95, replace=FALSE))
I have not actually gone through
Max and List,
Could you advise me if I am using the proper caret syntax to carry out
leave-one-out cross validation. In the example below, I use example
data from the rda package. I use caret to tune over a grid and select
an optimal value. I think I am then using the optimal selection for
predict
On Wed, Mar 28, 2012 at 8:03 PM, Benton, Paul
wrote:
>
> On Mar 29, 2012, at 1:41 AM, ilai wrote:
>
>> On Wed, Mar 28, 2012 at 3:53 PM, Benton, Paul
>> wrote:
>>> Hello all R-er,
>>>
>>> ## Then test if rho.A[1,1] come from the distribution of rho.B[1,1]
>>> pvalueMat[1,1]<-wilcox.test(rho.ar
On Mar 29, 2012, at 1:41 AM, ilai wrote:
> On Wed, Mar 28, 2012 at 3:53 PM, Benton, Paul
> wrote:
>> Hello all R-er,
>>
>> I'm trying to run a resampling method on some data. The current method I
>> have takes 2+ days or a lot of memory . I was wondering if anyone has a
>> better suggestion.
On Wed, Mar 28, 2012 at 3:53 PM, Benton, Paul
wrote:
> Hello all R-er,
>
> I'm trying to run a resampling method on some data. The current method I have
> takes 2+ days or a lot of memory . I was wondering if anyone has a better
> suggestion.
>
> Currently I take a matrix and get the correlation
Hello all R-er,
I'm trying to run a resampling method on some data. The current method I have
takes 2+ days or a lot of memory . I was wondering if anyone has a better
suggestion.
Currently I take a matrix and get the correlation matrix from it. This will be
called rho.A. Each element in this
On Dec 2, 2011, at 3:55 AM, lincoln wrote:
Thanks.
Anyway, it is not homework and I was not told to do that. My
question has
not been answered yet, I'll try to reformulate it:
Does it make (statistical) sense to resample with replacement in this
situation to get an estimate of the CIs? In ca
Thanks.
Anyway, it is not homework and I was not told to do that. My question has
not been answered yet, I'll try to reformulate it:
Does it make (statistical) sense to resample with replacement in this
situation to get an estimate of the CIs? In case it does, how could I do it
in R?
Some further
On Dec 1, 2011, at 10:49 AM, lincoln wrote:
Thanks.
So, suppose for one specific year (first year over 10) the
percentage of
successes deriving from 100 trials with 38 successes (and 62
failures), its
value would be 38/100=0.38.
I could calculate its confidence intervals this way:
succes
Thanks.
So, suppose for one specific year (first year over 10) the percentage of
successes deriving from 100 trials with 38 successes (and 62 failures), its
value would be 38/100=0.38.
I could calculate its confidence intervals this way:
> success<-38
> total<-100
> prop.test(success,total,p=0.5,a
On Dec 1, 2011, at 6:34 AM, lincoln wrote:
...is it possible to do that?
I apologize for something that must be a very trivial question for
most of
you but, unfortunately, it is not for me.
A binary variable is measured, say, 50 times each year during 10
year. My
interest is focused on th
...is it possible to do that?
I apologize for something that must be a very trivial question for most of
you but, unfortunately, it is not for me.
A binary variable is measured, say, 50 times each year during 10 year. My
interest is focused on the percentage of 1s with respect to the total if
each
You mentioned the boot package, I've just stumbled across a package
called simpleboot, with a function lm.boot. Would this be suitable - it
says I can sample cases from the origional dataset, as well as from the
residuals of a model. Not all the options I understand but I assume the
defaults mi
Ok I'll check I understand:
So it's using sample, to resample d once, 10 values, because the rnorm
has 10 values, with replacement (I assume thats the TRUE part).
Then a for loop has this to resample the data - in the loop's case its
1000 times. Then it does a lm to get the coefficients and add
Axolotl9250 wrote:
>
> ...
> resampled_ecoli = sample(ecoli, 500, replace=T)
> coefs = (coef(lm(MIC. ~ 1 + Challenge + Cleaner + Replicate,
> data=resampled_ecoli)))
> sd(coefs)
>
> ...
>
Below a simplified and self-consistent version of your code, and some
changes
Dieter
# resample
d = dat
Hi, I'm doing some modelling (lm) for my 3rd year dissertation and I
want to do some resampling, especially as I'm working with microbes,
getting them to evolve resistance to antimicrobial compounds, and after
each exposure I'm measuring the minimum concentration required to kill
them (which I'
Hi:
The deal with replicate() is that its second argument is a *function*; more
specifically, a function *call*. That's why Henrique's solution worked and
your attempt didn't. Inside replicate(), if the function has arguments, they
need to be supplied. This works:
testdat <- function(df, n) df[sa
I think that you want:
replicate(5, growth[sample(9,12,replace=T),], simplify = FALSE)
On Wed, Sep 29, 2010 at 3:19 PM, Michael Larkin wrote:
> I am trying to get R to resample my dataset of two columns of age and
> length
> data for fish. I got it to work, but it is not resampling every repli
I am trying to get R to resample my dataset of two columns of age and length
data for fish. I got it to work, but it is not resampling every replicate.
Instead, it resamples my data once and then repeated it 5 times.
Here is my dataset of 9 fish samples with an age and length for each one:
A
That sounds like a sensible way of dealing with the - values...
...but doesn't solve the more important question of how to perform the
resampling. Are there are functions in R which have been designed to achieve
this? Or is there a standard way of going about this?
Many thanks for any advi
Steve Murray-2 wrote:
>
> Dear all,
>
> I have a grid (data frame) dataset at 0.5 x 0.5 degrees spatial resolution
> (720 columns x 360 rows; regular spacing) and wish to coarsen this to a
> resolution of 2.5 x 2.5 degrees. A simple calculation which takes the mean
> of a block of points to for
One possibility I can see is to replace - by NA and use mean with
na.rm=TRUE.
--- On Wed, 10/2/10, Steve Murray wrote:
> From: Steve Murray
> Subject: [R] Resampling a grid to coarsen its resolution
> To: r-help@r-project.org
> Received: Wednesday, 10 February, 2010, 3:20 AM
&
Dear all,
I have a grid (data frame) dataset at 0.5 x 0.5 degrees spatial resolution (720
columns x 360 rows; regular spacing) and wish to coarsen this to a resolution
of 2.5 x 2.5 degrees. A simple calculation which takes the mean of a block of
points to form the regridded values would do the
Dimitris,
Thanks, I shall give this a try as an alternative.
Graham
2009/11/15 Dimitris Rizopoulos :
> try the following:
>
> LL <- c(12.5,17,12,11.5,9.5,15.5,16,14)
> n <- length(LL)
> N <- 1000
> threshold <- 10
>
> smpls <- sample(LL, N*n, replace = TRUE)
> dim(smpls) <- c(n, N)
> cnt <- sum(
David,
Thanks, its me getting mixed up I actually meant less than or equal to
10. That apart, I guess the code is OK, I just expected, especially
as I increased N that I might have got some means less than 10, but
having gone back to it , I see I need a million iterations before
getting two means
try the following:
LL <- c(12.5,17,12,11.5,9.5,15.5,16,14)
n <- length(LL)
N <- 1000
threshold <- 10
smpls <- sample(LL, N*n, replace = TRUE)
dim(smpls) <- c(n, N)
cnt <- sum(colMeans(smpls) > threshold)
cnt
I hope it helps.
Best,
Dimitris
Graham Smith wrote:
I am trying to modify some cod
On Nov 15, 2009, at 12:12 PM, Graham Smith wrote:
I am trying to modify some code from Good 2005.
I am trying to resample the mean of 8 values and then count how many
times the resampled mean is greater than 10. But my count of means
above 10 is coming out as zero, which I know isn't correct.
I am trying to modify some code from Good 2005.
I am trying to resample the mean of 8 values and then count how many
times the resampled mean is greater than 10. But my count of means
above 10 is coming out as zero, which I know isn't correct.
I would appreciate it if someone could look at the c
On 6/19/2009 10:59 AM, Seunghee Baek wrote:
> Hi,
> For bootstrapping method, I would like to resample the entire row instead of
> one column.
> What should I do?
iris[sample(x=nrow(iris), replace=TRUE),]
But I would look at the boot package or other packages related to
bootstrapping.
> Thank
Hi,
For bootstrapping method, I would like to resample the entire row instead of
one column.
What should I do?
Thanks,
Becky
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R
Here some sample code to interpolate your data using zoo:
by5 is a sequence for every 5 time units which we merge
with z, the original data. Then we use na.approx to replace
all NAs with linear interpolations.
Lines <- "TimeCursorX CursorY Pupilsize
1811543 -1 -1 -1
1811563 -1
This has been solved in an earlier post:
http://www.nabble.com/linear-interpolation-of-multiple-random-time-series-to11694879.html
On Thu, Dec 11, 2008 at 4:38 PM, tsunhin wong wrote:
> Dear all R users,
>
> I am going to use R to process some of my physiological data about eye.
>
> The problem
On Thu, 11 Dec 2008, tsunhin wong wrote:
Dear all R users,
I am going to use R to process some of my physiological data about eye.
The problem is the recording machine does not sample in a reliably
constant rate: the time intervals between data sampled can vary from
9msec to ~120msec, while mo
Dear all R users,
I am going to use R to process some of my physiological data about eye.
The problem is the recording machine does not sample in a reliably
constant rate: the time intervals between data sampled can vary from
9msec to ~120msec, while most around in the 15-30msec range.
The below
I am sorry for the incorrect subject. My subject autofilled without my
noticing in time. I suppose a better subject would be Calculating
proportion of shared occurances and randomizations.
Grant
2008/4/19 Grant Gillis <[EMAIL PROTECTED]>:
> Hello All,
>
> Once again thanks for all of the help
Hello All,
Once again thanks for all of the help to date. I am climbing my R learning
curve. I've got a few more questions that I hope I can get some guidance on
though. I am not sure whether the etiquette is to break up multiple
questions or not but I'll keep them together here for now as it
Dear all,
I sample without replacement elements of a vector and generate a new
vector:
kl<-c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,5,5,5,5,5,6,6,6,6,6,7,7,8,8,
8,8,8,8,8,8,8)
the_index<-c(sample(40,35))
for(fs in
1:length(the_index)){if(fs==1){s<-c(kl[the_index[fs]])}else{s<-
append
49 matches
Mail list logo