[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 pl

Re: [R] Alternating between "for loops"

2012-08-14 Thread Claudia Penaloza
> I'm not sure it works, but try the following. > > > for(j in which(dtp)){ > for (q in 1:N){ > if(y[q, j] %in% c("d", "D")) break > [...etc...] > > and in the other loop the same, > > > for (j in which(!dtp)) { > for (q in

Re: [R] Alternating between "for loops"

2012-08-10 Thread Claudia Penaloza
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 wrote: > Answers inserted in BLUE below > > On Thu, Aug 2, 2012 at 5:34 PM, Claudia

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 wrote: > 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 suggestions/

Re: [R] Alternating between "for loops"

2012-08-02 Thread Claudia Penaloza
ado<=PsiAd){ >> y[q,j]="d" >> }else(y[q,j]="D") >> > > # ---Perhaps > deado <- runif(N, 0,1) > y[ , j] <- ifelse( deado<=PsiAd, "d", "D") > #--

Re: [R] Alternating between "for loops"

2012-07-31 Thread Claudia Penaloza
uot;A" "B" "1" "2" "A" "B" "1" "2" > [8,] "1" "2" "A" "B" "1" "2" "A" "B" "1" "2" > [9,] "1"

[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 "run

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 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 perfectl

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

2012-07-03 Thread Claudia Penaloza
2 00d000**00 0.002456 >>> 3 0T0000**00 0.007368 >>> 4 0DT000**00 0.007368 >>> >>> 5 0T**00 0.0024

[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 vers

[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 <- c(987,937,810,74

[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: https://docs.google.com/fileview?

[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 "e

[R] GAM, GAMM and numerical integration, help please

2010-05-13 Thread Claudia Penaloza
I am trying to apply methods used by Chaloupka & Limpus (1997) ( http://www.int-res.com/articles/meps/146/m146p001.pdf) to my own turtle growth data. I am having trouble with two things... 1) After the GAM is fit, the residuals are skewed. >m1 <- gam(growth~s(mean.size, bs="cr")+s(year,bs="cr",k

[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 rpar

[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, http://w

[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)) sm.densit