Re: [R] Array element is function of its position in the array

2011-12-30 Thread Asher Meir
Yes this is the solution to my problem. I think there is a small typo in old.index, instead of: k=rep(1:nks, rep(njs*nks, nks))) it should be: k=rep(1:nks, rep(nis*njs, nks))) That is, the k index should be replicated by nis*njs,, not nks*njs. Many thanks Asher On Fri, Dec

[R] Break Points

2011-12-30 Thread Ayanendu Sanyal
Respected Sir I tried the strucchange My data is attached. However I tried the attached commands (last save.txt) to perform Bai Perron 2003... I t worked well but in the end it is giving warning that overlapping confidence interval... I am not sure how to proceed... Please Help Me Thanking You

[R] epi.conf

2011-12-30 Thread LianD
Hi all! I was wondering if anyone could help me. I'd like to calculate prevalence and confidence interval for a clustered sample (design effect estimated at 2). In the old version of epiR the epi.conf function allowed for the design effect argument, but in the new version this doesn't seem

[R] Joint modelling of survival data

2011-12-30 Thread ryusuke
Assume that we collect below data : - subjects = 20 males + 20 females, every single individual is independence, and difference events = 1, 2, 3... n covariates = 4 blood types A, B, AB, O http://r.789695.n4.nabble.com/file/n4245397/CodeCogsEqn.jpeg λm = hazards rates for male λn = hazards

[R] [R-pkgs] Plyr 1.7

2011-12-30 Thread Hadley Wickham
# plyr plyr is a set of tools for a common set of problems: you need to __split__ up a big data structure into homogeneous pieces, __apply__ a function to each piece and then __combine__ all the results back together. For example, you might want to: * fit the same model each patient subsets of

[R] [R-pkgs] testthat 0.6

2011-12-30 Thread Hadley Wickham
# testthat Testing your code is normally painful and boring. `testthat` tries to make testing as fun as possible, so that you get a visceral satisfaction from writing tests. Testing should be fun, not a drag, so you do it all the time. To make that happen, `testthat`: * Provides functions that

[R] Lattice: Setting Conditioning Panel Order in Trellis Plots

2011-12-30 Thread Rich Shepard
I've looked in Deepayan Sarkar's book without finding how to specify the order of conditioning panels in a trellis plot. Here's the issue I'm trying to resolve: Sampling locations along a stream channel are not sequentially numbered. For example, the panel order for one plot (lower left to

Re: [R] Lattice: Setting Conditioning Panel Order in Trellis Plots

2011-12-30 Thread Duncan Murdoch
On 11-12-30 9:56 AM, Rich Shepard wrote: I've looked in Deepayan Sarkar's book without finding how to specify the order of conditioning panels in a trellis plot. Here's the issue I'm trying to resolve: Sampling locations along a stream channel are not sequentially numbered. For example,

Re: [R] rbinom

2011-12-30 Thread Scott Raynaud
This makes sense.  Guess I should have put a pencil to it. Further investigation revealed that it is indeed a possibility  that the relation between x and y is nonlinear: ax+bx^2+c where a, b and c are to be determined.  My question is how to code this in my simulated data.  I could do

Re: [R] Help with PCA

2011-12-30 Thread William Revelle
Sarah and elisacarli21 principal in the psych package will do principal components of a correlation or covariance matrix. ex: library(psych) principal(Thurstone,3,rotate=none) #First three principal components of the Thurstone correlation matrix #compare with eigen e - eigen(Thurstone)

Re: [R] Lattice: Setting Conditioning Panel Order in Trellis Plots

2011-12-30 Thread Rich Shepard
On Fri, 30 Dec 2011, Duncan Murdoch wrote: You don't describe the variable holding those labels. If it is a factor with the levels in the desired order then it should display properly. Duncan, Apologies; I did not know what supporting information to provide. It's a factor in the data

[R] Poisson GLM using non-integer response/predictors?

2011-12-30 Thread Lucy Dablin
Great lists, I always find them useful, thank you to everyone who contributes to them. My question is regarding non-integer values from some data I collected on parrots when using the poisson GLM. I observed the parrots on a daily basis to see if they were affected by tourist presence. My key

[R] vertically stacked area plot?

2011-12-30 Thread elpape
Dear all, I would like to create a vertically stacked area chart in R. The data are presented in the attached text file. I would like to see the trend in values for the different groups with sediment depth (that's why I would like to create a vertically stacked chart; normally sed_depth should

Re: [R] Applyiing mode() or class() to each column of a data.frame XXXX

2011-12-30 Thread Justin Haynes
there is also colwise in the plyr package. library(plyr) colwise(class)(data6) v13 v14 v15 f4 v16 1 integer numeric character factor logical Justin On Thu, Dec 29, 2011 at 4:47 PM, Jean V Adams jvad...@usgs.gov wrote: Dan Abner wrote on 12/29/2011 06:13:11 PM:

Re: [R] configure can't find readline -- but it's there!

2011-12-30 Thread Cable, Sam B Civ USAF AFMC AFRL/RVBXI
Thanks, Marc. That did it. I thought yum provides would have been smart enough to tell me about any devel package, but I guess I have something left to learn there. Thanks. --Sam -Original Message- From: Marc Schwartz [mailto:marc_schwa...@me.com] Sent: Thursday, December 29, 2011

[R] good method of removing outliers?

2011-12-30 Thread Michael
Happy holidays all! I know it's very subjective to determine whether some data is outlier or not... But are there reasonally good and realistic methods of identifying outliers in R? Thanks a lot! [[alternative HTML version deleted]] __

Re: [R] good method of removing outliers?

2011-12-30 Thread Joshua Wiley
Hi Michael, I'm afraid this is one of those cases where the short answer is No and the long answer is, No. If you are working with a data set stored in a data frame, something like: sapply(mtcars, function(x) if (is.numeric(x)) range(x, na.rm = TRUE) else c(NA, NA)) should give you the range

Re: [R] configure can't find readline -- but it's there!

2011-12-30 Thread Marc Schwartz
Hi Sam, It has been almost 3 years since I last used Linux (Fedora), but if memory serves using, as root, either: yum provides readline.h or perhaps yum search readline might be possible ways of getting the names of the relevant RPMs in the repos. You might have to tweak the 'readline'

Re: [R] good method of removing outliers?

2011-12-30 Thread Peter Langfelder
On Fri, Dec 30, 2011 at 9:03 AM, Michael comtech@gmail.com wrote: Happy holidays all! I know it's very subjective to determine whether some data is outlier or not... But are there reasonally good and realistic methods of identifying outliers in R? What kind of data do you have? For

Re: [R] Applyiing mode() or class() to each column of a data.frame XXXX

2011-12-30 Thread Hadley Wickham
But be careful because class is a character vector (not necessarily a character vector of length 1) On Fri, Dec 30, 2011 at 10:21 AM, Justin Haynes jto...@gmail.com wrote: there is also colwise in the plyr package. library(plyr) colwise(class)(data6)      v13     v14       v15     f4     v16

[R] Fwd: Re: Poisson GLM using non-integer response/predictors?

2011-12-30 Thread Matthias Gondan
Hi, Use offset variables if count occurrences of an event and you want to model the observation time. glm(count ~ predictors + offset(log(observation_time)), family=poisson) If you want to compare durations, look at library(survival), ?coxph If tnoise_sqrt is the square root of tourist noise,

Re: [R] Loops and vector operations

2011-12-30 Thread Mago84
Thanks a lot, it was very helpful, I did something like that: EV - ifelse(sprd mediaSDP sprd_d = mediaSDP_d, -1, 0) SV - ifelse(sprd media sprd_d = media_d, -17, 0) EC - ifelse(sprd mediaSDN sprd_d = mediaSDN_d,1,0) SC - ifelse(sprd media sprd_d = media_d,17,0) in order to have 4

[R] Merging vectors

2011-12-30 Thread Mago84
Dear R addicts, I´m trying to merge two vectors like these and I don´t want to use loops. EV [1] 9 16 19 21 67 71 82 87 110 112 141 156 201 211 248 264 272 298 331 [20] 341 347 361 373 468 490 493 504 508 806 830 833 883 885 897 953 955 SV [1] 3 21 28 33 229 379 396 532 535 541

Re: [R] Is it possible to right align text in R graphics?

2011-12-30 Thread Tal Galili
Hi Bert, Thank you for the idea - but this will only move the text to different sides of the text... Right-to-left languages are a known issue in open source projects (libreoffice, WordPress, etc...) Any advice on who should I contact regarding this? (Not that it is urgent for me, but long term

[R] Sweave options

2011-12-30 Thread Terry Therneau
Is there a concise list somewhere of the Sweave options for a code chunk? By that I mean chunk-name, options.. where the options are fig=T/F, echo=T/F, etc. I keep forgetting parts of the etc. Terry T. __ R-help@r-project.org mailing list

Re: [R] Sweave options

2011-12-30 Thread Marc Schwartz
On Dec 30, 2011, at 12:23 PM, Terry Therneau wrote: Is there a concise list somewhere of the Sweave options for a code chunk? By that I mean chunk-name, options.. where the options are fig=T/F, echo=T/F, etc. I keep forgetting parts of the etc. Terry T. Terry, See ?RweaveLatex which

Re: [R] Merging vectors

2011-12-30 Thread William Dunlap
Does the following do what you want? You didn't describe the rule and the example output was truncated: EV - c( 9,16,19,21,67,71,82,87,110,112,141,156,201,211,248,264,272,298,331, 341,347,361,373,468,490,493,504,508,806,830,833,883,885,897,953,955) SV - c(

Re: [R] [R-SIG-Finance] Removing outliers in tick data in R?

2011-12-30 Thread Hasan Diwan
On 30 December 2011 10:21, Michael comtech@gmail.com wrote: But are there reasonably good and realistic methods of identifying outliers/errornous quotes  in tick data in R? Check out the OutlierD package at http://www.bioconductor.org/packages/release/bioc/html/OutlierD.html. -- Sent from

Re: [R] Sweave options

2011-12-30 Thread Duncan Murdoch
On 30/12/2011 1:29 PM, Marc Schwartz wrote: On Dec 30, 2011, at 12:23 PM, Terry Therneau wrote: Is there a concise list somewhere of the Sweave options for a code chunk? By that I mean chunk-name, options.. where the options are fig=T/F, echo=T/F, etc. I keep forgetting parts of the etc.

Re: [R] Fwd: Re: Poisson GLM using non-integer response/predictors?

2011-12-30 Thread Ben Bolker
Matthias Gondan matthias-gondan at gmx.de writes: Hi, Use offset variables if count occurrences of an event and you want to model the observation time. glm(count ~ predictors + offset(log(observation_time)), family=poisson) If you want to compare durations, look at

Re: [R] Fwd: Re: Poisson GLM using non-integer response/predictors?

2011-12-30 Thread Matthias Gondan
Hi Ben, Thanks for clarifying this, I used a misleading word, model the observation time sounds as if observation time were the dependent variable - which it is not, of course, instead, in the scenario described, the parrot counts are modeled. Best wishes, Matthias Am 30.12.2011 20:50,

[R] New version of coxme / lmekin

2011-12-30 Thread Terry Therneau
Version 2.2 of coxme has been posted to CRAN, Windows versions and mirrors should appear in due course. This is a major update with three features of note: 1. A non-upwardly compatable change: Extractor functions: beta= fixed effects, b=random effects nlmelme4 coxme 2.2

[R] Feature selection for text using R - Please help

2011-12-30 Thread andy1234
Hi all, I am new to R, and am trying to do feature selection on my text data that has about 30k observations and about 15k features. I am interested in using Chi-Sqaured and Mutual Information based feature selection. I tried using FSelector package but found it too slow for my purposes. Are

Re: [R] vertically stacked area plot?

2011-12-30 Thread Jean V Adams
elpape wrote on 12/30/2011 09:04:53 AM: Dear all, I would like to create a vertically stacked area chart in R. The data are presented in the attached text file. I would like to see the trend in values for the different groups with sediment depth (that's why I would like to create a

Re: [R] Break Points

2011-12-30 Thread Achim Zeileis
On Fri, 30 Dec 2011, Ayanendu Sanyal wrote: Respected Sir I tried the strucchange My data is attached. However I tried the attached commands (last save.txt) to perform Bai Perron 2003... I t worked well but in the end it is giving warning that overlapping confidence interval... I am not sure

Re: [R] Array element is function of its position in the array

2011-12-30 Thread Jean V Adams
Asher Meir asher.m...@gmail.com wrote on 12/30/2011 03:45:48 AM: Yes this is the solution to my problem. I think there is a small typo in old.index, instead of: k=rep(1:nks, rep(njs*nks, nks))) it should be: k=rep(1:nks, rep(nis*njs, nks))) That is, the k index

Re: [R] vertically stacked area plot?

2011-12-30 Thread Richard M. Heiberger
Ellen, Is this what you are looking for? library(HH) sed - read.table(textConnection( sed_depth FT value 0-1 1A 35.16591742 1-2 1A 36.21447839 2-3 1A 19.09701388 3-4 1A 35.86953345 4-10 1A 30.04823571 0-1 1B 15.02829003 1-2 1B 19.15637318 2-3 1B 12.45405429 3-4 1B 25.23130364 4-10 1B

[R] Calculate survival function for AFT model

2011-12-30 Thread thebennjammin
I have fit an accelerated failure time model using coxph, and have what seems to be a simple question that I can't figure out. Given a vector of predictor values X, the survival time S[t|X] is the probability the entity will survive longer than some time t. Now, how do I calculate this for a

[R] Help with BACI study analysis in R

2011-12-30 Thread Nate Fronk
Hi all, I am trying to analyze a before-after control-impact study. I'm looking for a reference guide to help as I am pretty new to R. If anyone has any suggestions on a guide I would appreciate it. Thanks. Nate Fronk [[alternative HTML version deleted]]

Re: [R] good method of removing outliers?

2011-12-30 Thread Paul
On 30/12/11 17:03, Michael wrote: Happy holidays all! I know it's very subjective to determine whether some data is outlier or not... But are there reasonally good and realistic methods of identifying outliers in R? Thanks a lot! Ignoring the moral questions for a moment (totaly depends on

Re: [R] Calculate survival function for AFT model

2011-12-30 Thread Milan Bouchet-Valat
Le vendredi 30 décembre 2011 à 12:46 -0800, thebennjammin a écrit : I have fit an accelerated failure time model using coxph, and have what seems to be a simple question that I can't figure out. Please specify the exact package, functions and actual code you use. coxph(), as the name says,

Re: [R] Calculate survival function for AFT model

2011-12-30 Thread David Winsemius
On Dec 30, 2011, at 6:19 PM, Milan Bouchet-Valat wrote: Le vendredi 30 décembre 2011 à 12:46 -0800, thebennjammin a écrit : I have fit an accelerated failure time model using coxph, and have what seems to be a simple question that I can't figure out. Please specify the exact package,

[R] HELP!! - PHP calling R to execute a r-code file (*.r)

2011-12-30 Thread Xiuquan Wang
Hi, I have met a tough problem when using PHP to call R to generate some plots. I tested it okay in my personal computer with WinXP. But when I was trying to update to my server (Win2003 server), I found it did not work. Below is the details: 1 r-code file (E:/mycode.r): --

Re: [R] vertically stacked area plot?

2011-12-30 Thread Jim Lemon
Dear all, I would like to create a vertically stacked area chart in R. The data are presented in the attached text file. I would like to see the trend in values for the different groups with sediment depth (that's why I would like to create a vertically stacked chart; normally sed_depth

[R] Very strange function() behaviour.

2011-12-30 Thread iliketurtles
Hi, R newb here. I've coded a function that inputs N dimensional array(s) [or class=numeric if it's dim=1] of coefficients and tstats, where dim(coef_matrix)=dim(tstat_matrix), it will then output a same dimension matrix of coefficients pasted to tstats in brackets pasted to significance stars.

Re: [R] Very strange function() behaviour.

2011-12-30 Thread iliketurtles
Okay it's working perfectly now. I restarted R and it worked on my first 5 goes. Can anybody shed light on how this kind of thing can happen? - Isaac Research Assistant Quantitative Finance Faculty, UTS -- View this message in context: