Re: [R] regular expression question

2011-04-12 Thread Peter Langfelder
On Mon, Apr 11, 2011 at 10:49 PM, Erin Hodgess erinm.hodg...@gmail.com wrote: Dear R People: I have a data frame with the following column names: names(funky)  [1] UHD.1   UHD.2   UHD.3   UHD.4   L..W..1 L..W..2 L..W..3  [8] L..W..4 B..W..1 B..W..2 B..W..3 B..W..4 W..B..1 W..B..2 [15]

Re: [R] regular expression question

2011-04-12 Thread Joshua Wiley
Hi Erin, Please read ?grep. It is clearly not the function you want (neither is strsplit() either really). This does what you want and you can modify for upper/lower case if you need it. Also note that regular expressions exist separate from R, so while : may have seemed natural to select a

Re: [R] Regression model with proportional dependent variable

2011-04-12 Thread Achim Zeileis
On Mon, 11 Apr 2011, ty ty wrote: Hello, dear experts. I don't have much experience in building regression models, so sorry if this is too simple and not very interesting question. Currently I'm working on the model that have to predict proportion of the debt returned by the debtor in some

Re: [R] Adding text labels to lattice plots with multiple panels

2011-04-12 Thread Deepayan Sarkar
On Mon, Apr 11, 2011 at 12:49 AM, Jeff Stevens stev0...@gmail.com wrote: Many thanks, Peter.  This works brilliantly, and I prefer to have the labels assigned outside of panel function as well. You could also consider using which.packet(). You haven't explicitly told us how the labels are

[R] Optimzing a nested function

2011-04-12 Thread vioravis
I am trying to optimize a nested function using nlminb. This throws out an error that y is missing. Can someone help me with the correct syntax?? Thank you. test1 - function(x,y) { sum - x + y return(sum) } test2 - function(x,y) { sum - test1(x,y) sumSq - sum*sum return(sumSq) }

[R] iterative methods in R

2011-04-12 Thread rvohen
does some know iterative methods in R ? thank you! -- View this message in context: http://r.789695.n4.nabble.com/iterative-methods-in-R-tp3443837p3443837.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] Optimzing a nested function

2011-04-12 Thread Mario Valle
P.S.: It is bad taste to call a variable 'sum' because it is a R function. Ciao! mario On 12-Apr-11 08:33, vioravis wrote: I am trying to optimize a nested function using nlminb. This throws out an error that y is missing. Can someone help me with the correct syntax?? Thank

Re: [R] Override col.lines and col.symbol in panel.xyplot with type='b'

2011-04-12 Thread Deepayan Sarkar
On Mon, Apr 11, 2011 at 9:27 PM, Szumiloski, John john_szumilo...@merck.com wrote: Dear useRs, I have a longitudinal experiment with several treatment groups, ~20 subjects per group, ~6 timepoints and a continuous dependent variable.  I have been successfully been using lattice::xyplot with

Re: [R] Regression model with proportional dependent variable

2011-04-12 Thread peter dalgaard
On Apr 12, 2011, at 08:45 , Achim Zeileis wrote: On Mon, 11 Apr 2011, ty ty wrote: Hello, dear experts. I don't have much experience in building regression models, so sorry if this is too simple and not very interesting question. Currently I'm working on the model that have to predict

Re: [R] Regression model with proportional dependent variable

2011-04-12 Thread Achim Zeileis
On Tue, 12 Apr 2011, peter dalgaard wrote: On Apr 12, 2011, at 08:45 , Achim Zeileis wrote: On Mon, 11 Apr 2011, ty ty wrote: Hello, dear experts. I don't have much experience in building regression models, so sorry if this is too simple and not very interesting question. Currently I'm

Re: [R] Adding margin text to lattice graphics

2011-04-12 Thread Deepayan Sarkar
On Mon, Apr 11, 2011 at 3:53 AM, baptiste auguie baptiste.aug...@googlemail.com wrote: Yes, very sorry about this -- I had subconsciously ignored the hypothetical possibility that anyone wouldn't have ggplot2 loaded in their .Rprofile ;) Replacing mpg with beaver1 (datasets) should be more

Re: [R] forest + igraph ?

2011-04-12 Thread Viechtbauer Wolfgang (STAT)
It is not clear (at least to me) what exactly you want. You want two forest plots in one graph but apparently not side-by-side or one on top and the other on the bottom. So, you want to superimpose them? How do you want to do that without creating an illegible mess? Or do you want one graph,

Re: [R] look for the package of latent class stochastic frontier

2011-04-12 Thread Arne Henningsen
Hi hnlidexi On 10 April 2011 02:47, 李德洗 hnlid...@foxmail.com wrote: Dear all, I want to finished my paper by latent class Stochastic Frontier Analysis , but i can not find the package, is there anyone that may help me As far as I know, there is no R function/package that estimates latent

Re: [R] RExcel

2011-04-12 Thread Erich Neuwirth
rcom has its own mailing list. Please subscribe at rcom.univie.ac.at and post all questions there. On 4/12/2011 1:04 AM, array chip wrote: Yes, I did, and no error message. And comRegisterRegistry() returns NULL, not sure if that matters John

Re: [R] Non linear Regression: singular gradient matrix at initial parameter estimates

2011-04-12 Thread Peter Ehlers
On 2011-04-11 13:29, Felix Nensa wrote: Hi, I am using nls to fit a non linear function to some data but R keeps giving me singular gradient matrix at initial parameter estimates errors. For testing purposes I am doing this: ### R code ### x- 0:140 y- 200 / (1 + exp(17 - x)/2) * exp(-0.02*x)

[R] Testing equality of coefficients in coxph model

2011-04-12 Thread Michael Haenlein
Dear all, I'm running a coxph model of the form: coxph(Surv(Start, End, Death.ID) ~ x1 + x2 + a1 + a2 + a3) Within this model, I would like to compare the influence of x1 and x2 on the hazard rate. Specifically I am interested in testing whether the estimated coefficient for x1 is equal (or not)

Re: [R] Optimzing a nested function

2011-04-12 Thread Duncan Murdoch
On 11-04-12 2:33 AM, vioravis wrote: I am trying to optimize a nested function using nlminb. This throws out an error that y is missing. Can someone help me with the correct syntax?? Thank you. See ?nlminb. The parameters to optimize should be given as a vector in a single parameter. Other

Re: [R] Zoom on simple.violinplot

2011-04-12 Thread Peter Ehlers
On 2011-04-11 09:44, PhDGuy wrote: Hello, I am using the function simple.violinplot from the package UsingR. I have some outliers in my dataset so that the distribution has very long tails. As a result, the y-axis of the output of simple.violinplot extends to very large values. I would like to

Re: [R] good examples of plot(table())

2011-04-12 Thread Jim Lemon
On 04/12/2011 12:29 AM, dirknbr wrote: I am looking for good examples of visualising a tabulation using plot(table()) maybe with colour coding or indexing. Hi Dirk, A basic function for this is addtable2plot in the plotrix package. No color coding, but you can have row and column names. Jim

Re: [R] Optimzing a nested function

2011-04-12 Thread Ravishankar Rajagopalan
Thanks Duncan and Mario. It works fine now. On Tue, Apr 12, 2011 at 3:11 PM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 11-04-12 2:33 AM, vioravis wrote: I am trying to optimize a nested function using nlminb. This throws out an error that y is missing. Can someone help me with the

Re: [R] forest + igraph ?

2011-04-12 Thread Samor Gandhi
Thank you for your reply. I would like to have two forest plots one on top and the other on the bottom. I am using R version 2.12.2 (32-bit) Windows. The code you sent me still plotting two windows one after the other? Best wishes and many thanks, Samor --- On Tue, 12/4/11, Viechtbauer

[R] cross-validation complex model AUC Nagelkerke R squared code

2011-04-12 Thread Jürgen Biedermann
Hi there, I really tried hard to understand and find my own solution, but now I think I have to ask for your help. I already developed some script code for my problem but I doubt that it is correct. I have the following problem: Image you develop a logistic regression model with a binary

[R] plot3d crashes R

2011-04-12 Thread el . romaro
Hi Duncan, I've just read the help for the plot3d function you've written and tried out the example code given at the bottom of the page. I then modified the function by adding an aspect ratio of 0.1 and ran it again, which crashed my R. I am using 2.12.2 on Windows, if that tells you

[R] question about optim

2011-04-12 Thread chirine wolley
Dear R-users, I would like to use optim( ) to minimize a function which depends on 4 parameters: 2 vectors, a scalar, and a matrix. And I have a hard to define the parameters at the beginning of the function, and then to call optim. Indeed, all the examples I have seen dont treat cases where

Re: [R] Testing equality of coefficients in coxph model

2011-04-12 Thread Dr. Pablo E. Verde
Hi Michael, One way to work out you problem is with bootstrap methods. The following is a toy example that may be help you for you: # test data... library(survival) set.seed(1007) x - runif(50) mu - c(rep(1, 25), rep(2, 25)) test1 - data.frame(Time = qsurvreg(x, mean = mu, scale= 0.5,

Re: [R] forest + igraph ?

2011-04-12 Thread Viechtbauer Wolfgang (STAT)
You said that you do NOT want to use par(mfrow=c(2,1)). Why not? Isn't this (below) what you want? library(metafor) data(dat.bcg) windows(height=8, width=6, pointsize=10) par(mfrow=c(2,1)) dat - escalc(measure=RR, ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg) forest(dat$yi, dat$vi,

Re: [R] Zoom on simple.violinplot

2011-04-12 Thread Peter Ehlers
On 2011-04-12 02:50, Peter Ehlers wrote: On 2011-04-11 09:44, PhDGuy wrote: Hello, I am using the function simple.violinplot from the package UsingR. I have some outliers in my dataset so that the distribution has very long tails. As a result, the y-axis of the output of simple.violinplot

[R] lapply over list and the respective name of the list item

2011-04-12 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
Hi all, I find myself sometimes in the situation where I lapply over a list and in the particular function I'd like to use the name and or position of the respective list item. What I usually do is to use mapply on the list and the names of the list / a position list: o - list(A=1:3, B=1:2, C=1)

Re: [R] Testing equality of coefficients in coxph model

2011-04-12 Thread Dennis Murphy
Hi: Another possible approach (untested) would be to compare the two models m1 - coxph(Surv(Start, End, Death.ID) ~ x1 + x2 + a1 + a2 + a3) m0 - coxph(Surv(Start, End, Death.ID) ~ I(x1 + x2) + a1 + a2 + a3) anova(m0, m1) This should be able to test H_0: beta_1 = beta_2. If you want to test that

Re: [R] iterative methods in R

2011-04-12 Thread Ben Bolker
rvohen bingbingzhang87 at 126.com writes: does some know iterative methods in R ? thank you! Please read the posting guide and ask a more specific question; then someone may be able to help. Ben Bolker __ R-help@r-project.org mailing list

Re: [R] read in summarised data as table()

2011-04-12 Thread Uwe Ligges
as.table(as.matrix(X)) Uwe Ligges On 11.04.2011 22:54, dirknbr wrote: Ok it looks like this x yz a 12 12 34 b 34 34 35 c 56 78 0 where the numbers are counts of cases I can read it in, but how do I tell R it's a table? Dirk -- View this message in context:

Re: [R] Is there some command or alternative using dist.dna in ape package for models not included like GTR?

2011-04-12 Thread Ben Bolker
Ignacio Quintero ignacioquinterom at gmail.com writes: I am making some DNA distances and I would like to use dist.dna as matrix in R, but this command does not include models like GTR... Is there some command or alternative using dist.dna in ape package for models not included like GTR?

[R] Converting a categorical variable to multiple dichotemous variables

2011-04-12 Thread Shane Phillips
I have a categorical variable in a dataframe similar to the following... cat 1 1 3 2 4 I need to convert it to 4 dichotemous variables for each observations like... cat1cat2cat3cat4 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0

Re: [R] Rotation Forest in R

2011-04-12 Thread Liaw, Andy
I don't have access to that article, but just reading the abstract, it should be quite easy to do by writing a wrapper function that calls randomForest(). I've done so with random projections before. One limitation to methods like these is that they only apply to all numeric data. Andy

Re: [R] Fwd: CRAN problem with plyr-1.4.1

2011-04-12 Thread Uwe Ligges
On 11.04.2011 21:03, Douglas Bates wrote: The first thing to do is try another mirror. The official (or as official as we ever get about anything) U.S. mirror is http://cran.us.R-project.org They tend to be very good about updating. Presently the source package for plyr is at version 1.5

[R] likelihood for new data from fitted nlme object

2011-04-12 Thread Andrew Bateman
Dear list, I have a fitted nlme object from which I want to produce estimates of the (marginal) likelihood for new data, given the fitted model.  I am trying to cross validate a number of nonlinear mixed effects models, and I would like to find a way to calculate the marginal likelihood for

[R] 1 continuous non-normal variable ~ 4 factors + 1 continuous covariate (with interactions)

2011-04-12 Thread Alal
Hello Im struggling on something... I have one continuous variable (A), and I need to explain it with 4 factors, and maybe one continuous covariate. And of course, my variable A is not normal at all (it's a duration in seconds, whole numbers). What can I do? I would know how do deal with it if

Re: [R] iterative methods in R

2011-04-12 Thread dirknbr
Since R is built for statistics almost all is based on iterative methods converging towards something. -- View this message in context: http://r.789695.n4.nabble.com/iterative-methods-in-R-tp3443837p378.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Converting a categorical variable to multiple dichotemous variables

2011-04-12 Thread andrija djurovic
hi: here is one solution: cat-as.factor(c(1,1,3,2,4)) model.matrix(~cat-1,cat) cbind(cat,model.matrix(~cat-1,cat)) Andrija On Tue, Apr 12, 2011 at 2:17 PM, Shane Phillips sphill...@lexington1.netwrote: I have a categorical variable in a dataframe similar to the following... cat 1 1 3 2

Re: [R] Help required

2011-04-12 Thread Steve Lianoglou
Hi Sadaf, Out of curiosity, what sorts of things have you tried to fix this? For example, after playing around with this a bit, if I remove your eps parameter from your `ranges` list, it works. Perhaps you should try tweaking the values you pick for your parameters. You don't even have to put

Re: [R] Converting a categorical variable to multiple dichotemousvariables

2011-04-12 Thread Dr. Pablo E. Verde
Hi Shane, An alternative is: cat-as.factor(c(1,1,3,2,4)) outer(cat, levels(cat), ==)+0 Cheers, Pablo - Original Message - From: andrija djurovic djandr...@gmail.com To: Shane Phillips sphill...@lexington1.net Cc: r-help@r-project.org Sent: Tuesday, April 12, 2011 2:32 PM Subject:

Re: [R] 1 continuous non-normal variable ~ 4 factors + 1 continuous covariate (with interactions)

2011-04-12 Thread Dr. Pablo E. Verde
Im struggling on something... I have one continuous variable (A), and I need to explain it with 4 factors, and maybe one continuous covariate. And of course, my variable A is not normal at all (it's a duration in seconds, whole numbers). What can I do? I would know how do deal with it if I

Re: [R] Testing equality of coefficients in coxph model

2011-04-12 Thread Frank Harrell
Another approach is to use the rms package: require(rms) f - cph(Surv(...) ~ x1 + x2 + ...) contrast(f, list(x1=1, x2=0), list(x1=0, x2=1)) Frank djmuseR wrote: Hi: Another possible approach (untested) would be to compare the two models m1 - coxph(Surv(Start, End, Death.ID) ~ x1 + x2

Re: [R] Adding text labels to lattice plots with multiple panels

2011-04-12 Thread Jeff Stevens
Hi Deepayan Many thanks for bringing the which.packet() function to my attention--I missed it in the book. I do prefer that the panel function applies the labels to the data rather than adding them directly to the data in advance. Jeff On Tue, Apr 12, 2011 at 8:50 AM, Deepayan Sarkar

Re: [R] nndist R vs. ArcGIS

2011-04-12 Thread smoluka
The problem was on the ArcGIS 10 end. The program corrupted my layers. I re-created the layer and now I get the same answer. Thank you all for your insight. Alexis PS, the scale is in terms of owl territories and therefore 1.3 km is really huge. -- View this message in context:

[R] extract element from list by rownames

2011-04-12 Thread Alfredo Alessandrini
Hi, I've a list of list. I want to extract an element by the rownames. I can extract it by: data[[1]][[1]][[4]][1] But I want to exctract it by a command like this: data[[1]][[B0]][[smac]][[cont]][1] It's possible? Thanks, Alfredo str(data) List of 1 $ :List of 4 ..$ :List of 4

Re: [R] how to handle no lines in input with pipe()

2011-04-12 Thread Andrew Yee
Thank you very much for your suggestion...that works perfectly. Thanks, Andrew On Mon, Apr 4, 2011 at 5:46 PM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On Mon, 4 Apr 2011, Andrew Yee wrote: This has to do with using pipe() and grep and read.csv() I have a .csv file that I grep using

Re: [R] Fwd: CRAN problem with plyr-1.4.1

2011-04-12 Thread Uwe Ligges
On 12.04.2011 14:52, Ian Davis wrote: Uwe, I really do appreciate the help from you and Douglas on resolving this problem. However, I respectfully disagree on a few points: - install.packages() was broken and failing to install successfully. install.packages() works well, it is *not*

[R] Datadist error

2011-04-12 Thread Sander van Kuijk
Dear all, I have performed a simple logistic regression using the lrm function from the Design library. Now I want to plot the summary, or make a nomogram. I keep getting a datadist error: options(datadist= m.full ) not created with datadist. I have tried to specify datadist beforhand (although I

Re: [R] In svm(), how to connect quantitative prediction result to categorical result?

2011-04-12 Thread Saeed Abu Nimeh
I trained a linear svm and did classification. looking at the model I have, with a binary response 0/1, the decision values look like this: head(svm.model$decision.values) 2.5 3.1 -1.0 looking at the fitted values head(svm.model$fitted) 1 1 0 So it looks like anything less than or equal 0 is

[R] Model checking for gam (mgcv) result

2011-04-12 Thread Samuel Turgeon
Dear list, i'm checking the residuals plots of a gam model after a processus of model selection. I found the best model, all my terms are significant, the r-square and the deviance explained are good, but I have strange residuals plots: http://dl.dropbox.com/u/1169100/gam.check.png

Re: [R] Converting a categorical variable to multiple dichotemousvariables

2011-04-12 Thread Shane Phillips
Here is my original script. subject=1:1000 treat=rbinom(1*1000,1,.13) gender=rbinom(1*1000,1,.5) eth=runif(1*1000, min=1, max=4) cogat=rnorm(1*1000, 100, 16) map=rnorm(1*1000, 200, 9) growth=0 simtest=data.frame (subject=subject, treat=treat, gender=gender, eth=round(eth,digits=0),

Re: [R] plot - kamada.kawai layout without arrows

2011-04-12 Thread Gary Weissman
Hello, It appears you are using the igraph package. You can get rid of the arrows using a few different methods. You can make the graph undirected: new.graph - as.undirected(old.graph) plot(new.graph) Or you can simply specify the size of the arrows as zero using either

[R] lookup not working properly

2011-04-12 Thread Dimitri Liakhovitski
Hello! Below is my exmample. myref is my reference data frame with columns a and b. temp is my data with column c analogous to column a in myref. I am trying to create a new variable b - in temp - that matches values from b in myref to values in c. If you look at the resulting data frame (temp -

Re: [R] Fwd: CRAN problem with plyr-1.4.1

2011-04-12 Thread Uwe Ligges
On 12.04.2011 17:08, Ian Davis wrote: 2011/4/12 Uwe Ligges lig...@statistik.tu-dortmund.de mailto:lig...@statistik.tu-dortmund.de On 12.04.2011 14:52, Ian Davis wrote: I really do appreciate the help from you and Douglas on resolving this problem. However, I

Re: [R] Fwd: CRAN problem with plyr-1.4.1

2011-04-12 Thread Ian Davis
2011/4/12 Uwe Ligges lig...@statistik.tu-dortmund.de On 12.04.2011 14:52, Ian Davis wrote: I really do appreciate the help from you and Douglas on resolving this problem. However, I respectfully disagree on a few points: - install.packages() was broken and failing to install successfully.

Re: [R] Fwd: CRAN problem with plyr-1.4.1

2011-04-12 Thread Ian Davis
Uwe, I really do appreciate the help from you and Douglas on resolving this problem. However, I respectfully disagree on a few points: - install.packages() was broken and failing to install successfully. This is why I was tracking down the URL via the CRAN website. - I think it's crazy to

[R] B %*% t(B) = R , then solve for B

2011-04-12 Thread Shawn Koppenhoefer
Hello,.. Apologies for the newbie question but... I have a matrix R, and I know that *B %*% t(b) = R* *I'm trying to solve for B *(aka. 'factoring the correlation matrix' I think) Please help! I've read that 'to solve for B we define the eigenvalues of R and then apply the techniques of

[R] multiple lines on multiple plots

2011-04-12 Thread James Annan
I'm sure this must be trivial, but I'm a novice with R and can't work out how to handle the axes when I am constructing multiple plots on a page and try to return to a previous one to put multiple data sets it. A simple example: --- x- 1:10 y- (1:100)*3 par(mfcol=c(2,1)) plot(x) plot(y)

[R] Bayesian PCA

2011-04-12 Thread Lucy Asher
First of all I should say this email is more of a general statistics questions rather than being specific to using R but I'm hoping that this may be of general interest. I have a dataset that I would really like to use PCA on and have been using the package pcaMethods to examine my data. The

Re: [R] 1 continuous non-normal variable ~ 4 factors + 1 continuous covariate (with interactions)

2011-04-12 Thread Alal
Thanks Im not sure about the gamma, but a survival analysis seems appropriate, but does it work for factors and continuous covariates? Do you have to verify some conditions beforehand? -- View this message in context:

Re: [R] forest + igraph ?

2011-04-12 Thread Samor Gandhi
Thanks, That is a nice one. Is there any option that I can plot the pooled estimate? Regards, Samor --- On Tue, 12/4/11, Viechtbauer Wolfgang (STAT) wolfgang.viechtba...@maastrichtuniversity.nl wrote: From: Viechtbauer Wolfgang (STAT) wolfgang.viechtba...@maastrichtuniversity.nl Subject: RE:

Re: [R] extract element from list by rownames

2011-04-12 Thread B77S
This probably is not ideal, but this works on a list of mine.. ## so you can see the structure of my list str(srMT) List of 4 $ mode : chr discrete $ ks.stat : chr mean $ observed :List of 4 ..$ filter: num [1:13, 1:4] 0.213 0.207 0.144 0.311 0.24 ... .. ..- attr(*,

[R] Merge matrix

2011-04-12 Thread pankaj borah
I have two matrices A and B dim (A) [1] 30380   104 dim(Bt) [1] 30380    63 I want to  combine both A and B to matrix C where dim(C) [1] 30380   167 How do I do that ? Regards, Pankaj Barah Department of Biology, Norwegian University of Science Technology (NTNU) Realfagbygget,

Re: [R] B %*% t(B) = R , then solve for B

2011-04-12 Thread Shawn Koppenhoefer
Hello. I found a solution that may interest others. Recall that my problem was how to use R to decompose a matrix into the product of a matrix and its transpose. or, symbolically: For known matrix M (3x3 matrix) and unknown matrix F and its transpose t(F) where F * t(F) = M

Re: [R] Fwd: CRAN problem with plyr-1.4.1

2011-04-12 Thread Hadley Wickham
Then, can we have the ERROR message, please? Otherwise the only explanation I can guess is that a mirror grabs the contents of a repository exactly in the second the repository is updated and that is unlikely, particularly if more than one mirror is involved. Isn't one possible explanation

Re: [R] Merge matrix

2011-04-12 Thread Kehl Dániel
?cbind should solve your problem 2011-04-12 07:54 keltezéssel, pankaj borah írta: I have two matrices A and B dim (A) [1] 30380 104 dim(Bt) [1] 3038063 I want to combine both A and B to matrix C where dim(C) [1] 30380 167 How do I do that ? Regards, Pankaj Barah

Re: [R] Merge matrix

2011-04-12 Thread Kevin E. Thorpe
On 04/12/2011 10:54 AM, pankaj borah wrote: I have two matrices A and B dim (A) [1] 30380 104 dim(Bt) [1] 3038063 I want to combine both A and B to matrix C where dim(C) [1] 30380 167 How do I do that ? Assuming that Bt is the transpose of B and you want C = [A|Bt] you

Re: [R] Bayesian PCA

2011-04-12 Thread Christian Hennig
Dear Lucy, not an R-related response at all, but if it's questionnaire data, I'd probably try to do dimension reduction in a non-automated way by defining a number of 10 or so meaningful scores that summarise your questions. Dimension reduction is essentially about how to aggregate the given

Re: [R] lookup not working properly

2011-04-12 Thread Sarah Goslee
Dimitri, It isn't clear to me exactly what you are trying to do, but this might be closer. Note the stringsAsFactors argument I added to data.frame: I don't think you are likely to want factors for this application. Also, it's a bad idea to create a variable named c since that is the name of a

Re: [R] B %*% t(B) = R , then solve for B

2011-04-12 Thread Doran, Harold
There are easier solutions. Suppose you have a matrix A, such as: ### Use the info from lm() help ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group - gl(2,10,20, labels=c(Ctl,Trt)) weight - c(ctl, trt) lm.D9 - lm(weight ~

Re: [R] Fast version of Fisher's Exact Test

2011-04-12 Thread Stefan Evert
Is anyone aware of a fast way of doing fisher's exact test for a series of 2 x 2 tables in R? The fisher.test is really slow if n1=1000 and n2 = 1000. If you don't require exact two-sided p-values (determined according to a likelihood criterion as in fisher.test), you can use the vectorised

Re: [R] multiple lines on multiple plots

2011-04-12 Thread John Kane
Try this. === x- 1:10 y- (1:100)*3 par(mfcol=c(2,1)) plot(x, type=o) plot(y) === --- On Tue, 4/12/11, James Annan jdan...@jamstec.go.jp wrote: From: James Annan jdan...@jamstec.go.jp Subject: [R] multiple lines on multiple plots To:

Re: [R] Converting a categorical variable to multiple dichotemousvariables

2011-04-12 Thread Jeremy Hetzel
Shane, Does this work? # Your simulated data subject=1:1000 treat=rbinom(1*1000,1,.13) gender=rbinom(1*1000,1,.5) eth=runif(1*1000, min=1, max=4) cogat=rnorm(1*1000, 100, 16) map=rnorm(1*1000, 200, 9) growth=0 simtest=data.frame (subject=subject, treat=treat, gender=gender,

Re: [R] In svm(), how to connect quantitative prediction result to categorical result?

2011-04-12 Thread Steve Lianoglou
Hi, On Tue, Apr 12, 2011 at 10:54 AM, Saeed Abu Nimeh sabun...@gmail.com wrote: I trained a linear svm and did classification. looking at the model I have, with a binary response 0/1, the decision values look like this: head(svm.model$decision.values) 2.5 3.1 -1.0 looking at the fitted

Re: [R] B %*% t(B) = R , then solve for B

2011-04-12 Thread Shawn Koppenhoefer
BTW, The same solution can be found using SVD (Singular Value Decomposition) example, ## Define the matrix that we want to decompose into the product of a matrix and its transform M-matrix(c(0.6098601, 0.2557882, 0.1857773, 0.2557882, 0.5127065, -0.1384238,

Re: [R] extract element from list by rownames

2011-04-12 Thread B77S
I'm thinking this isn't what you want.. but also: data.frame((srMT[[3]][1]))[b,][2] filter.vel2 MK_SP10.2503257 SB1_SP1 0.2075117 SB4_SP1 0.2358855 B77S wrote: This probably is not ideal, but this works on a list of mine.. ## so you can see the structure of my list

Re: [R] B %*% t(B) = R , then solve for B

2011-04-12 Thread Spencer Graves
For non-square matrices, see qr and svd. Spencer On 4/12/2011 8:43 AM, Doran, Harold wrote: There are easier solutions. Suppose you have a matrix A, such as: ### Use the info from lm() help ctl- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt-

Re: [R] lookup not working properly

2011-04-12 Thread Dimitri Liakhovitski
Thank you, Sarah. This seems to be working: a=c(ba ba,ca ca,da da, lake lake, a, lake lake, b,lake of,lama ca, a,lama ca, b,ma ma) b=c(ba ba,ca ca,OTHER, lake lake, a, lake lake, b,lake of,lama ca, a,lama ca, b,OTHER) myref-data.frame(a=a, b=b) myref$a-as.character(myref$a)

Re: [R] Non linear Regression: singular gradient matrix at initial parameter estimates

2011-04-12 Thread Felix Nensa
Hi Peter, thank you for your reply. Now I see, that P3 is indeed redundand. But with the simplified model... fit = nls(yeps ~ p1 / (1 + exp(p2 - x)) * exp(p4 * x)) ...nls still produces the same error. Any ideas? Felix 2011/4/12 Peter Ehlers ehl...@ucalgary.ca On 2011-04-11 13:29, Felix

Re: [R] B %*% t(B) = R , then solve for B

2011-04-12 Thread Doran, Harold
I gave you a solution for the triangular matrix. Can you explain why that is not what you need? -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shawn Koppenhoefer Sent: Tuesday, April 12, 2011 11:37 AM To: r-help@r-project.org

Re: [R] Model checking for gam (mgcv) result

2011-04-12 Thread Simon Wood
The curve is caused by the zeroes in your data. raw.residual = response - fitted so if response=0 then raw.residual = -fitted. You get a curve, rather than a straight line, on the fitted vs residual plot because the residuals are standardised in a way that also depends on the fitted value.

Re: [R] multiple lines on multiple plots

2011-04-12 Thread jim holtman
Instead of trying to go back to a previous plot, gather up all the data for the plots and generate each one with the appropriate data. This is much easier than trying to keep track of what the dimensions are. Also if the data you want to add is outside the plot, then you have issues with

[R] understanding dump.frames; typo;

2011-04-12 Thread Matt Shotwell
When a function I have stop()s, I'd like it to return its evaluation frame, but not halt execution of the script. In experimenting with this, I became confused with dump.frames. From ?dump.frames: If ‘dump.frames’ is installed as the error handler, execution will continue even in

Re: [R] Non linear Regression: singular gradient matrix at initial parameter estimates

2011-04-12 Thread Mario Valle
Use a more realistic starting point instead of the default one: fit - nls(yeps ~ p1 / (1 + exp(p2 - x)) * exp(p4 * x), start=list(p1=410,p2=18,p4=-.03)) This works for me: fit Nonlinear regression model model: yeps ~ p1/(1 + exp(p2 - x)) * exp(p4 * x) data: parent.frame() p1

Re: [R] Non linear Regression: singular gradient matrix at initial parameter estimates

2011-04-12 Thread Felix Nensa
Hi Mario, yes works great. Thanks! 2011/4/12 Mario Valle mva...@cscs.ch Use a more realistic starting point instead of the default one: fit - nls(yeps ~ p1 / (1 + exp(p2 - x)) * exp(p4 * x), start=list(p1=410,p2=18,p4=-.03)) This works for me: fit Nonlinear regression model model:

Re: [R] question about optim

2011-04-12 Thread Ben Bolker
chirine wolley wolley.chirine at hotmail.com writes: Dear R-users, I would like to use optim( ) to minimize a function which depends on 4 parameters: 2 vectors, a scalar, and a matrix. And I have a hard to define the parameters at the beginning of the function, and then to call optim.

Re: [R] Datadist error

2011-04-12 Thread Frank Harrell
Please follow posting guide and provide a simple completely self-contained example showing the error. Then I'll take a look. Frank Sander wrote: Dear all, I have performed a simple logistic regression using the lrm function from the Design library. Now I want to plot the summary, or make

Re: [R] multiple lines on multiple plots

2011-04-12 Thread John Kane
Or perhaps this as an example of using lines() rather than just getting a line and dot output in the upper graph. x - 1:10 y - (1:100)*3 z - rnorm(100, 150, sd= 75) a - rnorm(10,mean=5, sd= 2.5) par(mfcol=c(2,1)) plot(x) lines(a, col= red) plot(y) lines(z , col=blue) --- On Tue,

[R] Using help in Windows version of R with disabled browser

2011-04-12 Thread Ranjan Maitra
Dear colleagues, I am trying to get someone to use R on MS Windows with the browser disabled. My question is how does he/she get to use R-help which goes off the browser (and correspondingly complains about the inability to start firefox, etc). In linux, which is what I use, this is not a

[R] Predictkion interval using regression coefficients

2011-04-12 Thread Zd Gibbs
I was given a list of parameter estimates from my boss. She wants to predict the dependent variable fsshen beyond jan 2011, the last observation, through December 2011, giving the prediction intervals (90%). I don't know if I have the complete information to do this. So my question(s) is can

Re: [R] Using help in Windows version of R with disabled browser

2011-04-12 Thread Jonathan P Daily
try: options(help_type = 'text') ?options If this works, you can create a site profile (A default is created automatically in windows, if I remember correctly) where you can set this to run in each session. -- Jonathan P. Daily Technician - USGS Leetown

Re: [R] plot3d crashes R

2011-04-12 Thread Ben Bolker
el.romaro at gmail.com writes: Hi Duncan, I've just read the help for the plot3d function you've written and tried out the example code given at the bottom of the page. I then modified the function by adding an aspect ratio of 0.1 and ran it again, which crashed my R. I am using

[R] Assign Character Value to Data Frame

2011-04-12 Thread Sparks, John James
Dear R Helpers, I am trying to write a character value to the row of a data frame and am running into a problem that I don't have when I do this for numeric arguments. For example, the following works just fine: test-data.frame(number=numeric(1)) test[1,]-.5 test number 10.5 But the

Re: [R] Assign Character Value to Data Frame

2011-04-12 Thread Joshua Wiley
Hi John, The error arises because the hold data frame contains factors. This happens by default when creating data frames with character data as you did. Factors have a set number of levels and new values cannot be assigned to them that fall outside their specified levels, hence the error. The

Re: [R] Assign Character Value to Data Frame

2011-04-12 Thread Sarah Goslee
That column of your data frame contains a factor, rather than character values. You don't tell us how you created the data frame, but you might be interested in the stringsAsFactors option to data.frame() and read.table(). Or, if you do actually want a factor for that column, you can use factor()

Re: [R] Predictkion interval using regression coefficients

2011-04-12 Thread Joshua Wiley
Hi Zeda, The short answer to your question is no. All you have are the parameter estimates with no information on variability which you would need to create a prediction interval. Given the great ease of fitting models in R, I would offer to refit the model for my boss, and then (with the model

Re: [R] Predictkion interval using regression coefficients

2011-04-12 Thread Zd Gibbs
I will do that. but I may be back. Thanks. From: Joshua Wiley jwiley.ps...@gmail.com Cc: r-help@r-project.org Sent: Tue, April 12, 2011 1:59:20 PM Subject: Re: [R] Predictkion interval using regression coefficients Hi Zeda, The short answer to your question

[R] help for fgui

2011-04-12 Thread David L Lorenz
Anybody use fgui? I find it very handy. I have a question about an argument to the call to gui in the first example. The argument is argFilter, my question has to do with specifying multiple filters. The argument in that example is argFilter=list(flname={{Text files} {.txt}}) ) ##

[R] Stepwise Regression with no Origin

2011-04-12 Thread Zd Gibbs
I am running a regression equation and i want to enter in 12 IV then stepwise enter 8 variables and not have an origin.   DV is shfl. I  want to enter in the following 12 independent dummy variables ajan bfeb cmar dapr emay fjun And then I want to enter in a stepwise fashion slag6 slag6

  1   2   >