Re: [R] Return

2012-07-05 Thread Patrick Burns
It depends on which return you want. See the R computation section of A tale of two returns. http://www.portfolioprobe.com/2010/10/04/a-tale-of-two-returns/ Pat On 05/07/2012 05:58, Akhil dua wrote: Hello Every one I have data on Stock prices and I want to calculate the return on all the

Re: [R] Help! Please recommend good books/resources on visualizing data and understanding multivariate relations...

2012-07-05 Thread Oxenstierna
I'm a fan of Ggobi--which works well with or without R--but I'm not sure how it handles enormous data sets. I second the Tufte recommendation, and add: Interactive and Dynamic Graphics for Data Analysis. -- View this message in context:

[R] Return on Stock Market

2012-07-05 Thread Akhil dua
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 one tell me how to do My data is in the format given below Date Stock1 Stock2 Stock3 01/01/20001 2

Re: [R] Binary Quadratic Opt?

2012-07-05 Thread khris
Thanks Petr for the reply. Let me do implementation and see how how goes. Enjoy your vacation. Rest fine Khris On Jul 4, 2012, at 8:25 PM, Petr Savicky [via R] wrote: On Mon, Jul 02, 2012 at 06:11:37AM -0700, khris wrote: Hi, Petr, Hi Khris: If i understand the problem

Re: [R] evaluating expressions contained in a dataframe

2012-07-05 Thread arun
Hello, Your eval(tests$rule[1]) needs a slight modification to get the results. Try this: tests-read.table(text=  rule  info$country=='Greenland'  info$age50  ,sep=,header=TRUE,stringsAsFactors=FALSE) info-data.frame(first=rep(NA,5),country=c(GReenland,Iceland,Ireland,Greenland,Greenland)

[R] Adding Text to a persp plot using specific coordinates

2012-07-05 Thread Benjamin Dubreuil
Hi folks, I'm experiencing some hassle to add some text on a persp plot... Here is the code to generate the persp plot: x - seq(-1.95, 1.95, length = 30) y - seq(-1.95, 1.95, length = 30) z - outer(x, y, function(a,b) a*b^2) persp(x, y, z,xlim=c(-2,2),ylim=c(-2,2),zlim=c(-8,8), phi=30,

Re: [R] Return

2012-07-05 Thread arun
Hi, I guess this is what you are looking for:  dat1 - read.table(text=  Date  Stock1  Stock2  Stock3    Market  01/01/2000    1  2  3    4  01/02/2000    5  6  7    8  01/03/2000    1  2  3    4  

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

2012-07-05 Thread chamilka
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 mle html help file *

Re: [R] Adding Text to a persp plot using specific coordinates

2012-07-05 Thread Uwe Ligges
On 05.07.2012 06:45, Benjamin Dubreuil wrote: Hi folks, I'm experiencing some hassle to add some text on a persp plot... Here is the code to generate the persp plot: x - seq(-1.95, 1.95, length = 30) y - seq(-1.95, 1.95, length = 30) z - outer(x, y, function(a,b) a*b^2) persp(x, y,

[R] how to analyse non parametric test

2012-07-05 Thread Anil Kumar
Please i am Anilkumar G.V studieng MBA final sem for this data i want to find out non parametric tests please help me -- Anilkumar G.V Jr,MBA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

[R] stlf algorithm failure

2012-07-05 Thread Christian Scherer
Dear R-helpers, currently I am writing a thesis using R in forecasting scenarios. No the time is shortening and I wanted to set up all test cases, including the STLF algorithm of the forecast package. I am using 15 minutes (96 a day) data of two weeks to forecast one week... The

Re: [R] MS-DOS script R

2012-07-05 Thread FJ M
I have the following in a batch file TLT.BAT: C:\Program Files\R\R-2.13.2\bin\x64\R.exe CMD BATCH C:\Users\Frank\Documents\R\Scripts\TLT_2012.txt C:\Users\Frank\Documents\R\Scripts\TLT_2012.out PAUSE The TLT_2012.txt has my R code in it. The TLT_2012.out has the output from R. Look to

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

2012-07-05 Thread S Ellison
-Original Message- sample.mean- sum(x*y)/sum(y) sample.mean [1] 3.5433 *This is the contradiction!! * Here I am getting the estimate as 3.5433(which is reasonable as most of the values are clustered around 3), but mle code gives the estimate 11.545(which may not be correct as

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 mle

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

[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

[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

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

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] 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 akhil.dua...@gmail.com 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

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 same

[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

[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

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

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

2012-07-05 Thread Sajeeka Nanayakkara
Thanks for your advice.   Sajeeka From: Bert Gunter gunter.ber...@gene.com Cc: Rui Barradas ruipbarra...@sapo.pt; r-help@r-project.org r-help@r-project.org Sent: Thursday, July 5, 2012 12:43 AM Subject: Re: [R] how to check convergence of arima model 1.

[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)

[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 length 4,...

[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

[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

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

[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

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:

[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.

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

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

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

[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

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:

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 purushothama...@ge.com

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.

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 igor.milosavlje...@wur.nl wrote: Hello, I am a Masters student

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 be

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

[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] 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] 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,

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 package

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(channel,

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, 5

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

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: trianglenode1node2

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))

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 talking

[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 am

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

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

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

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

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 = |):

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]http://user/SendEmail.jtp?type=nodenode=4635453i=0 wrote: I was asked to do a WLS estimation, so I

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: It would

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 expression,

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

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

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

Re: [R] reshape2 errors on data frame

2012-07-05 Thread R. Michael Weylandt michael.weyla...@gmail.com
On Jul 5, 2012, at 1:28 PM, Rich Shepard rshep...@appl-ecosys.com 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.

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) #

Re: [R] reshape2 errors on data frame

2012-07-05 Thread Rich Shepard
On Thu, 5 Jul 2012, R. Michael Weylandt michael.weyla...@gmail.com 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

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: I

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 proposed

[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

[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

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]]

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. -

[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] 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

[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

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,

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

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

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

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 spark...@gmail.com wrote: Thanks -- extremely helpful. But what is the mechanism by which this

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 -

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

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

[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] 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

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] 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 ruipbarra...@sapo.pt wrote: Hello, With the confusion between bin size and width the OP started, I'll repost my

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. thomas.csa...@gmail.com 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: triangle

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

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

[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

[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

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 jrkrid...@inbox.com wrote: I don't believe that R-help permits pdf files. A useful workaround is to post it to a file

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

[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

[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,

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 craigci...@gmail.com 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

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 abmathe...@gmail.com 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 + ... +

  1   2   >