Displaying 20 results from an estimated 4000 matches similar to: "pwr.2p2n.test when the ratio of n1/n2 is known"
2008 Dec 16
1
pwr.prop.test and continuity correction
Hi,
I am trying to sort out a discrepancy between power calculations results
between me and another statistician. I use R but I am not sure what she
uses. It is on the proportions test and so I have been using
pwr.prop.test. I think I have tracked the problem down to pwr.prop.test
not using the continuity correction for the test (I did this by using
the java applet from
2008 Jun 20
2
Problems with basic loop
I'm having trouble creating a looping variable and i can't see wher ethe
problem arises from any hep gratfully appreciated
First create a table
x<-table(SURVEY$n_0,exposed)
> x
exposed
False True
Under 16 24 1
16-19 68 9
20-24 190 37
25-34 555 204
35-44 330 87
45-54 198 65
55-64 67 35
65+
2010 Sep 21
2
Trouble installing pwr package
Hi all,
I'm having trouble getting access to the pwr. This is on Ubuntu Lucid Lynx,
64 bit.
I'm installing pwr via packages.install('pwr'), and loading it via
library(pwr), both of which appear successful.
Strangely, I never get access to the pwr object in R.
I tried installing it to /usr/local/lib/R/site-library and
~/R/x86_64-pc-linux-gnu-library.
I also tried installing it
2009 Apr 06
2
Collapse data matrix with extra info separated by commas
Hello,
I would like to reshape my data for presentation purposes from something
like this:
> test <-
data.frame(a=c("A","A","A","A","B","B","B"),b=c(1,1,2,2,1,1,1),c=1:7)
> test
a b c
1 A 1 1
2 A 1 2
3 A 2 3
4 A 2 4
5 B 1 5
6 B 1 6
7 B 1 7
to something like this:
a b c
1 A 1 1,2
3 A 2 3,4
5 B 1 5,6,7
This seems
2009 Apr 28
1
Mathematical label in a plot with a percent sign
Hi,
I am trying to produce a plot with an xlabel that reads (x >= 5%) with
the >= turned into the correct epression. I can do this up to the
percentage sign by specifiing xlab=expression(x>=5). Whatever I do to
include the % sign as well doesn't seem to work.
xlab=bquote(x>=5.("%")) almost works but includes brackets.
Anyonw know how to solve this one
Dan
PS I am
2009 Dec 02
1
Extract html tables to data.frames
Hello,
I would like to scrape some html tables from a web page and convert them
to a data.frame so I can perform further analysis. Could anyone tell me
the best way to do this? Would it be more appropriate to use an
external tool first?
Thanks
Dan
--
**************************************************************
Daniel Brewer, Ph.D.
Institute of Cancer Research
Molecular Carcinogenesis
2010 Nov 19
1
expand comma separated field vertically in data.frame
Hello,
I have a data.frame like this:
a 1,2,3,4 b1
b 6,7 b3
And I would like to transform it to this:
a 1 b1
a 2 b1
a 3 b1
a 4 b1
b 6 b3
b 7 b3
I have been looking at ddply but can't seem to work it out. ANy help
would be gratefully received.
Dan
--
**************************************************************
Daniel Brewer, Ph.D.
Institute of Cancer Research
Molecular Carcinogenesis
2009 Jun 24
1
order by decerasing 1st variable and increasing 2nd variable
Hello,
I have a data.frame which I would like to sort with the primary key
decreasing while the secondry key is increasing e.g.
x <- data.frame(One=c(1,1,1,2,2,3,4,5),Two=c(2,3,1,2,3,3,3,3))
I would like to order it so it looks like this:
One Two
8 5 3
7 4 3
6 3 3
4 2 2
5 2 3
3 1 1
1 1 2
2 1 3
i.e. primarily decreasing in the 1st column but if there is a
2008 Jun 17
1
Z test and proportions
Hi All,
I have a table based on ordial data and i want to compare proportions and
i've seen in the pwr package i can use
power.prop.test
however i want to find out what the sig. value is based on n1,n2,p1,p2 and
this package doesn't contain this..
Does anyone know of a package that does or is it a case of writting a
function specifically for this?
Many thanks in advance
[[alternative
2008 Mar 26
1
Adding name labels to x-axis of matplot
Hello,
I have a gene expression matrix with columns being samples and rows
being genes. I would like to display the expression values for each
gene. I have two groups which I colour differently. The aim is to see
if there is any difference between the two groups consistently across genes.
So the following works well:
2009 Dec 23
2
COnfidence intervals for estimates of linear model
Hello,
I would like to calculate the 95% confidence intervals for the estimates
of a linear model and I just wanted to check that I am doing it correct.
Is it just:
Estimate + 1.95996*Std.Error to Estimate - 1.95996*Std.Error
or is there another approach that doesn't assume a normal distrbution?
Thanks. Apologies for my naiivity
Dan
--
2010 Dec 10
1
melt causes errors when characters and values are used
Hello,
I am finding that the melt function from the reshape library causes
errors when applied to a data.frame that contains numeric and character
columns. For example,
melt(id.vars="ID",data.frame(ID=1:3,date=c("a","b","c"),value=c(1,4,5)))
ID variable value
1 1 date a
2 2 date b
3 3 date c
4 1 value <NA>
5 2
2008 Jun 17
3
Capturing coxph warnings and errors
Hi,
I have a script that takes a subset of genes on a microarray and tries
to fit a coxph model to the expression values for each gene. This seems
to work fine but in some cases it produces warnings and/or errors.
For example:
Error in fitter(X, Y, strats, offset, init, control, weights = weights, :
NA/NaN/Inf in foreign function call (arg 6)
In addition: Warning message:
In fitter(X, Y,
2010 Dec 02
1
Suitable test for ordinal variable vs continuous variable trend
Dear all,
For a population of about 200 I have a continuous variable and an ordinal variable. The question I would like to ask is whether the continuously increases (or decreases) as the rank of the ordinal variable increases. I was thinking that a Spearmen's rank correlation or or a chi squared trend might be appropriate. I don't have any experience dealing with ordinal variables so I
2009 Jan 20
2
Stacked barplot with two stacked bars besides each other
Hi,
I have a particular barplot I would like to generate, but I am having
trouble getting it to work. What I would like is in effect two barplots
with stacked bars merged into one. For example, I have two samples
(yoda1,yoda2) on which I measure whether two variables (var1,var2) are
present or absent for a number of measurements on that sample.
> var1 <- data.frame(yoda1=c(3,7),
2009 Sep 08
2
Fitting a linear model with a break point
Hello,
I would like to test some data to see whether it has the shape of a step
function (i.e. y1 up until x_th and then y2 where x_th is the
threshold). The threshold x_th is unknown and the x values can only
take discrete values (0,1,2,3,4).
An example would be:
data<- data.frame(x=1:20,y=c(rnorm(10),rnorm(10,10)))
I was thinking along the lines of fitting some sort of piiecewise linear
2008 Jan 31
3
Log rank test power calculations
Does anyone have any ideas how I could do a power calculation for a log
rank test. I would like to know what the suggested sample sizes would
be to pick a difference when the control to active are in a ratio of 80%
to 20%.
Thanks
Dan
--
**************************************************************
Daniel Brewer, Ph.D.
Institute of Cancer Research
Email: daniel.brewer at icr.ac.uk
2009 May 05
2
Bristol mirror GPG problem ubuntu repository
Hello,
I am getting a GPG error with the ubuntu repository at the bristol UK
mirror.
When my source.list has this line:
deb http://www.stats.bris.ac.uk/R/bin/linux/ubuntu/ intrepid/
On an "apt-get update" you get this:
W: GPG error: http://www.stats.bris.ac.uk intrepid/ Release: The
following signatures were invalid: BADSIG D67FC6EAE2A11821 Vincent
Goulet <vincent.goulet at
2008 May 08
1
cpower and censoring
I would like to do some power estimations for a log-rank two sample test
and cpower seems to fit the bill. I am getting confused though by the
man page and what the arguments actually mean. I am also not sure
whether cpower takes into account censoring or not.
Could anyone provide a simple example of how I would get the power for a
set control/non-control clinical trial where censoring occurs at
2009 Jan 27
2
Memory issue?
I have a script that sometimes produces the following error:
Error in assign(".target", method at target, envir = envir) :
formal argument "envir" matched by multiple actual arguments
Do you think this is a memory issue? I don't know what else it could be
as it doesn't always occur even if the script is run with exactly the
same data.
Does rm() actually free up