Does a package exist to help compute sample size for censored data? I am
planning a study involving interval censored data.
I know that there exists functions in stata for this, so I was wondering if R
has similar facilities. So far I have not been able to find anything for R.
Thanks for any
Hi,
I'm hoping someone has some insight about sample size and logit
estimation that could help me. I inherited a logit model from a
client in the direct marketing area. The previous consultant used
approximately 143,800 observations in the training data set, of
this
(Nonparametrics)
Date: Sun, 20 May 2007 23:03:26 -0400 From: [EMAIL PROTECTED] To:
r-help@stat.math.ethz.ch CC: [EMAIL PROTECTED] Subject: [R] Sample
correlation coefficient question NOT R question This is a statistics
question not an R question. When calculating the sample
This is a statistics question not an R question. When calculating the
sample correlation coefficient cor(x_t,y_t) between say
two variables, x_t and y_t t=1,.n ( one can assume that the
variables are in time but I don't think this really matters
for the question ), does someone know where I
On Tue, 8 May 2007, Victor Gravenholt wrote:
As a part of a simulation, I need to sample from a large vector repeatedly.
For some reason sample() builds up the memory usage ( 500 MB for this
example) when used inside a for loop as illustrated here:
X - 1:10
P - runif(10)
for(i in
As a part of a simulation, I need to sample from a large vector repeatedly.
For some reason sample() builds up the memory usage ( 500 MB for this
example) when used inside a for loop as illustrated here:
X - 1:10
P - runif(10)
for(i in 1:500) Xsamp - sample(X,3,replace=TRUE,prob=P)
As a part of a simulation, I need to sample from a large vector repeatedly.
For some reason sample() builds up the memory usage ( 500 MB for this
example) when used inside a for loop as illustrated here:
X - 1:10
P - runif(10)
for(i in 1:500) Xsamp - sample(X,3,replace=TRUE,prob=P)
As a part of a simulation, I need to sample from a large vector repeatedly.
For some reason sample() builds up the memory usage ( 500 MB for this
example) when used inside a for loop as illustrated here:
X - 1:10
P - runif(10)
for(i in 1:500) Xsamp - sample(X,3,replace=TRUE,prob=P)
Hi R-users,
I want to calculate the sample size needed to carry out a 2-sample
proprotion test (with alfa=0.05, beta=0.8)
1.- probability of success in subpopulation A: 0.8
2.- probability of success in subpopulation B: 0.05
3.- percentage of population in subpopulation A = 5%,
4.- percentage
Hi R-users,
I want to calculate the sample size needed to carry out a 2-sample
proprotion test.
I have the hypotesized treatment probability of success (0.80), the
hypotesized control probability of success (0.05), and also de proportion of
the sample devoted to treated group (5%),
Dear R-list,
I have to design the validation of a score (ordinal values between 0 and 6)
reputed to separate 4 groups of patients with known frequencies in the
population. I think the more accurate is to calculate sample size under median
test. Is there a function for that in R (not in the pwr
SAULEAU Erik-André wrote:
Dear R-list,
I have to design the validation of a score (ordinal values between 0 and 6)
reputed to separate 4 groups of patients with known frequencies in the
population. I think the more accurate is to calculate sample size under
median test. Is there a
Hi,
I'm completely new to R, I am all at sea with the interface and the
confusing help files, so would appreciate some help to do a simple task.
Need to present the mean and variance of 100 different samples of poisson
distributions (N=1000, with fixed lambda) in a file in two columnns, and
Do you mean that you have 100 samples, each of size 1000. If this is so,
you can perhaps do:
N = 1000
n = 100
x = matrix(rpois(N*n, 3.1), ncol=100) # Generate the appropriate no. of
Poisson samples and rearrange into 100 columns of 1000
output = cbind(means=apply(x,2,mean),
On 07-Feb-07 Thor wrote:
Hi,
I'm completely new to R, I am all at sea with the interface
and the confusing help files, so would appreciate some help
to do a simple task.
Need to present the mean and variance of 100 different samples
of poisson distributions (N=1000, with fixed lambda) in
On 07-Feb-07 Ted Harding wrote:
On 07-Feb-07 Thor wrote:
[...]
So far I have figured out:
N - 1000
x - rpois(N, 3.1) ,
Comment: The Poisson distribution has only one parameter, lambda,
so it should be rpois(N, lambda), e.g. rpois(N, 3). You will get
an error with your second parameter
Greetings,
I have experimented with the MBESS and pwr packages for the estimation of
sample size for a given CV, precision, and confidence interval.
Thus far I have found the ss.aipe.cv {MBESS} (Sample size planning for the
coefficient of variation given the goal of Accuracy in Parameter
Dear All,
I'm a relative novice in R, with some experience with S-plus and quite a
bit in SAS. In R and S-Plus, I've primarily worked with Frank Harrell's
Design and Hmisc libraries. I have R 2.3.1 for windows (XP) installed.
I have a project coming up in which the outcome will be recurrent
Hi,
I need to resample rows in a data frame by subsets
L3 - LETTERS[1:3]
d - data.frame(cbind(x=1, y=1:10), fac=sample(L3, 10, repl=TRUE))
x y fac
1 1 1 A
2 1 2 A
3 1 3 A
4 1 4 A
5 1 5 C
6 1 6 C
7 1 7 B
8 1 8 A
9 1 9 C
10 1 10 A
I have seen this used
Please, I´d like to store this sample matrix as a new object. How can I
do this ?
pulse - c(67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 71,
71, 72, 72, 73, 74)
m - NULL
x - 0
for (i in 1:5)
{
x - sample(pulse,3)
m - mean(x)
cat(x,m,\n)
}
Thanks,
Mauricio
Please, I´d like to store this sample matrix as a new object. How can I
do this ?
pulse - c(67, 67, 68, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 71,
71, 72, 72, 73, 74)
m - NULL
x - 0
for (i in 1:5)
{
x - sample(pulse,3)
m - mean(x)
cat(x,m,\n)
}
Thanks,
Mauricio
You mean writing to a file?
Maybe you should read the R Data Import/Export Manual
http://cran.r-project.org/doc/manuals/R-data.html
or as pdf
http://cran.r-project.org/doc/manuals/R-data.pdf
You might also want to read the manual pages of these
two commands:
help('dump')
help('write.table')
Hi Mauricio,
Although you question is not clear, I'm supposing that you want to save
as a new object (matrix) whatever is printed out from cat(x,m,\n).
If this is the case, then your result is a matrix with 5 rows and 4
columns. For each row, the first 3 values are x and the last value is m.
Hello,
I am a new user of R and trying to assess the sample size for data that is
being collected on water quality at sites across a wide geographic region. A
preliminary set of data has been collected and I would like to use it to
assess whether we are collecting enough data and in the right
Hello,
I am a new user of R and trying to assess the sample size for data that is
being collected on water quality at sites across a wide geographic region. A
preliminary set of data has been collected and I would like to use it to
assess whether we are collecting enough data and in the right
?power.anova.test is designed for 1 way models. I would be intrigued
to found out more about power in complicated designs. Do look into
the archives at
http://finzi.psych.upenn.edu/search.html
In the past, I used power.t.test on individual model coefficients,
though I am not sure it was
Hi,
I hope I'm not totally Off Topic, but I'm actually working on binary
classifier with probabilistic output [0 - 1]. I tested my methods
with some sample datasets from UCI Database but I'm still in need of
some samples. Especially, I'm looking for binary datasets with a
probabilistic
Hi,
I have a big dataset which has many missing values and want to implement
Multiple imputation via Monte carlo markov chain by following J Schafer's
Analysis of incomplete multivariate data. I don't know where to begin
and is looking for a sample R code that implements multiple imputation
There is also the mice package at http://www.multiple-imputation.com/
which uses mcmc but is different to Schafer's packages.
Simon.
At 09:30 AM 29/06/2005, James Reilly wrote:
Schafer's functions have been ported to R in the packages norm, cat, mix
and pan. Their documentation includes sample
On 11-Mar-05 Martin C. Martin wrote:
hist is lumping things together.
Try:
sum(temp == 0)
compare to the height of the left most bar.
Is this a bug in hist?
- Martin
Well, not a bug strictly speaking since it works as documented,
but I do think it's not necessarily a happy choice.
Hi everyone, I need help.
I want to have a uniform kind distribution. When I used sample function I
got almost twice many zeros compared to other numbers. What's wrong with my
command ?
temp -sample(0:12, 2000, replace=T,prob=(rep(1/13,13)))
hist(temp)
Thanks in advance,
Taka,
hist is lumping things together.
Try:
sum(temp == 0)
compare to the height of the left most bar.
Is this a bug in hist?
- Martin
mirage sell wrote:
Hi everyone, I need help.
I want to have a uniform kind distribution. When I used sample
function I got almost twice many zeros compared to other
It's not the simulated data, but how hist() handled it. If you use
truehist() in the MASS package, you don't see the problem. Nor would you
see it like this:
table(temp)/length(temp)
temp
0 1 2 3 4 5 6 7 8 9 10
11
0.0745 0.0745 0.0830
On Thu, 10 Mar 2005, mirage sell wrote:
Hi everyone, I need help.
I want to have a uniform kind distribution. When I used sample function I
got almost twice many zeros compared to other numbers. What's wrong with my
command ?
Nothing is wrong with your sampling, it is the display in the
On Thu, 10 Mar 2005, Martin C. Martin wrote:
hist is lumping things together.
Try:
sum(temp == 0)
compare to the height of the left most bar.
Is this a bug in hist?
No, hist is the wrong thing to use to display this data.
Try
temp -sample(0:12, 2000, replace=T,prob=(rep(1/13,13)))
On Thu, 2005-03-10 at 20:54 -0600, mirage sell wrote:
Hi everyone, I need help.
I want to have a uniform kind distribution. When I used sample function I
got almost twice many zeros compared to other numbers. What's wrong with my
command ?
temp -sample(0:12, 2000,
My R version s 2.0.1 and I am running it under windows. I want to use R
directly, but
in this case since I could not figure out what went wrong I tried to
transpose it in perl.
Certainly I understand your concern regarding handling numerical data
in Perl. I read the file using read.csv, it
that is because your first object is a data.frame but when you transposed
it you turned it into a matrix. so doing
mat1 - data.frame(matrix(rnorm(20*1532), ncol=20))
mat2 - t(mat1)
dim(sample(mat1, 5, replace=T))
[1] 15325
dim(sample(mat2, 5, replace=T))
NULL
length(sample(mat2, 5,
It seems that sample picks columns when the object is turned into a
data.frame. I do not knoe why it is doing that
Is this something that was meant and not documented or something?
Jean
On Fri, 11 Feb 2005, Adaikalavan Ramasamy wrote:
See below.
On Thu, 2005-02-10 at 14:53 -0800, T.
?sample says:
x Either a (numeric, complex, character or logical) vector of more
than one element from which to choose, or a positive integer
so I guess it wasn't meant to be used on a data frame. However, a data
frame is a list (where the variables are the components), and a list is a
Thanks to all for trying to help me with problem. After spending a long
time, I eventually solved it
by writing a perl script and transposing the matrix and re-reading the
file. When I did this I got an
error saying I had duplicate row names (which in fact was not true or
may be something to
See comments below.
On Fri, 2005-02-11 at 08:47 -0800, T. Murlidharan Nair wrote:
Thanks to all for trying to help me with problem. After spending a long
time, I eventually solved it
by writing a perl script and transposing the matrix
If you plan on doing your analysis mostly in R, it
Just to explain my previous mail, here is the output I get.
dim(tissue.exp)
[1] 1532 20
pick-sample(tissue.exp,5,replace=TRUE)
dim(pick)
[1] 15325
tissue.exp.t-t(tissue.exp)
dim(tissue.exp.t)
[1] 20 1532
pick-sample(tissue.exp.t,5,replace=TRUE)
dim(pick)
NULL
Thanks
OX1 3RB
UK
Tel. 01865 275000
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 25 October 2004 18:32
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [R] sample variogram construction
Okay thanks!
No I have the following difficulty implementing
Hi
Im attempting to build a sample variogram for 300 obersvations
of longitudinal data. So what I need to do is compute the half
squared differences between pairs of residuals (for instance
if a subject has 4 obersvations, this is 4 choose 2 paird differences)
for each subject.
Also, then I
.
Message: 9
Date: Mon, 25 Oct 2004 02:02:06 -0400
From: [EMAIL PROTECTED]
Subject: [R] sample variogram construction
To: [EMAIL PROTECTED]
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII
Hi
Im attempting to build a sample variogram for 300 obersvations of
longitudinal data. So
the
whole lot yourself, unless as a learning excercise.
D
p.s. For time series autocorrelations, you could use acf in package stats.
Message: 9
Date: Mon, 25 Oct 2004 02:02:06 -0400
From: [EMAIL PROTECTED]
Subject: [R] sample variogram construction
To: [EMAIL PROTECTED]
Message-ID: [EMAIL
Hello, I have a simple problem (checked the archives and the appropriate
help pages, to no avail). I want to creat a vector that is length(2000).
The vector is to consist of two strings( std and dev) with 1760 stds
and 240 devs. Furthermore, for each element of the vector, i want the
Mark G Orr [EMAIL PROTECTED] writes:
Hello, I have a simple problem (checked the archives and the
appropriate help pages, to no avail). I want to creat a vector that
is length(2000). The vector is to consist of two strings( std and
dev) with 1760 stds and 240 devs. Furthermore, for each
Look into the code of power.t.test in the stats package. For example,
the sample size for two-sample t-test, two-tail testing and strict
interpretation of tail probability can be found by solving the following
equation iteratively :
\begin{equation}
1 - \beta = \Pr ( t_{v,ncp}^{*} t_{v,
Adaikalavan Ramasamy [EMAIL PROTECTED] writes:
Look into the code of power.t.test in the stats package. For example,
the sample size for two-sample t-test, two-tail testing and strict
interpretation of tail probability can be found by solving the following
equation iteratively :
Dear all,
Could any one please tell me the exact formula R uses to calculate the sample size for
one-sample and two-sample t-tests? Thanks,
Caimiao
[[alternative HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
On Tue, 31 Aug 2004, Caimiao Wei wrote:
Dear all,
Could any one please tell me the exact formula R uses to calculate the
sample size for one-sample and two-sample t-tests? Thanks,
There isn't a formula in closed form. The exact procedure is in the code.
In words: the critical value for the
Hi,
I think you have to do these estimations by hand. However, this shouldn't be
too difficult. For instance the first step of the 2-step Heckman estimation
is a probit estimation that can by done in R by
glm( ... , family=binomial(link=probit))
(see ?glm). And the second step is a simple
-Ursprüngliche Nachricht-
Von: Wildi Marc, wia
Gesendet: Mittwoch, 18. August 2004 10:11
An: [EMAIL PROTECTED]
Betreff:
Hi
Does anybody know from an R-package devoted to sample selection problems
Dear List:
I have the following simple program:
x- sample(site)
VarGuilda1- var(tapply(x,site,func1))
VarGuilda2- var(tapply(x,site,func2))
VarGuilda3- var(tapply(x,site,func3))
VarGuilda4- var(tapply(x,site,func4))
VarGuilda5- var(tapply(x,site,func5))
VarGuilda6-
Rogério Rosa da Silva wrote:
Dear List:
I have the following simple program:
x- sample(site)
VarGuilda1- var(tapply(x,site,func1))
VarGuilda2- var(tapply(x,site,func2))
VarGuilda3- var(tapply(x,site,func3))
VarGuilda4- var(tapply(x,site,func4))
VarGuilda5- var(tapply(x,site,func5))
Others have pointed out `paste' for constructing the file names. What I'd
like to suggest is `cleaning up' the code a bit. Assuming func1, ..., func9
all return a single number, so that each tapply() call returns a vector, you
can try something like:
f1 = mean
f2 = median
f3 = function(x)
[EMAIL PROTECTED] (A.J. Rossini) writes:
For various reasons, I spent part of my time today looking at sample
size and power calculation tools (don't ask, don't tell...). This
seems to be one area that R is incredibly weak in (well, nearly all
stat packages, except perhaps specialized tools
Peter Dalgaard writes:
I think Claus Ekstrøm submitted a modification power.t.test for
unequal sample size, but he wasn't sufficiently assertive that it was
actually done right, so it didn't get in.
It does the calculations right but is not implemented in the most elegant way. See
Dear Peter,
At 12:30 PM 11/11/2003 +0100, Peter Dalgaard wrote:
[EMAIL PROTECTED] (A.J. Rossini) writes:
For various reasons, I spent part of my time today looking at sample
size and power calculation tools (don't ask, don't tell...). This
seems to be one area that R is incredibly weak in
Dear R-users,
I need to sample from a list of names (people) and create 2 random groups with
unique item. Sure sample() function is a good point to start but I can't find
example to solve my work.
any tips? example?
Thank
--
Daniele Medri
__
n1 - 2
n2 - 3
(S - sample(letters, n1+n2))
[1] f a d n l
(S1 - sample(S, n1))
[1] l n
(S2 - S[!is.element(S, S1)])
[1] f a d
hope this helps. spencer graves
Daniele Medri wrote:
Dear R-users,
I need to sample from a list of names (people) and create 2 random groups with
unique item. Sure
On 30 Jun 2003 at 17:11, Daniele Medri wrote:
You should really try to specify better what you want. Lets try
names # character vector with your names
m - length(names)
n1 - 5
n2 - 10
muestra - sample(names, m, replace=FALSE)
muestra1 - muestra[1:n1]
muestra2 - muestra[(n1+1):(n1+n2)]
Is this
R is not S-PLUS, and you need Modern Applied Statistics in S (4th ed) for a
description including R.
sample in R used a PRNG: see ?RNG in R for the details of PRNGs in R.
On Fri, 27 Jun 2003, [iso-8859-1] Ramzi Feghali wrote:
i have a question about the sample function used in R, does it work
On Sun, 30 Mar 2003, Reed, Richard W wrote:
Dear R Users--
I am trying to apply a sample weight variable to my calculations.
The dataset is from the Department of Labor. I believe that NORC constructed
the sample and did the sampling. They sampled nearly 17,000 young adults.
The
R Users
I am a new user of R. I have sample weights that I would like to
apply to some of the variables in my data set. Where can I go for
information on how to do that?
Richard
__
[EMAIL PROTECTED] mailing list
Dear Richard,
See the survey package.
John
At 11:07 AM 3/22/2003 -0800, Reed, Richard W wrote:
I am a new user of R. I have sample weights that I would like to
apply to some of the variables in my data set. Where can I go for
information on how to do that?
Okay.Thanks, Tony.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 22, 2003 1:52 PM
To: Reed, Richard W
Cc: '[EMAIL PROTECTED]'
Subject: Re: [R] Sample weights
No, John means that you need to install the survey package from CRAN,
which
Do any R functions incorporate a sample sample size correction (e.g.,
Burnham and Anderson 1998).
Thanks,
Hank Stevens
Martin Henry H. Stevens, Assistant Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056
Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
They use AIC as defined by its author, Akaike. With good reason: `sample
size' is not a well-defined concept in general, and the R functions are
general.
Most people call the adjusted (I hesitate to call it `corrected') version
`AICC'. I believe the `clarified' 2002 edition of Burnham
71 matches
Mail list logo