[R] function on strsplit output

2012-07-05 Thread Sarah Auburn
Hi, I am trying to format some data (example matrix "m" below) for which each data point has 2 associated values separated by a comma. I want to replace values <3 with "0" to give the example output below. I have got as far as: out<-lapply(strsplit(m,","),as.numeric) Failed to identify anything a

Re: [R] save conditions in a list

2012-07-05 Thread Christof Kluß
Hi Rui Barradas thank you very much, that's what I searched for result <- lapply(conds, fun, DF) works, if day <- DF$day val <- DF$val Thanks Christof Am 02-07-2012 20:44, schrieb Rui Barradas: > Hello, > > I'm not sure if this is what you want. > > > #-- Make up a dataset >

Re: [R] Silencing the output of install.packages()

2012-07-05 Thread Craig Citro
> I think this has already been done in r59493ff of the svn repos by the > indefatigable Prof. Ripley > Fantastic. I guess it *is* true: the first step in writing any patch for R is to first ask yourself if Brian Ripley has already made the change since the last release. Thanks Brian! -- -cc

Re: [R] Graph showing fitted values obtained by binomial GLM

2012-07-05 Thread Simon Blomberg
You have size as well as time in your model M2. So your newdata (MyData) needs to have size in it too. Cheers, Simon. On 06/07/12 13:55, linda.kate wrote: I have completed a binomial GLM in R (details attached (finalModel.docx)) and I am trying to create a graph of observed and fitted values

Re: [R] Mixed Models providing a correlation structure.

2012-07-05 Thread Simon Blomberg
Aah. From your model description, you are more interested in the covariance structure of the random effects, rather than the residuals. You will then need to use the pdSymm class in the specification of the random effects. See Pinheiro and Bates pp 157-166. Cheers, Simon. On 06/07/12 11:43,

[R] Problem using Lag on time series

2012-07-05 Thread Heston Global
I'm trying to duplicate something in Excel, where it is easy to reference the previous row in formula. Have been stuck on this for ages trying to achieve the same result in R. I've managed to do it with a loop but it takes ages on a large data set. What I want to do is create a new variable in

[R] Graph showing fitted values obtained by binomial GLM

2012-07-05 Thread linda.kate
I have completed a binomial GLM in R (details attached (finalModel.docx)) and I am trying to create a graph of observed and fitted values using the following commands: > MyData<-data.frame(time=seq(from=0,to=1323,by=1)) > Pred<-predict(M2,newdata=MyData,type="response") > plot(x=turtle$time,y=turt

Re: [R] remove loop which compares row i to row i-1

2012-07-05 Thread Joshua Wiley
Hi, Great chance to practice debugging. Rather than trying one complicated statement, break it into pieces. The basic structure is: results <- ifelse(condition, value if true, value if false) Each argument needs to be a vector of the same length. In your case, condition itself consists of two

Re: [R] remove loop which compares row i to row i-1

2012-07-05 Thread David Winsemius
On Jul 5, 2012, at 6:52 PM, jcrosbie wrote: Thank you, I tired ifelse(tUnitsort[length(tUnitsort$Hour),4]>=tUnitsort[-1,4],(tempMC =tUnitsort[length(tUnitsort$Hour),7]),tempMC ) Presumably tempMC is a vector of the appropriate length, in which case this should repalce that loop: tempMC

Re: [R] Mixed Models providing a correlation structure.

2012-07-05 Thread Simon Blomberg
You need to look at the corSymm correlation class for nlme models. Essentially, in your lme call, you need to do correlation=corSymm(mat[lower.tri(mat)], fixed=TRUE) Where mat is your (symmetric) variance-covariance matrix. Remember to make sure that the rows and columns of mat are in the sam

[R] Mixed Models providing a correlation structure.

2012-07-05 Thread Marcio
Hi folks, I was wondering how to run a mixed models approach to analyze a linear regression with a user-defined covariance structure. I have my model y = xa +zb +e and b ~ N (0, C*sigma_square). (and a is a fixed effects) I would like to provide R the C (variance-covariance) matrix I can easi

Re: [R] trouble installing Rmpi on a debian machine

2012-07-05 Thread p_connolly
Quoting Erin Hodgess : Dear R People: I'm having trouble installing Rmpi on a debian machine. Here is my output: bccd@node000:~$ /bccd/home/bccd bccd@node000:~$ bccd@node000:~$ export RMPI_TYPE=OPENMPI bccd@node000:~$ R CMD INSTALL Rmpi_0.5-9.tar.gz * installing to library '/bccd/home/bccd/R/x

Re: [R] remove loop which compares row i to row i-1

2012-07-05 Thread jcrosbie
Thank you, I tired ifelse(tUnitsort[length(tUnitsort$Hour),4]>=tUnitsort[-1,4],(tempMC =tUnitsort[length(tUnitsort$Hour),7]),tempMC ) But this doesn't seem to work. Where am I going wrong? -- View this message in context: http://r.789695.n4.nabble.com/remove-loop-which-compares-row-i-to-r

Re: [R] Plotting the probability curve from a logit model with 10 predictors

2012-07-05 Thread Bert Gunter
You have an about 11-D response surface, not a curve! -- Bert On Thu, Jul 5, 2012 at 2:39 PM, Abraham Mathew wrote: > I have a logit model with about 10 predictors and I am trying to plot the > probability curve for the model. > > Y=1 = 1 / 1+e^-z where z=B0 + B1X1 + ... + BnXi > > If the mod

Re: [R] Silencing the output of install.packages()

2012-07-05 Thread R. Michael Weylandt
On Thu, Jul 5, 2012 at 1:03 PM, craigcitro wrote: >>> Is there a way to suppress the output of 'install.packages()'? I have >>> seen that the 'download.file' function has a 'quiet' option but I do >>> not know how to use it. >> >> I do not see any good reason to allow that. A user should see if >>

[R] Plotting the probability curve from a logit model with 10 predictors

2012-07-05 Thread Abraham Mathew
I have a logit model with about 10 predictors and I am trying to plot the probability curve for the model. Y=1 = 1 / 1+e^-z where z=B0 + B1X1 + ... + BnXi If the model had only one predictor, I know to do something like below. mod1 = glm(factor(won) ~ as.numeric(bid), data=mydat, family=binomi

[R] Fwd: An application for a master's student in statistics

2012-07-05 Thread Arlington Llerena Martinez
Profesor Simon N. Wood As a student from the Masters on statistics at Nacional University I am writing to you to ask for some information due to knowledge on the field I am working on I wonder if you are so kind as to help out with the mathematical and stadistical details as well as information ab

Re: [R] GEE with Inverse Probability Weights

2012-07-05 Thread Thomas Lumley
If you're going to reply to something from two weeks ago, it's helpful to include more of the conversation. However, the mechanism is straightforward. The standard error estimator assumes only that observations in different clusters are independent: it approximates the variance of the estimating

Re: [R] EM algorithm to find MLE of coeff in mixed effects model

2012-07-05 Thread Jie
Seems that I found the problem. The degree of freedom was missing as a denominator... Thank you for your help. Best wishes, Jie On Thu, Jul 5, 2012 at 9:28 AM, John Kane wrote: > I don't believe that R-help permits pdf files. A useful workaround is to > post it to a file hosting site like MediaF

[R] trouble installing Rmpi on a debian machine: please ignore

2012-07-05 Thread Erin Hodgess
It was looking for the mpi.h file. Sorry for the trouble. -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodg...@gmail.com __ R-help@r-project.org mailing list https

[R] trouble installing Rmpi on a debian machine

2012-07-05 Thread Erin Hodgess
Dear R People: I'm having trouble installing Rmpi on a debian machine. Here is my output: bccd@node000:~$ /bccd/home/bccd bccd@node000:~$ bccd@node000:~$ export RMPI_TYPE=OPENMPI bccd@node000:~$ R CMD INSTALL Rmpi_0.5-9.tar.gz * installing to library '/bccd/home/bccd/R/x86_64-pc-linux-gnu-library

Re: [R] vector entry in matix

2012-07-05 Thread Joshua Wiley
Hi Thomas, This is non trivial to do, but if you will be working with this sort of data and are inclined to do some programming, you might consider creating a new class. S4 classes and methods are quite flexible, and you can allow them to lean on or inherit from existing classes such as matrices.

Re: [R] NADA Data Frame Format: Wide or Long?

2012-07-05 Thread Rich Shepard
On Thu, 5 Jul 2012, MacQueen, Don wrote: This example follows exactly the example in ?cenros. with( subset(yourdataframe, param=='Ag'), cenros(quant,ceneq1) ) This should do a simple censored summary statistica calculation for silver (assuming quant contains your reporting level for ce

Re: [R] vector entry in matix

2012-07-05 Thread Christian Brechbühler
To second Bert Gunter: you may get better answers if you give us a complete description. On Thu, Jul 5, 2012 at 12:37 PM, Thomas C. wrote: > i have number of triangles which i'd like to store in a list, > matrix,...etc. > i thought it could look sth. like that: > > trianglenode1

Re: [R] Histogram

2012-07-05 Thread Sarah Goslee
Which gives Jim two ways to arrive at exactly the same result, just different means of specifying the probs for quantile(). Sarah On Thu, Jul 5, 2012 at 4:01 PM, Rui Barradas wrote: > Hello, > > With the confusion between bin size and width the OP started, I'll repost my > answer with a final li

Re: [R] reshape2 errors on data frame [RESOLVED]

2012-07-05 Thread Rich Shepard
On Thu, 5 Jul 2012, Rui Barradas wrote: Just to give it a try, you've written 'idvars' when it's 'id.vars'. Rui, Oops! That was the problem. No matter how often I looked at the syntax I kept missing that. Hope this helps, Most definitely! Thanks for spotting it, Rich __

Re: [R] NADA Data Frame Format: Wide or Long?

2012-07-05 Thread MacQueen, Don
I haven't used NADA functions in quite a while, but from what I recall, you will likely be using the "narrow" format, and sub-setting as needed for the different analytes. As Jean suggested, the examples in the help pages for the NADA function(s) of interest should make it clear. This example fol

[R] How to do non-parametric Anova for comparing two lm models?

2012-07-05 Thread Michael
I am trying to compare two lm models, one including a categorical variable and the other excluding the variable... The residuals of both lm fits are highly non-Gaussian. Could you please give me some pointers? Thank you! [[alternative HTML version deleted]]

Re: [R] Histogram

2012-07-05 Thread Rui Barradas
Hello, With the confusion between bin size and width the OP started, I'll repost my answer with a final line. Sorry for the repetition. h <- hist(x, breaks=quantile(x, probs=seq(0, 1, by=1/20))) h$counts [1] 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 Hope this helps, Rui B

Re: [R] Histogram

2012-07-05 Thread Duncan Murdoch
On 05/07/2012 3:34 PM, Sarah Goslee wrote: Hi Jim, You can't specify both number of bins and bin size. You can specify breaks: either the number of bins or the location of breakpoints. A histogram with 20 bins of 50 observations each must by definition come from a uniform distribution. Only if

Re: [R] Histogram

2012-07-05 Thread Sarah Goslee
There's no reason you can't do that with normally-distributed data, though I'm not sure why you'd want to. My point was rather that you can't specify the bin width and size both. If you let the bin size vary, this will work: set.seed(1234) mydata <- rnorm(1000, mean = 2, sd = 4) mydata.hist <- his

Re: [R] GEE with Inverse Probability Weights

2012-07-05 Thread Joshua Wiley
Hi Frank, It clusters by twin, that is why in Dr. Lumley's example, the "id" was twin pair, not individual, and the SE is adjusted accordingly. Cheers, Josh On Thu, Jul 5, 2012 at 12:10 PM, RFrank wrote: > Thanks -- extremely helpful. But what is the mechanism by which this > analysis correct

Re: [R] Histogram

2012-07-05 Thread Rui Barradas
Hello, Try the following. x <- rnorm(1000, mean=2, sd=2) p <- seq(0, 1, by=1/20) quant <- quantile(x, probs=p) hist(x, breaks=quant) The method is absolutely general, that's why I've separated the several steps, to make it clear. Hope this helps, Rui Barradas Em 05-07-2012 20:29, Jim Silv

Re: [R] Exclude missing values on only 1 variable

2012-07-05 Thread David Winsemius
On Jul 5, 2012, at 1:34 PM, David Winsemius wrote: On Jul 5, 2012, at 1:25 PM, Eiko Fried wrote: Hello, I have many hundred variables in my longitudinal dataset and lots of missings. In order to plot data I need to remove missings. If I do data <- na.omit(data) that will reduce my datase

Re: [R] reshape2 errors on data frame

2012-07-05 Thread Rui Barradas
Hello, Inline Em 05-07-2012 20:21, Nordlund, Dan (DSHS/RDA) escreveu: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Rich Shepard Sent: Thursday, July 05, 2012 11:29 AM To: r-help@r-project.org Subject: Re: [R] reshape2 errors o

Re: [R] Histogram

2012-07-05 Thread Sarah Goslee
Hi Jim, You can't specify both number of bins and bin size. You can specify breaks: either the number of bins or the location of breakpoints. A histogram with 20 bins of 50 observations each must by definition come from a uniform distribution. What are you trying to accomplish? Sarah On Thu, Ju

[R] colored nodes in dendrogram

2012-07-05 Thread Ondřej Mikula
Dear list, is there a way how to add information to internal nodes (branching points) in dendrogram created via plot.agnes function (package cluster)? I wish to place colored circles on the nodes, but I don't know how to proceed... I'll be grateful for any suggestion Ondřej -- Ondřej Mikula Inst

Re: [R] GEE with Inverse Probability Weights

2012-07-05 Thread RFrank
Thanks -- extremely helpful. But what is the mechanism by which this analysis corrects for the fact that my subjects are clustered (twins)? -- View this message in context: http://r.789695.n4.nabble.com/GEE-with-Inverse-Probability-Weights-tp4633172p4635533.html Sent from the R help mailing list

[R] Fw: Exclude missing values on only 1 variable

2012-07-05 Thread arun
HI, Try this: set.seed(1) dat1<-data.frame(var1=c(rep(NA,3),1:3),var2=c(1:4,NA,5),var3=c(1:5,NA),var4=rnorm(6,15),var5=runif(6,0.2),var6=rep(NA,6))  dat1[rowSums(is.na(dat1[,c("var1","var2","var3")]))==0,]  var1 var2 var3 var4  var5 var6 4    1    4    4 16.59528 0.5981594   NA A.K.

Re: [R] Exclude missing values on only 1 variable

2012-07-05 Thread arun
HI, Try this: set.seed(1) dat1<-data.frame(var1=c(rep(NA,3),1:3),var2=c(1:4,NA,5),var3=c(1:5,NA),var4=rnorm(6,15),var5=runif(6,0.2),var6=rep(NA,6))  dat1[rowSums(is.na(dat1[,c("var1","var2","var3")]))==0,]  var1 var2 var3 var4  var5 var6 4    1    4    4 16.59528 0.5981594   NA A.K.

Re: [R] Histogram

2012-07-05 Thread Jim Silverton
I have a column of 1000 datapoints from the normal distribution with mean 2 and variance 4. How can I get a histogram of these observations with 20 bins with each bin having 50 observations? -- Thanks, Jim. [[alternative HTML version deleted]] ___

[R] Conditional Logistic regression with random effects / 2 random effects logit models

2012-07-05 Thread YAddo
Dear All: I am stuck on this problem and I could use some help from folks out there. I want to build a conditional logistic model with random effects or logistic regression with 2 random effects. I have data on mothers and their kids. I want to condition 1 mom predictor(0/1) and also for si

[R] Confused about multiple imputation with rms or Hmisc packages

2012-07-05 Thread Mohiuddin, Jahan
Hello, I'm working on a Cox Proportional Hazards model for a cancer data set that has missing values for the categorical variable "Grade" in less than 10% of the observations. I'm not a statistician, but based on my readings of Frank Harrell's book it seems to be a candidate for using multiple

Re: [R] Silencing the output of install.packages()

2012-07-05 Thread craigcitro
>> Is there a way to suppress the output of 'install.packages()'? I have >> seen that the 'download.file' function has a 'quiet' option but I do >> not know how to use it. > > I do not see any good reason to allow that. A user should see if > software is being installed. Hi Uwe, I have a propose

Re: [R] reshape2 errors on data frame

2012-07-05 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Rich Shepard > Sent: Thursday, July 05, 2012 11:29 AM > To: r-help@r-project.org > Subject: Re: [R] reshape2 errors on data frame > > On Thu, 5 Jul 2012, Rich Shepard wrote: > >

Re: [R] reshape2 errors on data frame

2012-07-05 Thread Rich Shepard
On Thu, 5 Jul 2012, R. Michael Weylandt wrote: What do you mean it won't cooperate? Error message? Michael, I get the command echoed rather than results. Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLE

Re: [R] reshape2 errors on data frame

2012-07-05 Thread Rui Barradas
Hello, Just to give it a try, you've written 'idvars' when it's 'id.vars'. After correction I no longer have the error. But, as expected, the result 'chem.cast' has lots and lots of NAs. chem.cast <- dcast(chem.melt, site + sampdate + preeq0 + ceneq1 + floor + ceiling ~ param) # Fir

Re: [R] reshape2 errors on data frame

2012-07-05 Thread R. Michael Weylandt
On Jul 5, 2012, at 1:28 PM, Rich Shepard wrote: > On Thu, 5 Jul 2012, Rich Shepard wrote: > >> I wonder if the issue is with the logical columns; I've not used them >> before, only dates, factors, and numerals. I'll try without the logicals >> and see if there's a difference. > > Nope. Same

Re: [R] reshape2 errors on data frame

2012-07-05 Thread Rich Shepard
On Thu, 5 Jul 2012, Rich Shepard wrote: I wonder if the issue is with the logical columns; I've not used them before, only dates, factors, and numerals. I'll try without the logicals and see if there's a difference. Nope. Same problem as before. Someone, please provide a process I can ap

Re: [R] reshape2 errors on data frame

2012-07-05 Thread Rich Shepard
On Thu, 5 Jul 2012, Nordlund, Dan (DSHS/RDA) wrote: The melt syntax you provided in a previous email runs without error on the data that you just supplied. So, your comment that "dput() doesn't want to cooperate" suggests that maybe there is a problem with your waterchem data frame. Maybe some

Re: [R] Exclude missing values on only 1 variable

2012-07-05 Thread Bert Gunter
Be careful!! The plots could be potentially misleading. The problem is the nature of the missingness. The approach you are taking is based on assuming MCAR missingness (look it up, if necessary). If that is not the case -- e.g. if there is censoring, MAR, or informative missingness -- the plots may

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

2012-07-05 Thread MacQueen, Don
Perhaps I've missed something, but if it's really true that the goal is to remove rows if the first non-zero element is "D" or "d", then how about this: tmp <- gsub('0','',df$ch) first <- substr(tmp,1,1) subset(df, tolower(first) != 'd') and of course it could be rolled up into a single expressio

Re: [R] reshape2 errors on data frame

2012-07-05 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Rich Shepard > Sent: Thursday, July 05, 2012 10:36 AM > To: r-help@r-project.org > Subject: Re: [R] reshape2 errors on data frame > > On Thu, 5 Jul 2012, John Kane wrote: > > >

Re: [R] a problem about WLS

2012-07-05 Thread jacquesliu
thanks a lot, it works On Thu, Jul 5, 2012 at 11:40 AM, Thomas Lumley-2 [via R] < ml-node+s789695n4635453...@n4.nabble.com> wrote: > On Thu, Jul 5, 2012 at 11:40 AM, jacquesliu <[hidden > email]> > wrote: > > > I was asked to do a WLS estimat

Re: [R] reshape2 errors on data frame

2012-07-05 Thread Rich Shepard
On Thu, 5 Jul 2012, John Kane wrote: It would be very helpful to have some sample data to play with. John, dput() doesn't want to cooperate so here are 100 rows from the raw data file that can be input with read.table("sample.dat", header = T, sep = "|"): 'site'|'sampdate'|'preeq0'|'param'

Re: [R] Exclude missing values on only 1 variable

2012-07-05 Thread David Winsemius
On Jul 5, 2012, at 1:25 PM, Eiko Fried wrote: Hello, I have many hundred variables in my longitudinal dataset and lots of missings. In order to plot data I need to remove missings. If I do data <- na.omit(data) that will reduce my dataset to 2% of its original size ;) So I only need to lis

Re: [R] vector entry in matix

2012-07-05 Thread Bert Gunter
You have failed to provide a complete, coherent description of what you wish to do. In the absence of such a description, all suggestions are just guesses. You need to think carefully about what information you want to associate with each triangle and the appropriate data structure to use to do thi

Re: [R] empty cell when running GEE for binary data

2012-07-05 Thread Yue
hi Ozgur, Thanks for your reply! by "empty cell" I mean there was a condition in which all participants showed the same response (let's say response A). In other words, the probability of A, according to the present data, was 100%; this led to the empty cell for non-A. The odds or p(A) would be 1/

Re: [R] NADA Data Frame Format: Wide or Long?

2012-07-05 Thread Jean V Adams
Rich, I am not familiar with the NADA package, but the reference manual ( http://cran.r-project.org/web/packages/NADA/NADA.pdf) has many examples using several data sets included in the package. Look up one of the functions that you plan to use, run the example in R, and look at the data that

[R] Exclude missing values on only 1 variable

2012-07-05 Thread Eiko Fried
Hello, I have many hundred variables in my longitudinal dataset and lots of missings. In order to plot data I need to remove missings. If I do > data <- na.omit(data) that will reduce my dataset to 2% of its original size ;) So I only need to listwise delete missings on 3 variables (the ones I a

Re: [R] i need help in documentation

2012-07-05 Thread Bert Gunter
See also the inlinedocs package, which might be closer to what you're looking for. -- Bert On Thu, Jul 5, 2012 at 8:17 AM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > R does not, to my knowledge, have anything quite like Python's > docstrings (which seems to be what you are talkin

Re: [R] vector entry in matix

2012-07-05 Thread arun
Hi, I think it is better to store vectors in to list when the vectors are of different lengths. #Consider these cases, #vectors of equal length set.seed(1)  list1<-list(a=rnorm(5,15),b=rnorm(5,25),c=1:5,d=runif(5,0.4),e=16:20,f=rep(1,5)) mat1<-cbind(rbind(list1[[1]],list1[[2]],list1[[3]]),(rbin

Re: [R] vector entry in matix

2012-07-05 Thread Thomas C.
well thank you, i think we get closer to my problem. but i meant it in a different way. maybe i describe what i intended to do: i have number of triangles which i'd like to store in a list, matrix,...etc. i thought it could look sth. like that: trianglenode1node2no

Re: [R] vector entry in matix

2012-07-05 Thread David Winsemius
On Jul 5, 2012, at 11:22 AM, R. Michael Weylandt wrote: It is possible to put dimensionality on a list (i.e., a generic vector), which might be what you're looking for. x <- list(1:4, letters[1:4], function(x,y) x + y, rnorm(50)) dim(x) <- c(2,2) x[[1,2]] x[[2,2]] x[[3,2]] # Error That co

Re: [R] reshape2 errors on data frame

2012-07-05 Thread John Kane
It would be very helpful to have some sample data to play with. str() shows the structure of the data set but it is not the data. Something like dput(head(100)) would probably be enough. John Kane Kingston ON Canada > -Original Message- > From: rshep...@appl-ecosys.com > Sent: Thu,

Re: [R] RODBC tables

2012-07-05 Thread Marc Schwartz
On Jul 4, 2012, at 10:10 AM, Lorcan Treanor wrote: > Dear Sir/Madam, > > I am desperately in need of some help. I am trying to access tables from > the oracle database and inserting them into R via a data frame and I keep > getting an error saying that "Error in .Call(C_RODBCFetchRows, > attr(ch

Re: [R] Import single variables from SPSS

2012-07-05 Thread Eik Vettorazzi
Hi Marion, package "memisc" does what you want, just have a look at ?importers. Hth Eik Am 05.07.2012 15:05, schrieb Marion Wenty: > Dear all, > I have got a very big SPSS dataframe and I would like to just import one or > a few variables (the dataframe has got a lot of colums). > I used the pack

[R] Fast trace of inverse

2012-07-05 Thread Doran, Harold
Suppose I have a square matrix A like the toy below set.seed(1234) (A <- matrix(rnorm(9), nrow = 3)) I want to trace of the inverse of A. I could do > sum(diag(solve(A))) [1] 1.259641 Or I could also do > sum(1/eigen(A)$values) [1] 1.259641+0i Now, my actual problem involves a very large, squ

Re: [R] empty cell when running GEE for binary data

2012-07-05 Thread Özgür Asar
Dear Yu, What do you mean exactly by "exmpty cell" ? But you can try, the following packages which might help you: gee and yags. But I am not sure. Best Ozgur -- View this message in context: http://r.789695.n4.nabble.com/empty-cell-when-running-GEE-for-binary-data-tp4635483p4635504.html Sent

[R] reshape2 errors on data frame

2012-07-05 Thread Rich Shepard
I've successfully reformatted data frames from long to wide with reshape2, but this time I'm getting errors that I want to understand and resolve. Here's the data frame structure and the results of the melt() and dcast() functions: str(waterchem) 'data.frame': 128412 obs. of 8 variables: $

Re: [R] 7 days confusion over lists

2012-07-05 Thread Jeff Newmiller
I think you need to (re)read the posting guide and "An Introduction to R" and try posting again. Some food for thought: a) You refer to "list files", but this is not a standard term. As the PG says, you need to supply a self-contained example, which would either include internal objects in dput

Re: [R] skipped correlation

2012-07-05 Thread R. Michael Weylandt
library(sos) findFun("scor") will get you going in the right direction but I'm not sure I see a "scor" function (I presume you're looking for the robust correlation metric). Do you have a citation for such a function? For a work around, robust::covRob gives robust covariance which possibly could b

Re: [R] 7 days confusion over lists

2012-07-05 Thread R. Michael Weylandt
Could you make a reproducible example? [http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example] I can't run any of your code as is. A few comments inline. On Thu, Jul 5, 2012 at 9:44 AM, Wageningen-eR wrote: > Hello, > > I am a Masters student and I am working on my

Re: [R] vector entry in matix

2012-07-05 Thread R. Michael Weylandt
It is possible to put dimensionality on a list (i.e., a generic vector), which might be what you're looking for. x <- list(1:4, letters[1:4], function(x,y) x + y, rnorm(50)) dim(x) <- c(2,2) x[[1,2]] x[[2,2]] x[[3,2]] # Error Best, Michael On Thu, Jul 5, 2012 at 8:19 AM, Thomas C. wrote: > h

Re: [R] i need help in documentation

2012-07-05 Thread R. Michael Weylandt
R does not, to my knowledge, have anything quite like Python's docstrings (which seems to be what you are talking about) but you might look at Roxygen2 on CRAN which should get you started in this direction. Best, Michael On Thu, Jul 5, 2012 at 7:37 AM, purushothaman wrote: > Hi, > > i am new in

Re: [R] Adjusting MaxNwts in MICE Package

2012-07-05 Thread jtizzle36
Hi Rachel, I am having the same problem! My data set is positing around 4400 weights required. Have you found a solution to this? Does anyone else know how to adjust this default to run MICE successfully? Thanks, Justin -- View this message in context: http://r.789695.n4.nabble.com/Adjusting-M

[R] Different level set when predicting with e1071's Naive Bayes classifier

2012-07-05 Thread Joao Azevedo
Hi! I'm using the Naive Bayes classifier provided by the e1071 package ( http://cran.r-project.org/web/packages/e1071) and I've noticed that the predict function has a different behavior when the level set of the columns used for prediction is different from the ones used for fitting. From inspect

Re: [R] function curve() swap axes

2012-07-05 Thread David Winsemius
On Jul 5, 2012, at 8:34 AM, Boudewijn Verkooijen wrote: Dear all, I'm using the curve() function to plot discharge Q against water depth a. However, I would like to have a graph of water depth a plotted against discharge Q. How can this be done? Minimal working example: S0 = 0.004 n = 0.04

Re: [R] Invalid input in 'utf8towcs' when saving script file

2012-07-05 Thread Duncan Murdoch
On 05/07/2012 10:21 AM, Marine Andersson wrote: Hello, When I try to save my script file before closing the R console session I get this error. Error: invalid input 'C:\Documents and Settings\\\datafile' in 'utf8towcs' Does anyone know what can cause this error? I imagine it is con

Re: [R] Hosmer-Lemeshow test for Cox model

2012-07-05 Thread Frank Harrell
Any method that requires binning is problematic. Instead, take a look at the calibrate function in the rms package. There is a new option for continuous calibration curves for survival models. Frank jane.wong wrote > > Dear list, > > Usually we use Hosmer-Lemeshow test to test the goodness of

[R] 7 days confusion over lists

2012-07-05 Thread Wageningen-eR
Hello, I am a Masters student and I am working on my thesis modelling smallholder farms using a program in R. I have modified the original code and I am having some issues with lists that I cannot figure out. Originally, I had list file defining lists such as: Param, Crop1, Crop1, Soil, etc. (e

Re: [R] Maximum Likelihood Estimation Poisson distribution mle {stats4}

2012-07-05 Thread chamilka
Thank you very much Professor .Peter Dalgaard for your kind explanations.. This made my work easy.. I am struggling with this for more than 2 days and now I got the correct reply. Thank again. -- View this message in context: http://r.789695.n4.nabble.com/Maximum-Likelihood-Estimation-Poisson-d

[R] empty cell when running GEE for binary data

2012-07-05 Thread Yue
Hi all, My data are binary and within-subject correlated; there are three factors of interest and two of them are within-subject. So, I have considered modelling the data using a binomial regression with a GEE approach (which can be achieved using the function geeglm). One problem is that I got so

Re: [R] function curve() swap axes

2012-07-05 Thread Duncan Murdoch
On 05/07/2012 8:34 AM, Boudewijn Verkooijen wrote: Dear all, I'm using the curve() function to plot discharge Q against water depth a. However, I would like to have a graph of water depth a plotted against discharge Q. How can this be done? curve() is designed for plotting y vs x where y is a fu

[R] Invalid input in 'utf8towcs' when saving script file

2012-07-05 Thread Marine Andersson
Hello, When I try to save my script file before closing the R console session I get this error. Error: invalid input 'C:\Documents and Settings\\\datafile' in 'utf8towcs' Does anyone know what can cause this error? I use the RGui (R verison 2.14.0) in Windows and the problem appear

[R] skipped correlation

2012-07-05 Thread qinjiaolong
hello,Everyone! I am a freshman to use R. Can anybody tell me where has scor function which achieves the skipped correlation? Thank you very much! Bset wishes! Jiaolong Qin [[alternative HTML version deleted]] __ R-help@r-project.org mailing li

[R] vector entry in matix

2012-07-05 Thread Thomas C.
hi, i'm trying to figure out if there's any possibility to write a whole vector into a matrix or data.frame or something like that. i don't mean transormation. Here an example: [,1] [,2] [1,] "a" "d" [2,] "b" "e" [3,] "c" "f" where e.g. a is a<-c(0,1) vector of length 2, b a vector of

[R] i need help in documentation

2012-07-05 Thread purushothaman
Hi, i am new in R development , so i need help in documentation from comments in R file for example sample<-function(filepath) { ##title<< read csv file ##author<< Purushoth ##description this function is used to read a csv file output<-read.csv(filepath) return(

Re: [R] how to check convergence of arima model

2012-07-05 Thread Sajeeka Nanayakkara
Thanks for your advice.   Sajeeka From: Bert Gunter Cc: Rui Barradas ; "r-help@r-project.org" Sent: Thursday, July 5, 2012 12:43 AM Subject: Re: [R] how to check convergence of arima model 1. This is a statistical question. Please do not post further to

Re: [R] Maximum Likelihood Estimation Poisson distribution mle {stats4}

2012-07-05 Thread chamilka
Thank you S Ellison-2 for your reply. I will understand it with Prof.Peter Dalgaard's answer.. -- View this message in context: http://r.789695.n4.nabble.com/Maximum-Likelihood-Estimation-Poisson-distribution-mle-stats4-tp4635464p4635484.html Sent from the R help mailing list archive at Nabble.c

[R] function curve() swap axes

2012-07-05 Thread Boudewijn Verkooijen
Dear all, I'm using the curve() function to plot discharge Q against water depth a. However, I would like to have a graph of water depth a plotted against discharge Q. How can this be done? Minimal working example: S0 = 0.004 n = 0.04 tanalpha = 1.4/1.5 par(mar = c(5,5,1,1)) # b, l, t, r curve((sq

[R] Hosmer-Lemeshow test for Cox model

2012-07-05 Thread jane.wong
Dear list, Usually we use Hosmer-Lemeshow test to test the goodness of fit for logistic model, but if I use it to test for Cox model, how can I get the observed probability for each group? Suppose I calculated the 5-year predicted probability using Cox model, then I split the dataset into 10 group

Re: [R] Create a function "automatically" from lm formula and coefficients?

2012-07-05 Thread taheri
Hi, I need to create a function from lm formula and coefficients to use it in my c++ code later. but when I do it as you said "require(rms) f <- ols( ) g <- Function(f) g(x1=2,x2=3,...) I realize that it didn't give me the same result as predict.lm? how can I reach a function to give me the sa

Re: [R] Return on Stock Market

2012-07-05 Thread R. Michael Weylandt
if(!require("TTR")){install.packages("TTR"); library(TTR)} ? ROC Michael On Wed, Jul 4, 2012 at 11:20 PM, Akhil dua wrote: > Hello Every one > I have data on Stock prices and I want to calculate the return on all the > stocks > and then replace all the stock prices with the returns > > can any o

Re: [R] EM algorithm to find MLE of coeff in mixed effects model

2012-07-05 Thread John Kane
I don't believe that R-help permits pdf files. A useful workaround is to post it to a file hosting site like MediaFire and post the link here. John Kane Kingston ON Canada > -Original Message- > From: jimmycl...@gmail.com > Sent: Wed, 4 Jul 2012 22:56:02 -0400 > To: pauljoh...@gmail.com

Re: [R] how to analyse non parametric test

2012-07-05 Thread John Kane
Please read the posting guidelines. So far we have no idea of what you are doing or how you are doing it. John Kane Kingston ON Canada > -Original Message- > From: anilgv...@gmail.com > Sent: Thu, 5 Jul 2012 15:11:20 +0530 > To: r-help@r-project.org > Subject: [R] how to analyse non pa

[R] Import single variables from SPSS

2012-07-05 Thread Marion Wenty
Dear all, I have got a very big SPSS dataframe and I would like to just import one or a few variables (the dataframe has got a lot of colums). I used the package foreign but I couldn't find anything in there for my problem. Thank you very much for your help in advance. Marion [[alternative

[R] 2D image correlation/Packages for 2D CCA?

2012-07-05 Thread Grace, Miriam
Hello, I was just wondering if anyone could recommend a package for R that calculates 2D image correlation, e.g. by 2D canonical correspondence analysis? Thanks a lot! MG [[alternative HTML version deleted]] __ R-help@r-project.org mailing l

Re: [R] Comparing crossing survival curves

2012-07-05 Thread Vito Muggeo (UniPa)
hi isabel, You have to decide if focus is on the survival curves or hazards.. Crossing hazards do not imply crossing survival curves If you are dealing with crossing hazards, and you are interested in testing for an effect of a covariate (presumably with a crossing hazard effect), then a stan

Re: [R] Maximum Likelihood Estimation Poisson distribution mle {stats4}

2012-07-05 Thread peter dalgaard
On Jul 5, 2012, at 10:48 , chamilka wrote: > Hi everyone! > I am using the mle {stats4} to estimate the parameters of distributions by > MLE method. I have a problem with the examples they provided with the > mle{stats4} html files. Please check the example and my question below! > *Here is the m

  1   2   >