Re: [R] regular expressions : extracting numbers

2007-07-30 Thread Christian Ritz
Dear David, does the following work for you? sVec - c(lema, rb 2%, rb 2%, rb 3%, rb 4%, rb 3%, rb 2%,mineuse, rb, rb, rb 12, rb, rj 30%, rb, rb, rb 25%, rb, rb, rb, rj, rb) reVec - regexpr([[:digit:]]+, sVec) # see ?regex for details on '[:digit:]' and '+' substr(sVec ,start = reVec,

Re: [R] dose-response on a grid

2007-07-12 Thread Christian Ritz
Hi Bill, have a look at the following artificial example: ## Loading the package 'drc' (on CRAN) library(drc) ## Generating dataset with four dose-response curves finneyx4 - rbind(finney71, finney71, finney71, finney71) ## Generating artificial points (x,y) ## different pairs for each of the 4

[R] Research assistant in biostatistics in Copenhagen

2007-06-14 Thread Christian Ritz
The Statistics Group at the Department of Natural Sciences, Faculty of Life Sciences, University of Copenhagen, is looking for a research assistant with R skills. For details see: http://www.matfys.kvl.dk/~torbenm/eu Please note that the deadline for applications is June 22 2007. Christian

Re: [R] ED50 from logistic model with interactions

2007-05-02 Thread Christian Ritz
Hi Kate, try looking at the package 'drc' on CRAN and in particular look at the example in the help page for the dataset 'daphnids' (?daphnids). You can obtain arbitrary ED values with approximate standard errors using the function 'ED'. Christian

Re: [R] glm() problem

2007-04-07 Thread Christian Ritz
Hi, try using the function 'glm.control' in the first place: glm(n~., data = mDat, family = poisson, control = glm.control(trace = TRUE)) Christian __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

[R] Error in nlme with factors in R 2.4.1

2007-03-20 Thread Christian Ritz
Hi, the following R lines work fine in R 2.4.0, but not in R 2.4.1 or any devel versions of R 2.5.0 (see below for details). library(drc) # to load the dataset 'PestSci' library(nlme) ## Setting starting values sv - c(0.43355869, 2.49963220, 0.05861799, 1.73290589, 0.38153146, 0.24316978)

Re: [R] Select the last two rows by id group

2007-03-20 Thread Christian Ritz
Hi Lauri, here is a little modification of the solution for retrieving the last row only : score[as.vector(unlist(tapply(rownames(score), score$id, tail, 2))),] giving the last two rows. Replacing 2 by 6 or 10 gives you the last 6 or 10 rows (if they exist). Christian

[R] nlme with a factor in R 2.4.0beta

2006-09-25 Thread Christian Ritz
Hi, the following R lines work fine in R 2.4.0 alpha (and older R versions), but not in R 2.4.0 beta (details below): library(drc) # to load the dataset 'PestSci' library(nlme) ## Starting values sv - c(0.328919, 1.956121, 0.097547, 1.642436, 0.208924) ## No error m1 - nlme(SLOPE ~ c +

Re: [R] linear terms within a nonlinear model

2006-09-25 Thread Christian Ritz
Hi, the contributed package 'drc' allows specification of non-linear regression models with individual parameter models that include covariates. For an example see section 8 the accompanying paper in J. Statist. Software (http://www.jstatsoft.org/v12/i05/v12i05.pdf). Christian

Re: [R] How to request AIC information from lm object?

2006-06-09 Thread Christian Ritz
Hi Michael, use: extractAIC to get AIC from an lm object: y - rnorm(10) extractAIC(lm(y~1)) Christian __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!

Re: [R] problems while correlating values

2006-05-28 Thread Christian Ritz
Hi. Try compute the correlation for the transposed data frame: cor( t(person.data), use=pairwise.complete.obs ) Assuming that your data frame person.data contains NAs to indicate where no value is available, I think the following computation yields N: (!is.na(person.data)) %*%

Re: [R] How to reference R in papers?

2006-05-22 Thread Christian Ritz
Hi JJ, try the following function in R: citation() Christian __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] how to vectorize a matrix

2006-05-22 Thread Christian Ritz
Hi Lorenzo, maybe the following example is of use? a - matrix(1:25,5,5) stack(as.data.frame(a[, c(1,3,5,2,4)])) Note that 'stack' takes a data frame or list as first argument (not a matrix). Therefore the matrix is first converted to a data frame using 'as.data.frame'. Christian

Re: [R] probit analysis

2006-05-08 Thread Christian Ritz
Hi Jinsong, you can use the package drc on CRAN to fit logit and Weibull models (but not the probit model) with natural mortality/response and/or natural immunity to binomial data (maximum likelihood estimation). To get an idea try: library(drc) ?earthworms Christian

Re: [R] nls and factor

2006-04-26 Thread Christian Ritz
Hi Manuel, an alternative to the approach pointed out by Prof. Ripley is to use the package 'drc' which allows one or more parameters in a non-linear regression model to depend on a factor. You will need the latest version available at www.bioassay.dk (an older version is available on CRAN).

Re: [R] SE estimates for treatment groups from nlme

2006-04-10 Thread Christian Ritz
Hi Katie, maybe the easiest solution is to create a new factor that corresponds to the combinations of the three factors A, B and C. A quick and dirty way to create such a factor is: ABC - factor(paste(A, x, B, x, C, sep = )) ABC and then fit the model using the variable ABC instead of A*B*C.

Re: [R] How to get around heteroscedasticity with non-linear least squares in R?

2006-02-22 Thread Christian Ritz
Hi Quin, the package 'drc' on CRAN deals with modelling dose-response curves. Moreover it allows adjustment for heterogeneity by means of transformation (Box-Cox transformation) modelling the variance as a power of the mean. See the package documentation for more features. Christian

Re: [R] calculating IC50

2006-02-02 Thread Christian Ritz
Hi! Yes, the 'drc' package can be used to obtain IC50 or any other ICx value for several, commonly used dose-response models. The vignette is more up-to-date than the article in JSS (which dates back to the start of 2005). Christian Liaw, Andy wrote: Perhaps also of interest is the `drc'

Re: [R] suggestions for nls error: false convergence

2005-12-19 Thread Christian Ritz
Hi Spencer. When using 'optim' and the first try fails you could: 1) try some other methods: Nelder-Mead, BFGS, ... 2) increase the maximum number of iterations (argument maxit in the control list) 3) specify the argument parscale in the control list, in order to have all parameters of same

Re: [R] suggestions for nls error: false convergence

2005-12-18 Thread Christian Ritz
Hi. An alternative is to use the package 'drc' on CRAN to fit your data! x - 1:100 y - c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,1,1,2,2,2,2,2,3,4,4,4,5, 5,5,5,6,6,6,6,6,8,8,9,9,10,13,14,16,19,21, 24,28,33,40,42,44,50,54,69,70,93,96,110,127,127,141,157,169,

Re: [R] retrieving p-values in lm

2005-12-09 Thread Christian Ritz
Hi Patrick, try: lm.res.2$coefficients which I found by looking at the content of the function 'summary.lm'. Christian __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!

Re: [R] language settings

2005-12-09 Thread Christian Ritz
Hi Ariel, ok, you want to change the language? Right click on the R icon on the desktop, choose Properties. In the field Destination you add at the end of the line: language=it (Italian) orlanguage=fr (French) Then the line should look somewhat like: (for Italian)

Re: [R] Non linear modeling

2005-03-18 Thread Christian Ritz
Hi Angelo, have a look at the following example which uses 'gls' in the nlme package. library(nlme) x - runif(100, 0, 1) y - x + exp(4*x)*rnorm(100, 0, 2) gls(y~x, correlation = varExp(form=~x)) For details see ?gls and ?varExp. Christian __

Re: [R] fitting weibull distribution

2004-09-23 Thread Christian Ritz
Hi. I think there may be one or more zeros in your data set, causing the problem: x - rgamma(100) fitdistr(x, weibull) fitdistr(c(x,0), weibull) Maybe you should omit the zeros. Christian __ [EMAIL PROTECTED] mailing list

Re: [R] lme parameterization question

2003-04-03 Thread Christian Ritz
Hi, try something like: lme(y~w,random=list(~1|year,~1+w|site)) Christian - Original Message - From: John Fieberg [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 02, 2003 10:36 PM Subject: [R] lme parameterization question Hi, I am trying to parameterize the