[R] Pooled mean square error for regression

2013-05-31 Thread David A.
Hi, I would like to compare two batches of a product over time to see if they behave similarly, i.e same slope and intercept. This is a stability study. I will be performing ANCOVA analysis for this. According to ICH and FDA guidelines, if the test rejects the hypothesis of equality of slopes,

[R] difference percentile R vs SPSS

2012-11-08 Thread David A.
Dear list, I am calculating the 95th percentile of a set of values with R and with SPSS In R: > normal200<-rnorm(200,0,1) > qnorm(0.95,mean=mean(normal200),sd=sd(normal200),lower.tail =TRUE) [1] 1.84191 In SPSS, if I use the same 200 values and select Analyze -> Descriptive Statistics -> Freq

Re: [R] SOLVED boxplot knowing Q1, Q3, median, upper and lower whisker value

2010-09-13 Thread David A.
p@r-project.org > > is.nan(bd.coerce(as.bdVector(c(1.0, N> -Original Message- > > From: r-help-boun...@r-project.org > > [mailto:r-help-boun...@r-project.org] On Behalf Of Brian Diggs > > Sent: Thursday, September 09, 2010 12:41 PM > > To: David A. > >

[R] using apply function and storing output

2010-10-15 Thread David A.
Hi list, I have a 1710x244 matrix of numerical values and I would like to calculate the mean of every group of three consecutive values per column to obtain a new matrix of 570x244. I could get it done using a for loop but how can I do that using apply functions? In addition to this, do I hav

Re: [R] using apply function and storing output

2010-10-15 Thread David A.
Dave Date: Fri, 15 Oct 2010 00:45:08 -0700 Subject: Re: [R] using apply function and storing output From: djmu...@gmail.com To: dasol...@hotmail.com CC: r-help@r-project.org Hi: Look into the rollmean() function in package zoo. HTH, Dennis On Fri, Oct 15, 2010 at 12:34 AM, David A. wrote: H

Re: [R] using apply function and storing output

2010-10-15 Thread David A.
165064 This is a simplistic example, but it should get you started. HTH, Dennis On Fri, Oct 15, 2010 at 2:00 AM, David A. wrote: Hi Dennis and Dimitris, thanks for your answers. I am trying the rollmean() function and also the rollapply() function because I also want to calculate CV for th

[R] CI using ci.numeric

2010-10-20 Thread David A.
Hi, I am trying to calculate confidence intervals using ci.numeric from epicalc package. If I generate a normal set of data and find the 99% and 95% CI, they seem too narrow to me. Am I doing something wrong?? The IQR goes from -0.62 to 0.62, so I thought the CI limits should be more extreme t

[R] select data for boxplot

2011-01-10 Thread David A.
Dear list, havig the following matrix "Value" "Class" 13.001 12.801 11.781 11.702 11.612 11.952 11.552 12.403 11.401 12.271 12.493 11.394 11.804 12.393 12.723 12.183 11.643 11.504 12.814 11.314 11.952 12.652

[R] boxplot knowing Q1, Q3, median, upper and lower whisker value

2010-09-06 Thread David A.
Dear list, I am using a external program that outputs Q1, Q3, median, upper and lower whisker values for various datasets simultaneously in a tab delimited format. After importing this text file into R, I would like to plot a boxplot using these given values and not the original series of data

[R] add text to abline

2011-02-17 Thread David A.
Hi, how could I add a small text note to a vertical or horizontal line? x <- rnorm(50) y <- rnorm(50) plot(x,y) abline(h=0) I would like to add the text "cutoff" just above it. Thanks, D. [[alternative HTML version deleted]] __

[R] calibration curve for glmnet object

2012-01-02 Thread David A.
Hi, I created a logistic regression model using the glmnet package. This model is of class "glmnet" or "lognet". I wanted to plot a calibration curve for this model using the calibrate() function from rms package, but the objects used are different, rms requires a fit from lrm(). Is there anot

Re: [R] calibration curve for glmnet object

2012-01-03 Thread David A.
Ok, so just for anyone's interest, I managed to create the calibration plot for the glmnet object using the val.prob() function from the rms package. Now, my question moves slightly, how can I superimpose calibration curves from two models, so that they can be graphically compared? This is wha

[R] non-parametric sample size calculation

2011-11-03 Thread David A.
Hi, I am trying to estimate the sample size needed for the comparison of two groups on a certain measurement, given some previous data at hand. I find that the data collected does not follow a normal distribution, so I would like to use a non-parametric option for sample size calculation. I f

[R] R-bash beginner

2011-11-07 Thread David A.
Hi, I am trying to run some R commands into my bash scripts and want to use shell variables in the R commands and store the output of R objects into shell variables for further usage in downstream analyses. So far I have managed the first, but how to get values out of R script? I am using "he

Re: [R] R-bash beginneR

2011-11-08 Thread David A.
ntrollers) .OO#. .OO#. rocks...1k > --- > Sent from my phone. Please excuse my brevity. > > "David A." wrote: > > > > >Hi, > > > >I am trying to run some R commands into my bash

[R] help upgrading R in Ubuntu

2012-01-23 Thread David A.
Hi, I am trying to upgrade my R version but am having some error trying to get the key for automatic upgrading from aptitude (ubuntu 11.04). This is what I did, following instructions from http://cran.r-project.org/bin/linux/ubuntu/ I added the repository address to my software manager. deb htt

[R] Unintended loading of package:datasets

2009-05-10 Thread David A Vavra
The dataset package is being loaded apparently by one of the packages that I am using. The loading of the datasets takes a long time and I would like to eliminate it. I thought the datasets were effectively examples so don't understand why they would be required at all. 1) How can I determine what

Re: [R] Unintended loading of package:datasets

2009-05-10 Thread David A Vavra
PM To: David A Vavra Cc: r-help@r-project.org Subject: Re: [R] Unintended loading of package:datasets On 11/05/2009, at 9:17 AM, David A Vavra wrote: > The dataset package is being loaded apparently by one of the > packages that I > am using. The loading of the datasets takes a long t

[R] Help with RGL package problem

2010-12-15 Thread David A. Johnston
Hello, I have been experiencing an odd error with the RGL package that I cannot figure out. I have searched without luck for fixes to this problem on Rseek, Google, and the R-help-list. RGL used to work on my machine about a month ago. It was a very useful tool. The graphics device will not i

Re: [R] Help with RGL package problem

2010-12-15 Thread David A. Johnston
Thank you Joshua and Duncan for your very quick responses. Joshua, I will indeed read more about the OpenGL and GLU systems. Duncan, I am running R via a console. I also tried via the GUI R.app and the same problems with loading the package and opening a graphics device occurred. I find it

Re: [R] Parsing a Simple Chemical Formula

2010-12-26 Thread David A. Johnston
There might be something simpler, but this is what I came up with: form = "C5H11BrO" ups = c(gregexpr("[[:upper:]]", form)[[1]], nchar(form) + 1) seperated = sapply(1:(length(ups)-1), function(x) substr(form, ups[x], ups[x+1] - 1)) elements = gsub("[[:digit:]]", "", seperated) nums = gsub("[[:al

Re: [R] Interactive plots or graphics libraries for R?

2011-05-24 Thread David A. Johnston
I recommend the 'rgl' package. It can draw 3d scatterplots, shapes, and surfaces. You can spin, and zoom in with the mouse. You can record a "movie" of the rotating graphic. http://cran.r-project.org/web/packages/rgl/index.html -David Johnston -- View this message in context: http://r.7896

Re: [R] Sorting Dataframes

2011-06-07 Thread David A. Johnston
Here's one way: # Here I read in your data to a variable 'x' x = read.delim(textConnection( "Bin Depth Fish 1 4 2 1 8 24 1 12 4 2 4 3 2 8 21 2 12 2 3 4 12 3 8 2 3 12 33"), sep = " ", header = TRUE) do.call(rbind, lapply(split(x, x$Bin), function(grp) grp[which.max(grp$Fish),])) -- View this mes

Re: [R] sapply puzzlement

2011-01-27 Thread David A. Johnston
sapply(z, function(row) ...) does not actually grab a row at a time out of 'z'. It grabs a column (because 'z' is a data.frame) You may want: t(apply(z, 1, function(row) row - means)) or: t(t(z) - means) Hope that helps, -David Johnston -- View this message in context: http://r.789695.n4.n

Re: [R] identical values not so identical? newbie help please!

2011-03-10 Thread David A. Johnston
The function all.equal also might be helpful. See the help page. >help(all.equal) -David Johnston -- View this message in context: http://r.789695.n4.nabble.com/identical-values-not-so-identical-newbie-help-please-tp3346078p3346581.html Sent from the R help mailing list archive at Nabble.com.

[R] Where are the ticks on grid.xaxis?

2011-08-18 Thread David A. Johnston
Hi R list, I like the default ticks that are set up using grid.xaxis() or grid.yaxis() with no arguments. Finding good values for the 'at' argument is usually not a trivial task; the default behavior of these functions seems to work well. The problem with this strategy is that I cannot figure ou

[R] Trapping option settings

2012-07-16 Thread David A Vavra
Something has been changing the setting the width option to 1 and not resetting it. It does this intermittently. What I would like to do is trap changing the setting so I can determine where the change is occurring and hopefully fix it. Is there any easy way to do this? __

Re: [R] Trapping option settings

2012-07-18 Thread David A Vavra
it a try. DAV -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: Monday, July 16, 2012 9:59 PM To: David A Vavra Cc: r-help@r-project.org Subject: Re: [R] Trapping option settings Here is one way by redefining 'options' so you can check for 'width' a

Re: [R] Trapping option settings

2012-07-18 Thread David A Vavra
Thanks. Also helpful. DAV -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Wednesday, July 18, 2012 4:20 PM To: David A Vavra; 'jim holtman' Cc: r-help@r-project.org Subject: RE: [R] Trapping option settings Try using trace(), as in trace(opti

Re: [R] Pulling data from remote MySQL database

2011-06-21 Thread David A. Johnston
Hi Joseph, I know that the RMySQL and RODBC packages allow you to pull the result of a MySQL query into a data.frame within R. I like RODBC because you can access many different flavors of RDBMS's. -David Johnston -- View this message in context: http://r.789695.n4.nabble.com/Pulling-data-f

[R] Iterative sampling with restrictions

2012-08-20 Thread David A. Kim
Hi all, I'm working on a seemingly trivial problem that I can't figure out how to implement in R. I'd be most grateful for any help here. I want to do the following: first, randomly assign each of n units to one of g groups of size n/g. Then, randomly re-assign each of the n units to a different

[R] Indexing multi-dimensional table

2011-12-22 Thread David A Vavra
I want to take slices of a multi-dimensional table (or array) without knowing the number of dimensions in advance. As a test I tried using (in this example a 3d table): do.call(`[`, list(tbl, x,NULL,NULL)] where I built the list on the fly. It works great as long as I only want th

Re: [R] Indexing multi-dimensional table

2011-12-22 Thread David A Vavra
> (This does imply you knew the number of dimensions was 3.) Yes, at run time. >It looks as though the Nulls became 0's. So if you wanted to use >do.call(`[` then this succeeds: > do.call(`[`, list(tbl, x, 1:dim(tbl)[2], 1:dim(tbl)[3]) ) ... >As does this using the "empty comma" approach: >

Re: [R] Indexing multi-dimensional table

2011-12-22 Thread David A Vavra
>From: William Dunlap [mailto:wdun...@tibco.com] >You can build the 2nd argument to do.call with alist() instead. >alist() produces a list that you can use c() and subscripting on >to add or modify arguments. It is usually better to encapsulate >this sort of thing in a function like extract() tha

[R] Replicating Stata's xtreg clustered SEs in R

2012-03-12 Thread David A. Kim
I'm trying to replicate a time-series cross-sectional analysis (countries over years) with SEs clustered by country.  The original analysis was done in Stata 10 with: xtreg [DV] [IVs] fe cluster(country). Using plm() in R (cran.r-project.org/web/packages/plm/index.html), I've replicated the coeffi

[R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
I have a large number of 3d tables that I wish to sum Is there an efficient way to do this? Or perhaps a function I can call? I tried using do.call("sum",listoftables) but that returns a single value. So far, it seems only a loop will do the job. TIA, DAV _

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
for a more elegant and hopefully more efficient solution. Greg's suggestion for using reduce seems in order but as yet I'm unfamiliar with the function. DAV -Original Message- From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Monday, April 16, 2012 12:42 PM To: Greg Snow C

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
g] On Behalf Of Petr Savicky Sent: Monday, April 16, 2012 11:07 AM To: r-help@r-project.org Subject: Re: [R] Effeciently sum 3d table On Mon, Apr 16, 2012 at 10:28:43AM -0400, David A Vavra wrote: > I have a large number of 3d tables that I wish to sum > Is there an efficient way to do this?

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
know what that means and implies. I'm sure I'll understand it once I know what it is trying to say. :) There's an item in the examples which may be exactly what I'm after. DAV -Original Message- From: Greg Snow [mailto:538...@gmail.com] Sent: Monday, April 16, 2012

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
s[!dovec]), SIMPLIFY = SIMPLIFY, USE.NAMES = USE.NAMES)) } DAV -Original Message- From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Monday, April 16, 2012 3:07 PM To: David A Vavra Cc: r-help@r-project.org Subject: Re: [R] Effeciently sum 3d table David: 1. My first name is Bert.

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Monday, April 16, 2012 3:26 PM To: David A Vavra Cc: 'Petr Savicky'; r-help@r-project.org Subject: Re: [R] Effeciently sum 3d table On Apr 16, 2012, at 2:43 PM, David A Vavra wrote: > Thanks Petr, > > I'm

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
lliam Dunlap [mailto:wdun...@tibco.com] Sent: Monday, April 16, 2012 3:26 PM To: David A Vavra; 'Bert Gunter' Cc: r-help@r-project.org Subject: RE: [R] Effeciently sum 3d table > Example in partial code: > > Env <- CreatEnv() # my own function > Assign('fin

[R] Add grid lines to levelplot

2012-01-16 Thread David A Vavra
I'm using the levelplot function in the lattice package. I am plotting a grid of cells and I want grid lines drawn between cells. I've spent a lot of time trying different options. I've also looked at panel.levelplot. The border parameter seems to be ignored or it doesn't mean cell border color.

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
FUN <- match.fun(FUN) dots <- list(...) answer <- .Call("do_mapply", FUN, dots, MoreArgs, environment(), PACKAGE = "base") ... etc. -Original Message- From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Monday, April 16, 2012 4:13 PM To

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
onday, April 16, 2012 4:55 PM To: David A Vavra Cc: r-help@r-project.org Subject: Re: [R] Effeciently sum 3d table On Apr 16, 2012, at 4:04 PM, David A Vavra wrote: >> even now you _could_ be clearer > > I fail to see why it's unclear. > >>> I'm after T1 + T2

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
Thanks again, Greg. I must have gotten up on the wrong side of the keyboard this morning and been having a spate of dim insight. What you've said here makes things clearer. DAV -Original Message- From: Greg Snow [mailto:538...@gmail.com] Sent: Monday, April 16, 2012 5:42 PM To: Da

[R] Multiple equation models in time-series cross-section (panel) data

2012-04-19 Thread David A. Kim
Hello, Could anyone recommend a package for multiple (i.e., structurally linked) equation models for time-series cross-section data? I've been using the "plm" package for single-equation, fixed effects models, but have not been able to find a package with similar functionality for models with mul

[R] step function stops with "subscript out of bounds"

2012-05-17 Thread David A Vavra
I've been having a problem using the step function to evaluate models. I've simplified the code and get the same problem using the dataset Titanic. The relevant code and output is below. The problem disappears (i.e., 'step' runs correctly) if I rerun the code but change the 'loglm' call to explicit

Re: [R] step function stops with "subscript out of bounds"

2012-05-17 Thread David A Vavra
it in an environment in the search path. DAV -Original Message- From: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] Sent: Thursday, May 17, 2012 6:46 AM To: David A Vavra Cc: r-help@r-project.org Subject: Re: [R] step function stops with "subscript out of bounds"