[R] repeated measures regression and power analysis?

2008-11-25 Thread Jake Verschuyl
Hi there, I am attempting to assess whether there is a trend in a observations of a population that was observed on 7 consecutive days in July for 6 years (2000, 2001, 2002, 2004, 2006, 2008). I have count data of the number of observations per day for each of the seven days for each of the 6

[R] Replace NaN with zero

2008-11-25 Thread Spilak,Jacqueline [Edm]
I need help with replacing NaN with zero (the value '0') in my dataset. The reason is that I can't get it to graph because of the NaN in the dataset. I have tried: data[is.nan(data)] - 0 that others have suggested in the help archives but this does nothing so I am not sure what I am doing wrong.

Re: [R] how to test for the empty set

2008-11-25 Thread Niels Richard Hansen
G. Jay Kerns wrote: Dear R-help, I first thought that the empty set (for a vector) would be NULL. x - c() x However, the documentation seems to make clear that there _many_ empty sets depending on the vector's mode, namely, numeric(0), character(0), logical(0), etc. This is borne out

[R] Count days of current year

2008-11-25 Thread Felipe Carrillo
Hi: Is there a function that counts the number of days of any given or current year based on the date? Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish Wildlife Service California, USA __

[R] examples of usage of Rwave functions

2008-11-25 Thread mauede
I would like to try the Continuous Wavelet Transform to extract the features of non-linear and non stationary 1D signals. I can remove the noise and the trend so make them easier to analyze. I am not sure the CWT will work. To the purpose of trying it out I have downloaded the Rwave package. To

Re: [R] How can I access the list argument within a for function call

2008-11-25 Thread Mike Rowe
It looks to me like what I want to do isn't possible. I've been reading the R Language Definition manual more, and have realized that the for function is a .Primitive, not an enclosure. This means that its arguments are passed by value, so I don't think it is possible to access them from within

[R] how to read .sps (SPSS file extension)?

2008-11-25 Thread livio finos
Hi everyone, I'm trying to import .sps (SPSS portable file) file. the read.spss function (library foreign) doesn't allow to import such files. should I import in spss and then save as sav file? there is not other solutions available? what I mostly like from spss file is that they have variable

Re: [R] invoking user-defined function

2008-11-25 Thread Philipp Pagel
On Mon, Nov 24, 2008 at 11:35:37PM -0800, Kinoko wrote: Can somebody tell me how to invoke user-defined functions from script files during run-time? Basically I have (almost) one function per script file. I am thinking of something like #include in C++ import in Java/Python use

Re: [R] Count days of current year

2008-11-25 Thread Thomas Petzoldt
Felipe Carrillo wrote: Hi: Is there a function that counts the number of days of any given or current year based on the date? See ?Date and ?strptime and try the following: y - as.numeric(format(as.Date(2008-11-25), %Y)) as.numeric(format(as.Date(paste(y, 12, 31, sep=-)), %j)) HTH Thomas

Re: [R] Compiling R for 64-bit Windows (was Re: increasing memory limit in Windows Server 2008 64-bit)

2008-11-25 Thread Peter Dalgaard
Michael Styer wrote: I did some more research and I think I've answered my own question. So my next question is, does anyone have any thoughts about how significant a project it would be to compile R for 64-bit windows (using, e.g., the Portland Group compiler)? How much of the code would

Re: [R] printing help files directly from R prompt

2008-11-25 Thread Uwe Ligges
See ?help and its argument offline Uwe Ligges Faheem Mitha wrote: Hi, Does anyone know how to print help files from R's prompt? One can read the help text for read.table by doing ?read.table on the R prompt. In a similar fashion, can I print the help read.table without having to

Re: [R] invoking user-defined function

2008-11-25 Thread Kinoko
Philipp, thanks for the tip. source(path-to-my-script) did the trick. On Nov 25, 5:25 pm, Philipp Pagel [EMAIL PROTECTED] wrote: On Mon, Nov 24, 2008 at 11:35:37PM -0800, Kinoko wrote: Can somebody tell me how to invoke user-defined functions from script files during run-time?

Re: [R] Replace NaN with zero

2008-11-25 Thread Uwe Ligges
Spilak,Jacqueline [Edm] wrote: I need help with replacing NaN with zero (the value '0') in my dataset. The reason is that I can't get it to graph because of the NaN in the dataset. I have tried: data[is.nan(data)] - 0 Since data is a data.frame and not a matrix, you might want to loop over

Re: [R] table for weighted observations

2008-11-25 Thread Uwe Ligges
Whatever wtd.table is (probably in some package you have not told us about). The ordinary function table shows 0-frequency, though. Uwe Ligges Kunzler, Andreas wrote: Dear List, I ran into some problems with weighted observations. I am looking for a frequency table listing the frequencies

Re: [R] Help with CCLUS

2008-11-25 Thread Uwe Ligges
Erik Porfeli wrote: Hi, I am using the following syntax to enter data and perform a cluster analysis: x - read.table (clstrdbt.csv, header=TRUE, sep = ,,fill = TRUE) cl-cclust(x,4,20,verbose=TRUE,method=kmeans) This is the result I receive: Error in cclust(x, 4, 20, verbose = TRUE, method

Re: [R] how to read .sps (SPSS file extension)?

2008-11-25 Thread Martin Elff
Hi Livio, On Monday 24 November 2008 (21:44:45), livio finos wrote: Hi everyone, I'm trying to import .sps (SPSS portable file) file. the read.spss function (library foreign) doesn't allow to import such files. Is this really a 'portable' file (usually these files have the extension '.por')?

Re: [R] equation of a line or curve

2008-11-25 Thread Uwe Ligges
CE.KA wrote: Hi R users I used the function line(x,y) and line(lowess(x,y)) to see the correlation between 2 variables (x,y). Here is my question: is there a way to ask R to tell me the equation of -this line : line(x,y) The equation if line(x,y)? It is given by the n data points directly

Re: [R] how to read .sps (SPSS file extension)?

2008-11-25 Thread Eik Vettorazzi
Hi Livio, I think you mixed something up. The .sps - files are the syntax files of SPSS, and I think there is no automated way (but I would like to be corrected there) of converting SPSS syntax to R-code. The usual data files of spss have the extension .sav. Such files can easily read by

[R] recursive default argument error

2008-11-25 Thread tolga . i . uzuner
Dear R Users, I have a function foo in a script with default values for some of the parameters as follows: testparams=list(a=1,b=2,c=3) foo-function(x,y,testparams=testparams) x+y+testparams$a+testparams$b+testparams$c When I try to run foo(1,2), I get the following error:

Re: [R] lme4 and false convergence

2008-11-25 Thread ONKELINX, Thierry
Dear Ben, Your questions suite better in R-SIG-Mixed-Models which I am cc'ing. Have checked the mailing list? Try RSiteSearch(lme4 false convergence) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en

[R] Using R from C++ code

2008-11-25 Thread Janne Kätevä
Hi, I'm developing a C++ software and I would like to connect R (sometimes on another computer). In my project I'm using a MySQL client with GPL license and FOSS exception, meaning that I can't use any other GPL licensed components in the project. It seems that all portable (must work on

[R] TSP package and Concorde

2008-11-25 Thread Jeszenszky Peter
Hello, I would like to use Concorde from R to solve TSP instances with solve_TSP(tsp, method=Concorde) Concorde is installed properly but the result is the following error: found: concorde.exe N\Users\jeszy\AppData: No such file or directory Couldn't open

[R] how to plot and save plots in batch mode

2008-11-25 Thread Kinoko
Dear list, This is not a question but a rather short note how to save a plot if it was created in batch mode. It took me like 2 hours to figure it out, I hope it can save time for those who - like me - are not really fast in picking up diosyncrasies of R. (as far as I remember I had no problems

Re: [R] equation of a line or curve

2008-11-25 Thread Peter Dalgaard
Uwe Ligges wrote: CE.KA wrote: Hi R users I used the function line(x,y) and line(lowess(x,y)) to see the correlation between 2 variables (x,y). Here is my question: is there a way to ask R to tell me the equation of -this line : line(x,y) The equation if line(x,y)? It is given by

[R] basic information defining functions

2008-11-25 Thread Bunny, lautloscrew.com
Hi all, i am looking from some insights to define own R functions. so far i found most basics in documentations that are around on the web. except for one thing: I´d like to define some function, say: #assume my data matrix contains vectors like data$myColumn1,data $myColumn2 etc.

Re: [R] recursive default argument error

2008-11-25 Thread Wacek Kusnierczyk
[EMAIL PROTECTED] wrote: Dear R Users, I have a function foo in a script with default values for some of the parameters as follows: testparams=list(a=1,b=2,c=3) foo-function(x,y,testparams=testparams) x+y+testparams$a+testparams$b+testparams$c When I try to run foo(1,2), I get

Re: [R] equation of a line or curve

2008-11-25 Thread Uwe Ligges
Peter Dalgaard wrote: Uwe Ligges wrote: CE.KA wrote: Hi R users I used the function line(x,y) and line(lowess(x,y)) to see the correlation between 2 variables (x,y). Here is my question: is there a way to ask R to tell me the equation of -this line : line(x,y) The equation if line(x,y)? It

Re: [R] basic information defining functions

2008-11-25 Thread Richard . Cotton
i am looking from some insights to define own R functions. so far i found most basics in documentations that are around on the web. except for one thing: I´d like to define some function, say: #assume my data matrix contains vectors like data$myColumn1,data $myColumn2 etc. Do you

Re: [R] recursive default argument error

2008-11-25 Thread tolga . i . uzuner
Many thanks Wacek, that is very helpful. Appreciate it. Regards, Tolga Wacek Kusnierczyk [EMAIL PROTECTED] 25/11/2008 10:51 To [EMAIL PROTECTED] cc R help [EMAIL PROTECTED] Subject Re: [R] recursive default argument error [EMAIL PROTECTED] wrote: Dear R Users, I have a function foo

Re: [R] plots of ACF

2008-11-25 Thread Gerard M. Keogh
Sara, look carefully at the acf again and increase the lag. Lags outside the envelope indicate differencing may be necessary. If the data are seasonal you could be seeing a cycle with period 8 - you'll see alias peaks at 16 and 24; ideally plot the periodiogram which will show spikes at these

Re: [R] Check for date variable in a arbitrary dataset

2008-11-25 Thread Gabor Grothendieck
If its a date you should ensure its of Date class prior to performing this analysis rather than representing it as something else. See R News 4/1. On Tue, Nov 25, 2008 at 2:28 AM, Harsh [EMAIL PROTECTED] wrote: Thank you Gabor for your prompt reply. I had tried checking for class, but it

Re: [R] rgdal and spgrass6

2008-11-25 Thread Roger Bivand
Please do provide the output of sessionInfo(). Without this, any further advice will be guesswork. In addition, a few questions: Are you trying to install the source package? Are the external dependencies satisfied? Have you read the package README file - in inst/ in the source? Which CRAN

[R] compute pearson correlation p-values for all combinations of columns of 2 matrices

2008-11-25 Thread Daren Tan
How can I compute the pearson correlation p-values for all combinations of columns of 2 matrices ? m - matrix(rnorm(20), nrow=4, dimnames=list(LETTERS[1:4], letters[1:5])) m1 - matrix(rnorm(20), nrow=4, dimnames=list(LETTERS[1:4], letters[1:5])) cor(m,m1) a b

[R] How to predict probabilities after using lmer

2008-11-25 Thread arpino
Dear R-users, I'm using lmer to fit two-level logistic models and I'm interested in predicted probabilities that I get in this way (using fitted): glm1 = lmer(XY$T1~X1 + X2 + X3 + (1|Cind), family=binomial) #estimation of a two-level logit model fit1=fitted(glm1) # I get the fitted

[R] Vector autoregression, panel data

2008-11-25 Thread TomBom
Hi! I'm a new R user and I have a question about estimating VAR on a panel data. What I'm trying to do is to explain stock's volume on it's lagged volume, it's lagged returns and lagged market return's (and vice versa). In addition I have generated an exogenous variable controlling for stock's

[R] Reshape matrix from wide to long format

2008-11-25 Thread Daren Tan
I forgot the reshape equivalent for converting from wide to long format. Can someone help as my matrix is very big. The followin is just an example. m - matrix(1:20, nrow=4, dimnames=list(LETTERS[1:4], letters[1:5])) m 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

Re: [R] Rendering Dendrograms

2008-11-25 Thread Mark Cook
Hello all I've been using the hclust and as.dendrogram objects for hierarchical clustering. The problem I have is that my sample set is now so large (circa 500 points) that it isn't possible to view the leaf nodes. I'd like to be able to zoom in on specific areas of the graph by selecting a

Re: [R] Reshape matrix from wide to long format

2008-11-25 Thread Gabor Grothendieck
Try this: as.data.frame.table(m) Var1 Var2 Freq 1 Aa1 2 Ba2 3 Ca3 4 Da4 5 Ab5 6 Bb6 7 Cb7 8 Db8 9 Ac9 10Bc 10 11Cc 11 12Dc 12 13Ad 13 14B

Re: [R] dataframe help

2008-11-25 Thread stephen sefick
you will get more help if you provide code that can be copied and pasted into an R session. ?dput #untested to say the least foo[unique(foo),] On Mon, Nov 24, 2008 at 5:36 PM, Rajasekaramya [EMAIL PROTECTED] wrote: hi there I have a dataframe abc 123 345 abc 345 456 lmn 567 345 hkl

Re: [R] Reshape matrix from wide to long format

2008-11-25 Thread stephen sefick
#handy if you like ggplot2 as this is required #I think this is what you want library(reshape) m - matrix(1:20, nrow=4, dimnames=list(LETTERS[1:4], letters[1:5])) melt(m) On Tue, Nov 25, 2008 at 8:01 AM, Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: as.data.frame.table(m) Var1 Var2

[R] how to pause between graphics

2008-11-25 Thread Peter B. Mandeville
Dear list: Before posting this message, I read the posting guide, examined the manuals, searched the R help files, and examined in detail the books that I have available on R. I am using R version 2.8.0 and WinXP. I want to pause the R Graphics window to permit the use of the File,

Re: [R] dataframe

2008-11-25 Thread jim holtman
Does this do it for you: x - read.table(textConnection(abc 123 345 + abc 345 456 + lmn 567 345 + hkl 568 535 + lmn 096 456 + lmn 768 094)) x V1 V2 V3 1 abc 123 345 2 abc 345 456 3 lmn 567 345 4 hkl 568 535 5 lmn 96 456 6 lmn 768 94 x[!duplicated(x$V1),] V1 V2 V3 1 abc 123 345 3

Re: [R] Count days of current year

2008-11-25 Thread Gabor Grothendieck
As yearmon represents year/month as year + fraction of year adding 1 gives next year. The first output below gives an answer of class difftime whereas the the second solution is numeric: library(zoo) year - 2000:2010 d - as.Date(as.yearmon(year)+1) - as.Date(as.yearmon(year)) d Time

Re: [R] Fwd: select a subset

2008-11-25 Thread jim holtman
Not tested since you did not provide any data: results - lapply(split(df, df$id), function(.data){ .which - which(.data$censor == 1)[1] # get first one if (length(.which) 0) return(.data[.which,]) else return(.data[nrow(.data),]) }) On Tue, Nov 25, 2008 at 2:45 AM, gallon li [EMAIL

Re: [R] Re shape matrix from wide to long format

2008-11-25 Thread Dieter Menne
Daren Tan wrote: I forgot the reshape equivalent for converting from wide to long format. Can someone help as my matrix is very big. The following is just an example. m - matrix(1:20, nrow=4, dimnames=list(LETTERS[1:4], letters[1:5])) Gabor's solution is uses more basic functions,

Re: [R] web error message

2008-11-25 Thread David Winsemius
Given the fact that the mailserver appeared to be down for 12 hours yesterday , I wouldn't be surprised if some major work needed to be done at ETH. Try again. I do not get the same error message.. -- David Winsemius Heritage Labs On Nov 24, 2008, at 1:07 PM, Faheem Mitha wrote: Hi, I'm

[R] WEIGHT CASES by Frequency VECTOR

2008-11-25 Thread sharon Wandia
Does anyone know how to weight cases in a data frame using a frequency vector? I'm trying to run tabulations on R , on a data set that first needs to have weighted cases before i run the tabulations. In SPSS SAS its quite simple, but i'm unable to do it in R. [[alternative HTML version

Re: [R] Estimating the standard error when you have sampling weights.

2008-11-25 Thread David Winsemius
I am having difficulty thinking that you cannot find general material by doing a Google search, but can tell you from memory that the US National Center for Health Statistics publishes on the WWW quite a bit of information about their survey methods. For an R-centric answer: Have you

Re: [R] WEIGHT CASES by Frequency VECTOR

2008-11-25 Thread Peter Dalgaard
sharon Wandia wrote: Does anyone know how to weight cases in a data frame using a frequency vector? I'm trying to run tabulations on R , on a data set that first needs to have weighted cases before i run the tabulations. In SPSS SAS its quite simple, but i'm unable to do it in R. xtabs()

Re: [R] dataframe

2008-11-25 Thread stephen sefick
Jim, I learned how to use textConnection today thanks On Tue, Nov 25, 2008 at 8:17 AM, jim holtman [EMAIL PROTECTED] wrote: Does this do it for you: x - read.table(textConnection(abc 123 345 + abc 345 456 + lmn 567 345 + hkl 568 535 + lmn 096 456 + lmn 768 094)) x V1 V2 V3 1

Re: [R] Estimating the standard error when you have sampling weights.

2008-11-25 Thread Peter Dalgaard
David Winsemius wrote: I am having difficulty thinking that you cannot find general material by doing a Google search, but can tell you from memory that the US National Center for Health Statistics publishes on the WWW quite a bit of information about their survey methods. For an R-centric

Re: [R] dataframe help

2008-11-25 Thread David Winsemius
Not sure that solution properly focuses the unique function on the first column, and even when I tried to do so, my code using did not produce what I expected. The unique function does not return a logical vector. Try: ships[!duplicated(ships$type), ] And Rajasekaramya, please include

Re: [R] Latin Hypercube with condition sum = 1

2008-11-25 Thread Rob Carnell
Rainer M Krug r.m.krug at gmail.com writes: Hi I want to du a sensitivity analysis using Latin Hypercubes. But my parameters have to fulfill two conditions: 1) ranging from 0 to 1 2) have to sum up to 1 So far I am using the lhs package and am doing the following: library(lhs)

[R] Efficient passing through big data.frame and modifying select fields

2008-11-25 Thread Johannes Graumann
Hi all, I have relatively big data frames ( 1 rows by 80 columns) that need to be exposed to merge. Works marvelously well in general, but some fields of the data frames actually contain multiple ;-separated values encoded as a character string without defined order, which makes the fields

Re: [R] Count days of current year

2008-11-25 Thread hadley wickham
Why not write it yourself? days_in_year - function(year) { 365 + (year %% 4 == 0) - (year %% 100 == 0) + (year %% 400 == 0) } This should work for any year in the Gregorian calendar. Hadley On Mon, Nov 24, 2008 at 1:25 PM, Felipe Carrillo [EMAIL PROTECTED] wrote: Hi: Is there a function

Re: [R] compute pearson correlation p-values for all combinations of columns of 2 matrices

2008-11-25 Thread David Winsemius
Didn't this question get asked and answered within a week or two? Daren Tan, meet John Baron's help search page: http://search.r-project.org/ ( and it apparently gets repeatedly asked and answered over the years.) -- David Winsemius On Nov 25, 2008, at 7:14 AM, Daren Tan wrote:

[R] glm or transformation of the response?

2008-11-25 Thread Christoph Scherber
Dear all, For an introductory course on glm?s I would like to create an example to show the difference between glm and transformation of the response. For this, I tried to create a dataset where the variance increases with the mean (as is the case in many ecological datasets):

[R] Statistical question: one-sample binomial test for clustered data

2008-11-25 Thread Matthias Gondan
Dear list, I hope the topic is of sufficient interest, because it is not R-related. I have N=100 yes/no-responses from a psychophysics paradigm (say Y Yes and 100-Y No-Responses). I want to see whether these yes-no-responses are in line with a model predicting a certain amount p of

Re: [R] Latin Hypercube with condition sum = 1

2008-11-25 Thread Rainer M Krug
On Tue, Nov 25, 2008 at 4:16 PM, Rob Carnell [EMAIL PROTECTED] wrote: Rainer M Krug r.m.krug at gmail.com writes: Hi I want to du a sensitivity analysis using Latin Hypercubes. But my parameters have to fulfill two conditions: 1) ranging from 0 to 1 2) have to sum up to 1 So far I am

Re: [R] Rendering Dendrograms

2008-11-25 Thread Thomas Petzoldt
Hi Mark, similar questions were at least two times during the last weeks, see http://tolstoy.newcastle.edu.au/R/e5/help/08/11/6722.html http://tolstoy.newcastle.edu.au/R/e5/help/08/11/6736.html or http://tolstoy.newcastle.edu.au/R/e5/help/08/11/7790.html or search the archives yourself:

Re: [R] Count days of current year

2008-11-25 Thread Gabor Grothendieck
Similarly tis and chron have nearly the identical function: library(tis) 365 + isLeapYear(2000:2010) [1] 366 365 365 365 366 365 365 365 366 365 365 isLeapYear function (y) y%%4 == 0 (y%%100 != 0 | y%%400 == 0) environment: namespace:tis library(chron) 365 + leap.year(2000:2010) [1] 366

[R] How to split DF into a list and avoid NULL elements in this list

2008-11-25 Thread Lauri Nikkinen
Hello, I'm trying to split my DF into a list using incremental loop. How can I avoid NULL elements in this list? DF - data.frame(var1 = 1:10, var2 = 11:20, var3 = 21:30, var4 = 31:40) x - list() i - 1 while (i = ncol(DF)-1) { x[[i]] - DF[, i:c(i+1)] i - i + 2 } x Many

[R] title second y-axis in lattice plot

2008-11-25 Thread robbie . heremans
Dear R-users, After adding the secondary y-axis at the right side of a lattice xyplot (cfr. Lattice: Multivariate Data Visualization with R - figures 8.4 and 8.6, from http://lmdvr.r-forge.r-project.org/figures/figures.html), I'm trying to add a title to that second y-axis (which has to be

Re: [R] How to split DF into a list and avoid NULL elements in this list

2008-11-25 Thread Jagat.K.Sheth
Here's one way x - sapply(seq(1,ncol(DF),by=2), function(i) DF[,i:(i+1)], simplify=F) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lauri Nikkinen Sent: Tuesday, November 25, 2008 9:00 AM To: [EMAIL PROTECTED] Subject: [R] How to split DF into a list

[R] problems of R+Weka+Xmeans

2008-11-25 Thread Jerry Zhang
Hi guys, I have one problem when I use R+Weka+Xmeans. I set the parameters for Xmeans as follows: xc.control - Weka_control(I=10,M=1000,J=1000,L=1000,H=2000,B=1.0, C=0.5,D=weka.core.EuclideanDistance,S=20) xc - XMeans(data,control=xc.control) Here I set the L as 1000. according to Xmeans in

Re: [R] how to check linearity in Cox regression

2008-11-25 Thread Michael Margolis
On examining non-linearity of Cox coefficients with penalized splines - I have not been able to dig up a completely clear description of the test performed in R or S-plus. From the Therneau and Grambsch book (2000 - page 126) I gather that the test reported for linear has as its null hypothesis

[R] Frequency Spectrum fft plot dillema

2008-11-25 Thread Rthoughts
Hi, I have more questions about the fft. The application in Excel is very limited. In Excel I can adjust graphs and calibrate the x and y-axis. The input and process, however, is limited compared to R. With a Dataset table where one column is the hour difference and the second are the values

[R] Heat Maps

2008-11-25 Thread Jacques Wagnor
Dear List, Does there exist a function that produces a heat map like this one (image 3 of 4): http://www.tdameritrade.com/tradingtools/options360.html?a=HDYreferrer=http%3A%2F%2Fquery.nytimes.com%2Fsearch%2Fsitesearch%3Fquery%3Dheatmaptype%3Dnyt In addition to colors, two other main features I

Re: [R] Using R from C++ code

2008-11-25 Thread David Winsemius
Your reading of the referenced page is completely different than mine, ... but IANAL. In particular: Q3: Can an open source software project combine and distribute any of Sun’s GPL-licensed MySQL software with other open source software under the FOSS License Exception? A: Open

Re: [R] glm or transformation of the response?

2008-11-25 Thread joris meys
I'm not sure on what kind of dataset would be most appropriate, but following code I used to create a dataset with a linear response and an increasing variance (the megaphone type, common in ecological datasets if I'm right) : beta0 - 10 beta1 - 1 x - c(1:40) y - beta0 + x*beta1

Re: [R] glm or transformation of the response?

2008-11-25 Thread Peter Dalgaard
Christoph Scherber wrote: Dear all, For an introductory course on glm?s I would like to create an example to show the difference between glm and transformation of the response. For this, I tried to create a dataset where the variance increases with the mean (as is the case in many

[R] Query regarding an error while using SEGMENTED (V0.2-4)

2008-11-25 Thread IWASAKI, Yuichi
Dear All, Currently I'm using the segmented package. While using the package, (i.e segmented - version 0.2-4) to investigate a possible change point (around X = 2) in my data, I had the following error message: dat00-read.table(data.txt,header=T) library(segmented) glm.Y-glm(Y~X,data=dat00)

Re: [R] printing help files directly from R prompt

2008-11-25 Thread Faheem Mitha
On Tue, 25 Nov 2008, Uwe Ligges wrote: See ?help and its argument offline Uwe Ligges Thanks, that's very helpful. This doesn't exactly print, but saves the help page to a ps file, which is as good as. help(write.table, offline=TRUE) No latex file is available: shall I try to create

Re: [R] glm or transformation of the response?

2008-11-25 Thread Christoph Scherber
Dear Peter, But even if I change things as you suggested, the question still remains the same: why do the glm models perform so poorly on this dataset? And what would your advice to the students be? Best wishes Christoph # by the way, I disagree on taking logs on the explanatory; the

Re: [R] Statistical question: one-sample binomial test for clustered data

2008-11-25 Thread Greg Snow
I don't have a good reference for you, but here are a couple of things that you could try: 1. Do a bootstrap estimation of p by resampling the blocks of 5 (rather than the individual observations) and see if the hypothesized p is in the confidence interval. 2. Simulate data using the

Re: [R] Heat Maps

2008-11-25 Thread hadley wickham
On Tue, Nov 25, 2008 at 9:18 AM, Jacques Wagnor [EMAIL PROTECTED] wrote: Dear List, Does there exist a function that produces a heat map like this one (image 3 of 4):

Re: [R] Replace NaN with zero

2008-11-25 Thread Alexandre Swarowsky
what about ?sub and ?ifelse Spilak,Jacqueline [Edm] wrote: I need help with replacing NaN with zero (the value '0') in my dataset. The reason is that I can't get it to graph because of the NaN in the dataset. I have tried: data[is.nan(data)] - 0 that others have suggested in the help

[R] plotting density for truncated distribution

2008-11-25 Thread Jeroen Ooms
I am using density() to plot a density curves. However, one of my variables is truncated at zero, but has most of its density around zero. I would like to know how to plot this with the density function. The problem is that if I do this the regular way density(), values near zero automatically

Re: [R] Heat Maps

2008-11-25 Thread jim holtman
Try the 'portfolio' package; it has a basic treemap. On Tue, Nov 25, 2008 at 10:18 AM, Jacques Wagnor [EMAIL PROTECTED] wrote: Dear List, Does there exist a function that produces a heat map like this one (image 3 of 4):

Re: [R] plotting density for truncated distribution

2008-11-25 Thread roger koenker
Default kernel density estimation is poorly suited for this sort of situation. A better alternative is logspline -- see the eponymous package -- you can specify lower limits for the distribution as an option. url:www.econ.uiuc.edu/~rogerRoger Koenker email[EMAIL

Re: [R] select a subset

2008-11-25 Thread Stavros Macrakis
How about something like: censor_choose - function(fr) do.call(rbind, lapply( split( fr, fr$id), function(sub) sub[which.max( if (max(sub$censor)) sub$censor else sub$time) ,] ) ) Using your data, itc - data.frame(id=

[R] Line color based on data values?

2008-11-25 Thread Rory.WINSTON
Hi all Does anyone know if it is possible when plotting a line or scatter plot, to selectively color the data points based on the data value? i.e. if plotting say the percentage change in stock price movements, to color +ve points in green and -ve points in red? And extending this to a

[R] calculating an N50

2008-11-25 Thread Jeremy Leipzig
Given a set of integers of different values how do I calculate the minimum number of the largest of integers that are required, when summed, to equal 50% of the total sum of the the set? For example, length(myTable$lgth) [1] 303403 sum(myTable$lgth) [1] 4735396 I know through brute force that

Re: [R] calculating an N50

2008-11-25 Thread Jeremy Leipzig
Given a set of integers of different values how do I calculate the minimum number of the largest of integers that are required, when summed, to equal 50% of the total sum of the the set? Actually I need the value of the smallest member such that the sum of all members equal or greater to that

Re: [R] basic information defining functions

2008-11-25 Thread Bunny, lautloscrew.com
Thank very much ! Indexing is exactly the problem. I think it´s not because somebody wrote a bad doc, it´s rather because being an amateur PHP etc scripter i did not realize the power of this indexing yet. Sometime ago i surely would have used a lot more loops instead of proper indexing.

Re: [R] calculating an N50

2008-11-25 Thread Greg Snow
Try this: tmp - sample( 100, 50 ) tmp2 - rev( sort(tmp) ) tmp3 - cumsum(tmp2) = sum(tmp)/2 sum(tmp3) # number needed [1] 14 tmp2[ sum(tmp3) ] # the smallest value [1] 78 sum(tmp2[tmp3]) / sum(tmp) # check [1] 0.4894614 sum(tmp2[ 1:(sum(tmp3)+1) ]) / sum(tmp) [1] 0.519516 Hope this

Re: [R] calculating an N50

2008-11-25 Thread Barry Rowlingson
2008/11/25 Jeremy Leipzig [EMAIL PROTECTED]: Given a set of integers of different values how do I calculate the minimum number of the largest of integers that are required, when summed, to equal 50% of the total sum of the the set? Actually I need the value of the smallest member such that

Re: [R] Line color based on data values?

2008-11-25 Thread Greg Snow
Try this: tmp - with(iris, seq( min(Petal.Length)-1, max(Petal.Length)+1, length.out=6)) with( iris, plot( Sepal.Width, Sepal.Length, col=topo.colors(5)[ cut(Petal.Length,tmp) ] ) ) hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL

Re: [R] Line color based on data values?

2008-11-25 Thread Daniel Malter
Hi, for example: today=rnorm(100) yesterday=rnorm(100) up=today[todayyesterday] down=today[todayyesterday] index.up=which(todayyesterday) index.down=which(todayyesterday) plot(up~yesterday[index.up],col=green,xlim=c(-5,5),ylim=c(-5,5)) points(down~yesterday[index.down],col=red) today: today's

Re: [R] how to read .sps (SPSS file extension)?

2008-11-25 Thread livio finos
sorry, you are completely right! sps is not the extension for portable file! sorry for the time I make you spend. I try to make my problem more clear. I exporting a dataset from limesurvey (a free software for internet survey). It works very fine and it allow to export in different format such as

[R] Strange seq() behavior

2008-11-25 Thread Jon Zadra
Hi, This is really strange. Can anyone help explain what's going on here (on 3 and 7)? targets - seq(from=.1, to=.9, by=.1) targets[1]==.1 [1] TRUE targets[2]==.2 [1] TRUE targets[3]==.3 [1] FALSE targets[4]==.4 [1] TRUE targets[5]==.5 [1] TRUE targets[6]==.6 [1] TRUE

[R] AD Model Builder now freely available

2008-11-25 Thread dave fournier
Hi All, Following Mike Praeger's posting on this list, I'm happy to pass on that AD Model Builder is now freely available from the ADMB Foundation. http://admb-foundation.org/ Two areas where AD Model builder would be especially useful to R users are multi-parmater smooth optimization as

Re: [R] Strange seq() behavior

2008-11-25 Thread Jorge Ivan Velez
Dear Jon, See FAQ 7.31 at http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f HTH, Jorge On Tue, Nov 25, 2008 at 1:05 PM, Jon Zadra [EMAIL PROTECTED] wrote: Hi, This is really strange. Can anyone help explain what's going on here (on 3 and

Re: [R] title second y-axis in lattice plot

2008-11-25 Thread Deepayan Sarkar
On 11/25/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear R-users, After adding the secondary y-axis at the right side of a lattice xyplot (cfr. Lattice: Multivariate Data Visualization with R - figures 8.4 and 8.6, from http://lmdvr.r-forge.r-project.org/figures/figures.html), I'm

Re: [R] calculating an N50

2008-11-25 Thread Daniel Malter
Greg's solution is most elegant (I think). This is more of an illustrative approach: set.seed(1) #to replicate identical sampling if you use this code x=sample(1:100,replace=T) x=rev(sort(x)) #reverse order sum(x)/2 # what is the mean of x: 2613.5 cumsum(x) # the cumulative sums for x=1:i

[R] optimization with bounds on parameters

2008-11-25 Thread John C Nash
There have been several posts about optimizations where the parameters for the objective function are bounds-constrained. Brian Ripley took my 1990 Compact numerical methods for computers codes and p2c'd them to give the CG and BFGS and (possibly, I should check!) the Nelder Mead code.

Re: [R] AD Model Builder now freely available

2008-11-25 Thread Rubén Roa-Ureta
dave fournier wrote: Hi All, Following Mike Praeger's posting on this list, I'm happy to pass on that AD Model Builder is now freely available from the ADMB Foundation. http://admb-foundation.org/ Two areas where AD Model builder would be especially useful to R users are multi-parmater

Re: [R] [R-pkgs] RQDA-0.1.5 is released

2008-11-25 Thread Adrian Dusa
Hi ronggui, I tried to install your package under linux (Kubuntu Intrepid), but the depending package RGtk2 does not install under Linux, some kind of an error Warning message: In install.packages(c(DBI, RSQLite, RGtk2, gWidgets, gWidgetsRGtk2)) installation of package 'RGtk2' had non-zero

Re: [R] lattice contourplot background covers inward-facing ticks

2008-11-25 Thread Richard . Cotton
I wish to have inward-pointing ticks on my contourplot graph, but the colored background produced by the region=TRUE statement covers the ticks up, is there any way around this? Sample code below. --Seth library(lattice) model - function(a,b,c,d,e, f, X1,X2) # provide model

[R] run time function for R scripts?

2008-11-25 Thread Brigid Mooney
Hi All, I was wondering if there was a function in R that would output the total run time for various scripts. For now I have the following workaround: begTime - Sys.time() ... the rest of the R script... runTime - Sys.time()-begTime Is there another function that I don't know about that

  1   2   >