[R] Plot to tiff, font size problem in multiple plot figures

2012-09-20 Thread Claudia Penaloza
I am creating graphs for a publication and would like them to have the same font size... but when I create a figure with multiple plots, the font size decreases even though I haven't changed the tiff() resolution or pointsize specifications, I have increased the figure size according to how many

Re: [R] Alternating between for loops

2012-08-14 Thread Claudia Penaloza
, D)) break [...etc...] Em 10-08-2012 20:42, Claudia Penaloza escreveu: This is what my code looks like now. However, there is one thing I can't/don't know how to fix. I can't get it to be once dead always dead, i.e., in any given row, after a D or a d there should be only zeros. I've

Re: [R] Alternating between for loops

2012-08-10 Thread Claudia Penaloza
{ observable - runif(1, 0, 1) = PsiaA } if (observable) { if (runif(1, 0, 1) = p) y[q, j] - A } } else { if (observable) { if (runif(1, 0, 1) = c) y[q, j] - A } } } } On Wed, Aug 8, 2012 at 2:04 PM, Claudia Penaloza claudiapenal

Re: [R] Alternating between for loops

2012-08-08 Thread Claudia Penaloza
Answers inserted in BLUE below On Thu, Aug 2, 2012 at 5:34 PM, Claudia Penaloza claudiapenal...@gmail.comwrote: Thank you very much for all your suggestions. I am very sorry my code is so crude (it gives me a headache too!), I'm very new to R programing. I will have to look at your

Re: [R] Alternating between for loops

2012-08-02 Thread Claudia Penaloza
]=A } } } } } There are a lot of unnecessary tests and conditions. I tried to break down the code and write the tests that have been done when assigning a variable. I simplified your the first part but cannot guarantee that all criteria are met. Regards, Eloi On 12-08-01 09:47 AM, Claudia Penaloza

Re: [R] Alternating between for loops

2012-07-31 Thread Claudia Penaloza
:28 PM, Rui Barradas wrote: Hello, Maybe something along the lines of J - 10 cols - rep(c(TRUE, TRUE, FALSE, FALSE), 3)[seq_len(J)] for(i in which(cols)) { do something } for(i in which(!cols)) { do something else } Hope this helps, Rui Barradas Em 31-07-2012 00:18, Claudia Penaloza

[R] Alternating between for loops

2012-07-30 Thread Claudia Penaloza
Dear All, I would like to apply two different for loops to each set of four columns of a matrix (the loops here are simplifications of the actual loops I will be running which involve multiple if/else statements). I don't know how to alternate between the loops depending on which column is running

Re: [R] Removing rows if certain elements are found in character string

2012-07-03 Thread Claudia Penaloza
0.002456 , header=TRUE) dd i1 - grepl(^([0D]|[0d])*$, dd$ch) i2 - grepl(^0*[Dd], dd$ch) dd[!i1, ] dd[!i2, ] dd[!(i1 | i2), ] Hope this helps, Rui Barradas Em 02-07-2012 23:48, Claudia Penaloza escreveu: I would like to remove rows from the following data frame (df

Re: [R] Removing rows if certain elements are found in character string

2012-07-03 Thread Claudia Penaloza
Got it! Thank you Rui! cp On Tue, Jul 3, 2012 at 10:14 AM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, I'm glad it helped. See answer inline. Em 03-07-2012 17:09, Claudia Penaloza escreveu: Thank you Rui and Jim, both 'i1' and 'i1new' worked perfectly because there are no instances

[R] Removing rows if certain elements are found in character string

2012-07-02 Thread Claudia Penaloza
I would like to remove rows from the following data frame (df) if there are only two specific elements found in the df$ch character string (I want to remove rows with only 0 D or 0 d). Alternatively, I would like to remove rows if the first non-zero element is D or d.

[R] sm.density.compare, date on x axis?

2011-01-24 Thread Claudia Penaloza
Is it possible to generate a density plot comparing several (6 or 7) groups of data and have the x-axis in date format (e.g.: %d%b, 10Mar)? When I try to input the data in date format I get an error saying this function only allows 1-d data. Thank you, Claudia [[alternative HTML version

[R] How to plot confidence bands for nls

2010-07-06 Thread Claudia Penaloza
I adjusted an exponential regression to the following data and wish to plot confidence bands as well. Is this possible? Any help greatly appreciated. Claudia x - c(1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001, 2002,2003,2004,2005,2006,2007,2008,2009) y -

[R] GAM vs. GAMM, how to model increasing error variance?

2010-05-17 Thread Claudia Penaloza
I fit a GAM to turtle growth data using mgcv: m1 - gam(growth~s(mean.size, bs=cr)+s(year,bs=cr,k=7)+s(cohort,bs=cr)+s(age,bs=cr), data=grow, family=quasi(link=identity)) The errors are skewed (and seem to be correlated with age) (code and plots here:

[R] Cubic B-spline, how to numerically integrate?

2010-05-14 Thread Claudia Penaloza
(corrected version of previous posting) I fit a GAM to turtle growth data following methods in Limpus Chaloupka 1997 (http://www.int-res.com/articles/meps/149/m149p023.pdf). I want to obtain figures similar to Fig 3 c f in Limpus Chaloupka (1997), which according to the figure legend are

[R] rpart, cross-validation errors question

2010-05-02 Thread Claudia Penaloza
I ran this code (several times) from the Quick-R web page ( http://www.statmethods.net/advstats/cart.html) but my cross-validation errors increase instead of decrease (same thing happens with an unrelated data set). Why does this happen? Am I doing something wrong? # Classification Tree with

[R] plotting rpart objects, text.rpart, fancy option

2010-04-10 Thread Claudia Penaloza
I have created plots of rpart objects with the fancy option for text.rpart (fancy creates ellipses and rectangles and labels branches with splitting criteria). The ellipses and rectangles are supposed to interrupt the tree lines (as seen in Therneau and Atkinson 1997, page 48, Fig. 18,

[R] sm.density.compare

2009-05-04 Thread Claudia Penaloza
I've been using the sm.denstiy.compare function and would like to know some specifics: a) What kind of bootstrap sampling is used, with or without replacement? b) A p-value is returned after running the following script (for example): library(sm) y - rnorm(100) g - rep(1:2, rep(50,2))