[R] nlme error message

2005-10-31 Thread J.Fu
Dear Friends, I am seeking for any help on an error message in lme functions. I use mixed model to analyze a data with compound symmetric correlation structure. But I get an error message: Error in corMatrix.corCompSymm(object) : NA/NaN/Inf in foreign function call (arg 1). If I change the

[R] how to optimise cross-correlation plot to study time lag between time-series?

2005-10-31 Thread Jan Verbesselt
Dear R-help, How could a cross-correlation plot be optimized such that the relationship between seasonal time-series can be studied? We are working with strong seasonal time-series and derived a cross-correlation plot to study the relationship between time-series. The seasonal variation however

Re: [R] R-functions in C-Code

2005-10-31 Thread Roger Bivand
On Mon, 31 Oct 2005, Olaf Schenk wrote: Dear R users, I would like to use several R functions from a C-code and I have read the Introduction to the .C Interface to R. Unfortunately, my shared library with the C-code works only in cases where I use R-routines that are defined Rmath.h, eg.

Re: [R] significant test

2005-10-31 Thread Prof Brian Ripley
On Mon, 31 Oct 2005, Romain Francois wrote: Le 31.10.2005 11:22, Robert a écrit : I have two groups of data and want to test how the mean of one group is significant different from the mean of the other group of data. which R function can be used? Thanks. t.test if you assume normality

Re: [R] significant test

2005-10-31 Thread Romain Francois
Le 31.10.2005 13:45, Prof Brian Ripley a écrit : On Mon, 31 Oct 2005, Romain Francois wrote: Le 31.10.2005 11:22, Robert a écrit : I have two groups of data and want to test how the mean of one group is significant different from the mean of the other group of data. which R function can

[R] information matrix in random effects model

2005-10-31 Thread Ingmar Visser
I use the lme function from the nlme library (or alternatively from the Matrix library) to estimate a random effects model. Both functions return the covariance matrix of the estimated parameters. I have the following question: Is it possible to retrieve the information matrix of such a model

[R] Applying a function to a vector

2005-10-31 Thread Florent Bresson
I have defined a function to compute the value of a beta distribution of the second kind (the existing beta distribution of th stats package is the beta distribution of the first kind). It works perfectly for a single value, but I want to apply it to a vector of 22 000 values. I can use a loop for

Re: [R] Applying a function to a vector

2005-10-31 Thread Paulo Justiniano Ribeiro Jr
Florent have a look at: help(sapply) On Mon, 31 Oct 2005, Florent Bresson wrote: I have defined a function to compute the value of a beta distribution of the second kind (the existing beta distribution of th stats package is the beta distribution of the first kind). It works perfectly for a

[R] Applying a function to a vector

2005-10-31 Thread Florent Bresson
I just have a try with sapply. The problem is that my function pbeta2 has two parameters z and p (wich is a vector of two parameters). If I use sapply , R returns a message incicating that parameter p is missing. It is a problem since both z and p are varying along my data.frame. Florent have a

Re: [R] Applying a function to a vector

2005-10-31 Thread Thomas Lumley
On Mon, 31 Oct 2005, Florent Bresson wrote: I just have a try with sapply. The problem is that my function pbeta2 has two parameters z and p (wich is a vector of two parameters). If I use sapply , R returns a message incicating that parameter p is missing. It is a problem since both z and p are

[R] getting last 2 charcters of a string, other text functions?

2005-10-31 Thread t c
I wish to obtain the right-most n characters of a character string? What is the appropriate function? - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list

Re: [R] Applying a function to a vector

2005-10-31 Thread Prof Brian Ripley
On Mon, 31 Oct 2005, Thomas Lumley wrote: On Mon, 31 Oct 2005, Florent Bresson wrote: I just have a try with sapply. The problem is that my function pbeta2 has two parameters z and p (wich is a vector of two parameters). If I use sapply , R returns a message incicating that parameter p is

Re: [R] Applying a function to a vector

2005-10-31 Thread Carlos J. Gil Bellosta
You should then try apply. See ?apply. For instance: a - matrix(c(1:10), 5, 2) apply(a, 1, function(x) x[1] + 100 * x[2]) This way you can disaggregate the components of your input (that is not a singleton) and use them inside your function separately. Carlos J. Gil Bellosta

[R] Sweave (R?) font encoding problems

2005-10-31 Thread Luís Torgo
Dear R list, I'm having some problems with font encodings when using R+Sweave+Latex in my native language: Portuguese. My environment: Kubuntu 5.10 Linux $ uname -a Linux nassa 2.6.12-9-686 #1 Mon Oct 10 13:25:32 BST 2005 i686 GNU/Linux R R.version _ platform

Re: [R] getting last 2 charcters of a string, other text functions?

2005-10-31 Thread Chuck Cleland
?nchar ?substr rightmost - function(x, y){substr(x, start=nchar(x) - (y - 1), stop=nchar(x))} x - c(asfef, qwerty, yuiop[, b, stuff.blah.yech) rightmost(x, 2) [1] ef ty p[ b ch rightmost(x, 3) [1] fef rty op[ b ech t c wrote: I wish to obtain the right-most n characters of a

Re: [R] getting last 2 charcters of a string, other text functions?

2005-10-31 Thread Sundar Dorai-Raj
t c wrote: I wish to obtain the right-most n characters of a character string? What is the appropriate function? See ?nchar ?substr k - 2 x - abcdef nc - nchar(x) substr(x, nc - k + 1, nc) HTH, --sundar __ R-help@stat.math.ethz.ch mailing

Re: [R] getting last 2 charcters of a string, other text functions?

2005-10-31 Thread Tobias Verbeke
t c wrote: I wish to obtain the right-most n characters of a character string? What is the appropriate function? You could make one yourself: rightmostn - function(x, n){ res - substr(x, nchar(x)-n+1, nchar(x)) return(res) } magic - hocuspocus rightmostn(magic, 5) [1] pocus HTH,

Re: [R] getting last 2 charcters of a string, other text functions?

2005-10-31 Thread Earl F. Glynn
t c [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I wish to obtain the right-most n characters of a character string? What is the appropriate function? substr will work: x - c(abcd, xyz) N - 2 substr(x, nchar(x)-N+1, nchar(x)) [1] cd yz N - 3 substr(x, nchar(x)-N+1,

Re: [R] Applying a function to a vector

2005-10-31 Thread Florent Bresson
It works really faster with mapply. I just had to change my fonction from pbeta2(z,p) with p=c(p1,p2) to pbeta2(z,p1,p2). Thanks for the tip. --- Thomas Lumley [EMAIL PROTECTED] a écrit : On Mon, 31 Oct 2005, Florent Bresson wrote: I just have a try with sapply. The problem is that my

[R] How can I test temporal autocorrelation of binary data?

2005-10-31 Thread dschad
Hi, I have a binary (o/1 - coded) data set and want to test it's autocorrelation structure. Is that function implemented in R? Can I use the ACF - funtion with binary data? Thanks for your help, Daniel __ R-help@stat.math.ethz.ch mailing list

Re: [R] getting last 2 charcters of a string, other text functions?

2005-10-31 Thread Gabor Grothendieck
Note that this one can be slightly simplified by using sub instead of gsub (since you only will have one match anyways) and the $ is not needed since .* will consume the maximal matching string: sub(.*(..), \\1, mystring) On 10/31/05, Carlos J. Gil Bellosta [EMAIL PROTECTED] wrote:

[R] write.table call

2005-10-31 Thread Li,Qinghong,ST.LOUIS,Molecular Biology
Hi, I use write.table() to write a file to an external xls file. the column names left-shift one position in output file. I check with col.names() row.names(), the file is fine. How to prevent the shifting? I71 I111I304I307I305I306I114I72

Re: [R] Sweave (R?) font encoding problems

2005-10-31 Thread Friedrich . Leisch
On Mon, 31 Oct 2005 16:46:24 +0100, Luís Torgo (LT) wrote: Dear R list, I'm having some problems with font encodings when using R+Sweave+Latex in my native language: Portuguese. My environment: Kubuntu 5.10 Linux $ uname -a Linux nassa 2.6.12-9-686 #1 Mon Oct 10 13:25:32

[R] GLM

2005-10-31 Thread Jeff Row
Hello R-users, I am a relatively new user of R and I have a question regarding glm. I want to run the function GLM on multiple individuals separately and then get means for summary statistics such as AIC and coef. Is there a way to do this in R without separately going through each individual

Re: [R] significant test

2005-10-31 Thread Peter Dalgaard
Prof Brian Ripley [EMAIL PROTECTED] writes: Sorry, no. The Wilcoxon test does NOT test a difference in means: its null hypothesis is that the two samples came from the same continuous distribution, a much narrower assumption. (It is sensitive to differences in variances, for example, and is

Re: [R] Sweave (R?) font encoding problems

2005-10-31 Thread Prof Brian Ripley
You are using UTF-8 and declaring latin1. It is your use of UTF-8 that will have changed, not R. On Mon, 31 Oct 2005, Luís Torgo wrote: Dear R list, I'm having some problems with font encodings when using R+Sweave+Latex in my native language: Portuguese. My environment: Kubuntu 5.10 Linux $

Re: [R] Matrix operations please help

2005-10-31 Thread Srinivas Iyyer
Dear Group, I am a novice R programmer with little statistical background. I am a molecular biologist by training. I generated a correlation matrix (157 X 157) for 157 variables. I want to selection only the unique values (values that are either side of the diagnol). I want these unique

Re: [R] linear mixed effect model with ordered logit/probit link?

2005-10-31 Thread Spencer Graves
Have you received a reply to this? I haven't seen one. I just tried several things with RSiteSearch. Searching for ordered logit produced 70 hits. One of the first 10 indicate, The CRAN package MCMCpack has at least ordered probit.

Re: [R] Matrix operations please help

2005-10-31 Thread jim holtman
This will give you a matrix with the row/column names of the respective values. Not sure what you meant by a list, but you can convert the matrix to a list. m2 a b c d e A 1 5 9 13 17 B 2 6 10 14 18 C 3 7 11 15 19 D 4 8 12 16 20 cbind(row=rownames(m2)[row(m2)[lower.tri(m2)]], +

Re: [R] line vector plots

2005-10-31 Thread Eduardo Klein
Hi Jim, Thanks for the tip, but I really need the same polar chart but over a line no in a circle. I didn't find it on the plotrix package. Regards, EKS Jim Lemon wrote: Eduardo Klein wrote: Hi, I'm looking for the way to make vector plot over a time line. This plot, similar to the

Re: [R] line vector plots

2005-10-31 Thread Gabor Grothendieck
Not sure if this is what you are looking for but check out: http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=80 On 10/31/05, Eduardo Klein [EMAIL PROTECTED] wrote: Hi Jim, Thanks for the tip, but I really need the same polar chart but over a line no in a circle. I didn't find it

[R] Import help (neophyte)

2005-10-31 Thread Jeffrey Stratford
Hi, I have no experience with R and I'm finding the manuals a bit obtuse and written as if I already understood R. I'm trying to import a csv file from a floppy and it's not working. The code I'm using is read.table(F:\GEORGIA\species_richness\SR_use.csv, sep=,, header = TRUE, row.names = 1)

Re: [R] Import help (neophyte)

2005-10-31 Thread Thomas Lumley
On Mon, 31 Oct 2005, Jeffrey Stratford wrote: Hi, I have no experience with R and I'm finding the manuals a bit obtuse and written as if I already understood R. I'm trying to import a csv file from a floppy and it's not working. The code I'm using is

Re: [R] Import help (neophyte)

2005-10-31 Thread Roger Bivand
On Mon, 31 Oct 2005, Jeffrey Stratford wrote: Hi, I have no experience with R and I'm finding the manuals a bit obtuse and written as if I already understood R. I'm trying to import a csv file from a floppy and it's not working. The code I'm using is

Re: [R] Import help (neophyte)

2005-10-31 Thread Roger Bivand
On Mon, 31 Oct 2005, Jeffrey Stratford wrote: Hi, I have no experience with R and I'm finding the manuals a bit obtuse and written as if I already understood R. I'm trying to import a csv file from a floppy and it's not working. The code I'm using is

Re: [R] How can I test temporal autocorrelation of binary data?

2005-10-31 Thread Patrick Burns
If you mean you want to test that there is no autocorrelation, then there is some information on using the Ljung-Box test on such data in the working paper 'Robustness of the Ljung-Box test and its rank equivalent' on the Burns Statistics website. The executive summary is that the test seems to

Re: [R] Import help (neophyte)

2005-10-31 Thread Duncan Murdoch
On 10/31/2005 1:31 PM, Jeffrey Stratford wrote: Hi, I have no experience with R and I'm finding the manuals a bit obtuse and written as if I already understood R. I'm trying to import a csv file from a floppy and it's not working. The code I'm using is

Re: [R] Matrix operations please help

2005-10-31 Thread Gabor Grothendieck
Try this: # test data mm - cor(iris[,-5]) mm # get upper triangle from matrix mm[lower.tri(mm)] # if you want it as a data frame with columns for row and column names as.data.frame.table(mm)[lower.tri(mm),] In either of the cases above you could substitute row(mm) col(mm) for lower.tri(mm)

[R] Sum of logical vector

2005-10-31 Thread Tuszynski, Jaroslaw W.
Hi, Recently I was told by users of some of the function I wrote that they experience crashes in places where logical vector was passed to sum function. However on my computer those functions work just fine. After closer look at documentation of function 'sum', I realized that it is defined only

Re: [R] Sum of logical vector

2005-10-31 Thread Duncan Murdoch
On 10/31/2005 2:00 PM, Tuszynski, Jaroslaw W. wrote: Hi, Recently I was told by users of some of the function I wrote that they experience crashes in places where logical vector was passed to sum function. However on my computer those functions work just fine. After closer look at

[R] Problem using reshape with missing values in idvar

2005-10-31 Thread Bing Ho
Hello everybody, I have been recently using reshape to convert long data to wide data. Everything was going well until I reached some problematic datasets. It has taken me a couple of weeks to finally figure out what might be happening. The problem is reproducible with test cases, and on two

Re: [R] GLM

2005-10-31 Thread John Fox
Dear Jeff, One way to do this is with by(): summaries - by(example, Individual, function(data){ mod - glm(Type~Dwater+Habitat, data=data, family=binomial) list(AIC=AIC(mod), coef=coef(mod)) }) sapply(summaries, function(x) x$coef) rowMeans(sapply(summaries, function(x) x$coef))

[R] Help with try or tryCatch

2005-10-31 Thread David Scott
I am having trouble with try and tryCatch. I have read the documentation but I just don't get it. Here is what I am trying to do. I am testing a function which has a number of parameters. I want to test it for different values of the parameters and I have some loops, in the middle of which is

[R] Still a bug with NA in sd() or var()?

2005-10-31 Thread Roger Dungan
Dear R-users, Running R 2.1.1 in WindowsXP, there seems to be a 'bug' in sd() If x-c(1,2,3,NA,5) mean(x) [1] NA But sd(x) Or var(x) give Error in var(x, na.rm = na.rm) : missing observations in cov/cor There are obvious work-rounds, like sd(x, is.na(x)==F) which gives the result (with error

Re: [R] Still a bug with NA in sd() or var()?

2005-10-31 Thread Tuszynski, Jaroslaw W.
Try: sd (x,na.rm=TRUE) [1] 1.707825 Jarek \ Jarek Tuszynski, PhD. o / \ Science Applications International Corporation \__,| (703) 676-4192 \ [EMAIL PROTECTED]

[R] Build R package with shared library

2005-10-31 Thread Marcelo Damasceno
Hello to all, I am try to build a package, I do the follow commands: R CMD check pack, R CMD pack build and run OK, no errors. I put my shared library in package subdirectory R, src, but it is not put a shared library .so in directory /usr/lib/R/library/pack/lib. Below is my code :

Re: [R] Help with try or tryCatch

2005-10-31 Thread McGehee, Robert
It sounds like you want `try` with the argument `silent = TRUE`. This will allow you to keep running your program without errors. If you want to check if the line had an error, you can error control by seeing if the class of the resulting object is try-error. For example, let's say I wanted to

Re: [R] Still a bug with NA in sd() or var()?

2005-10-31 Thread Austin, Matt
The behavior is actually documented in the var() help file (?var), although it's not clear that this would be the behavior if you just read ?sd. sd() does call var if you look at the code, so the behavior should not be unexpected. --Matt -Original Message- From: [EMAIL PROTECTED]

[R] nls() fit to Kahnemann/ Tversky function

2005-10-31 Thread Mark Hempelmann
Dear WizaRds, I would like to fit a curve to ten points with nls() for one unknown parameter gamma in the Kahnemann/ Tversky function, but somehow it won't work and I am unable to locate my mistake. p.kum - seq(0.1,1, by=0.1) felt.prob.kum - c(0.16, 0.23, 0.36, 0.49, 0.61, 0.71, 0.85,

Re: [R] Still a bug with NA in sd() or var()?

2005-10-31 Thread Tony Plate
Roger Dungan wrote: [snip] There are obvious work-rounds, like sd(x, is.na(x)==F) which gives the result (with error message) [1] 1.707825 Warning message: the condition has length 1 and only the first element will be used in: if (na.rm) complete.obs else all.obs What you are doing

[R] why does glm.predict give values over 1 ?

2005-10-31 Thread Rohit Singh
Hi, This is a newbie question. I have been using glm to perform some logistic regression. However, if I take the fitted parameters (as part of the glm object) and pass them on the glm.predict function, for some test cases I am getting predicted values that are a little over 1. This is a bit

Re: [R] nls() fit to Kahnemann/ Tversky function

2005-10-31 Thread apjaworski
Mark, The parameter of your model (gamma) should not be a part of the dataframe. In addition, the start argument should be a named list. Something like this works nls.dataframe - data.frame(p.kum,felt.prob.kum) nls.kurve - nls( formula = felt.prob.kum ~

Re: [R] why does glm.predict give values over 1 ?

2005-10-31 Thread Austin, Matt
If you left the type argument to the predict method then your predictions are on the log-odds scale. Try using the type='response' in the predict method for glm. --Matt -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Rohit Singh Sent: Monday, October

Re: [R] why does glm.predict give values over 1 ?

2005-10-31 Thread Ted Harding
On 31-Oct-05 Rohit Singh wrote: Hi, This is a newbie question. I have been using glm to perform some logistic regression. However, if I take the fitted parameters (as part of the glm object) and pass them on the glm.predict function, for some test cases I am getting predicted values that

[R] R Graphs in Powerpoint

2005-10-31 Thread Jarrett Byrnes
Hey, all. Quick question. I'm attempting to use some of the great graphs generated in R for an upcoming talk that I'm writing in Powerpoint. Copying and pasting (I'm using OSX) yields graphs that look great in Powerpoint - until I resize them. Then fonts, points, and lines all become quite

Re: [R] why does glm.predict give values over 1 ?

2005-10-31 Thread Rohit Singh
Hi Ted, So here's what I'm doing: This is my call to predict.glm: pY - predict.glm(from69.fin.glm, newdata=d.tab, type=response) This is what the fitted glm object looks like: from69.fin.glm Call: glm(formula = TR ~ z1 + e12_div_p_n + z2 + p_n, data = j2.tab) Coefficients: (Intercept)

Re: [R] why does glm.predict give values over 1 ?

2005-10-31 Thread Ted Harding
Hi Rohit: On 31-Oct-05 Rohit Singh wrote: Hi Ted, So here's what I'm doing: This is my call to predict.glm: pY - predict.glm(from69.fin.glm, newdata=d.tab, type=response) This is what the fitted glm object looks like: from69.fin.glm Call: glm(formula = TR ~ z1 + e12_div_p_n +

[R] Re R Graphs in Powerpoint

2005-10-31 Thread Thomas Lumley
On Mon, 31 Oct 2005, Jarrett Byrnes wrote: Hey, all. Quick question. I'm attempting to use some of the great graphs generated in R for an upcoming talk that I'm writing in Powerpoint. Copying and pasting (I'm using OSX) yields graphs that look great in Powerpoint - until I resize them.

Re: [R] nls() fit to Kahnemann/ Tversky function

2005-10-31 Thread Gabor Grothendieck
Note that a simple logistic with a saturation level of 1 seems to do quite well. Below we have removed the last point in order to avoid the singularity: x - p.kum[-10] y - felt.prob.kum[-10] plot(log(y/(1-y)) ~ x) abline(lm(log(y/(1-y)) ~ x), col = red) On 10/31/05, Mark Hempelmann [EMAIL

[R] balloonplot/ package gplots/ getting rid of the grid

2005-10-31 Thread McClatchie, Sam (PIRSA-SARDI)
Background: OS: Linux Mandrake 10.1 release: R 2.1.1 editor: GNU Emacs 21.3.2 front-end: ESS 5.2.3 - Colleagues Does anyone know how to get rid of the grid in balloonplot? I have read the help file. tt - seq(1,10) tt2 - tt+20 tt3 -tt*1.5 balloonplot(tt, tt2, tt3)

Re: [R] balloonplot/ package gplots/ getting rid of the grid

2005-10-31 Thread Gabor Grothendieck
Get the gplots:::balloonplot.default source and remove the two abline lines. On 11/1/05, McClatchie, Sam (PIRSA-SARDI) [EMAIL PROTECTED] wrote: Background: OS: Linux Mandrake 10.1 release: R 2.1.1 editor: GNU Emacs 21.3.2 front-end: ESS 5.2.3 - Colleagues