Re: [R] Definition of AIC (Akaike information criterion) for normal error models

2012-07-07 Thread Prof Brian Ripley
On 06/07/2012 09:14, Kunio takezawa wrote: Dear R users (r-help@r-project.org), The definition of AIC (Akaike information criterion) for normal error models has just been changed. Excuse me, who empowered you to re-write history? Maybe Dr Akaike could have changed his definition, but

[R] number of decimal places in a number?

2012-07-07 Thread Martin Ivanov
Dear R users, I need a function that gets a number and returns its number of actual decimal places. For example f(3.14) should return 2, f(3.142) should return 3, f(3.1400) should also return 2 and so on. Is such function already available in R? If not, could you give me a hint how to achieve

Re: [R] number of decimal places in a number?

2012-07-07 Thread Ted Harding
On 07-Jul-2012 08:52:35 Martin Ivanov wrote: Dear R users, I need a function that gets a number and returns its number of actual decimal places. For example f(3.14) should return 2, f(3.142) should return 3, f(3.1400) should also return 2 and so on. Is such function already available in

[R] replacement has length zero

2012-07-07 Thread fabiano
I have been working on the following code but keep getting an err message. My current thinking is that the problem is on the indexing but do not know how to fix it. Any help please? ungulate - read.csv(Ungulate.csv,row.names=1) ungulate -

Re: [R] number of decimal places in a number?

2012-07-07 Thread Joshua Wiley
Hi Martin, Ted is spot on about the binary representation. A very different approach from his would be to convert to character and use regular expressions: ## the example numbers in a vector x - c(3.14, 3.142, 3.1400, 123456.123456789, 123456789.123456789, pi, sqrt(2))

Re: [R] How to intall car package on linux

2012-07-07 Thread Chenwei Gao
Thank you Michael !!! Problem solved~~ I forgot to hit Reply all, I will keep that in mind. Best, Chenwei On Fri, Jul 6, 2012 at 11:52 PM, Michael Weylandt michael.weyla...@gmail.com wrote: Please do keep messages on list unless there's a particular reason to take them private: it

[R] RedHat Linux intall R failed

2012-07-07 Thread Anderson.Zhang
A problem came when I installed R-2.15.0 in RedHat Linux from souce. when ./configure is commited , there is a error message like: === sudo ./configure Password: checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu

[R] Declaring a density function with for loop

2012-07-07 Thread chamilka
I have an extended binomial distribution which has the following form: http://r.789695.n4.nabble.com/file/n4635699/kb.png Here alpha and beta are two parameters and x=0,1,2,3,...n (alike the binomial distribution) I am writing a function to find out the densities (probabilities) of this

Re: [R] Declaring a density function with for loop

2012-07-07 Thread Berend Hasselman
chamilka wrote I have an extended binomial distribution which has the following form: http://r.789695.n4.nabble.com/file/n4635699/kb.png Here alpha and beta are two parameters and x=0,1,2,3,...n (alike the binomial distribution) I am writing a function to find out the densities

Re: [R] RedHat Linux intall R failed

2012-07-07 Thread Prof Brian Ripley
From the file INSTALL: 'The main source of information on installation is the `R Installation and Administration Manual', an HTML copy of which is available as file `doc/html/R-admin.html'. Please read that before installing R. But if you are impatient, read on but please refer to the manual

Re: [R] number of decimal places in a number?

2012-07-07 Thread Ted Harding
I had thought of also (as well as my numerical routing) suggesting a gsub() type solution like Joshua's below, but held back because the result could depend on how the number arose (keyboard input, file input, or from computation within R). However, I now also realise that (again because of

[R] Getting objects from quantmod ticker list

2012-07-07 Thread Cren
Hi all, I would need to put datas downloaded with quantmod into a matrix or a data frame. Suppose to start from here: *require(quantmod) ticker.list - c('AAA', 'ALTSALES','AMBNS','AMBSL','BAA', 'EMRATIO', 'FEDFUNDS', 'GASPRICE', 'GS1', 'GS10', 'GS20',

Re: [R] Getting objects from quantmod ticker list

2012-07-07 Thread Joshua Ulrich
Load the data into an environment, then merge them using do.call(): series.env - new.env() getSymbols(ticker.list, src='FRED', env=series.env) series - do.call(merge, as.list(series.env)) HTH, -- Joshua Ulrich | FOSS Trading: www.fosstrading.com On Sat, Jul 7, 2012 at 7:00 AM, Cren

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

2012-07-07 Thread Rich Shepard
On Fri, 6 Jul 2012, MacQueen, Don wrote: So what you're faced with is that the cenros() function has no built-in methods for grouping or subsetting -- unlike some other R methods, especially those that work with the lattice package, or the many modeling functions like lm() that have a subset

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

2012-07-07 Thread David Winsemius
On Jul 6, 2012, at 4:30 PM, Abraham Mathew wrote: Ok, so let's say I have a logit equation outlined as Y= 2.5 + 3X1 + 2.3X2 + 4X3 + 3.6X4 + 2.2X5 So a one unit increase in X2 is associated with a 2.3 increase in Y, Assuming, that is, you also understand what Y is. From you comments so

Re: [R] Is R BOOT package available for 2.15.1 version for Mac OS?

2012-07-07 Thread David Winsemius
On Jul 6, 2012, at 6:31 PM, SergeyHC wrote: David, thanks for your helpful response. Now i figured out that I do have boot command and do not need to install any additional packages. With regards t R GUI, I guess I would like to use it, but I could not figure out how to install it. For

Re: [R] replacement has length zero

2012-07-07 Thread Jeff Newmiller
Your request fails the reproducibility requirement from the posting guide, because you have not supplied enough data to run the code and reproduce the error. --- Jeff NewmillerThe .

Re: [R] fixed trimmed mean for group

2012-07-07 Thread Rui Barradas
Hello, I haven't found errors in your code. I implemented the test in the paper (the first, fixed symetric mean) and it also gives me zero Type I errors, when alpha = 0.05. Try to see the value of min(pv) or to plot the histogram of 'pv', hist(pv) and you'll see that there are no significant

Re: [R] number of decimal places in a number?

2012-07-07 Thread Martin Ivanov
Dear Mr Harding, Thank You very much for Your responsiveness. There would seem to be no clean general solution to this question. An important issue would be: What use do you want to put the result to? I need this trick for the following task. I am writing a function which has to determine

[R] test parallel slopes with svyolr

2012-07-07 Thread Diana Marcela Martinez Ruiz
Hello, I would like to know how to test the assumption of proportional odds or parallel lines or slopes for an ordinal logistic regression with svyolr Thanks [[alternative HTML version deleted]] __

Re: [R] Problem with Apriori

2012-07-07 Thread Uwe Ligges
On 06.07.2012 12:23, Pascal Oettli wrote: Good morning, 1. What is your OS? 2. Which package do you use to perform the Apriori? Given the error message, a good guess is probably that the trio package is used. The CRAN checks showed also some (maybe unrelated) problems with the package

Re: [R] colored nodes in dendrogram

2012-07-07 Thread Uwe Ligges
On 05.07.2012 21:28, Ondřej Mikula wrote: 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

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

2012-07-07 Thread Greg Snow
Try the following: library(TeachingDemos) ?TkPredict fit.glm1 - glm( Species=='virginica' ~ Sepal.Width+Sepal.Length, data=iris, family=binomial) TkPredict(fit.glm1) (you may need to install the TeachingDemos package first if you don't already have it installed) You

[R] regressor autoregressive error?

2012-07-07 Thread Rakheon Kim
Hello, I am using R for fitting parameters of a time series model. The model is as below. Y(t) = mu + a*X(t) + YN(t) where YN(t) = b*YN(t-1) + innovation and Z(t) follows N(0,1). The main obstacle for me is the autoregressive error term, YN(t). I can't figure out how to estimate the parameters

Re: [R] Declaring a density function with for loop

2012-07-07 Thread chamilka
Thank you very much for you kind explanation Berend Hasselman!! Is it possible to declare this probability density function without looping? -- View this message in context: http://r.789695.n4.nabble.com/Declaring-a-density-function-with-for-loop-tp4635699p4635720.html Sent from the R help

Re: [R] Getting objects from quantmod ticker list

2012-07-07 Thread Cren
Joshua Ulrich wrote Load the data into an environment, then merge them using do.call(): series.env - new.env() getSymbols(ticker.list, src='FRED', env=series.env) series - do.call(merge, as.list(series.env)) Thank you very much, Joshua: this works very well! Thank you :) -- View

Re: [R] Problem with Apriori

2012-07-07 Thread Holger Schwender
Hi Uwe, there is no function called apriori in the trio package. I guess apriori is from the arules package, which however does not depend on or suggests trio. The error in some of the package checks of trio is based on some strange,very rarely occuring behavior of the Fortran code in the

Re: [R] replacement has length zero

2012-07-07 Thread Peter Ehlers
On 2012-07-07 03:19, fabiano wrote: I have been working on the following code but keep getting an err message. My current thinking is that the problem is on the indexing but do not know how to fix it. Any help please? ungulate - read.csv(Ungulate.csv,row.names=1) ungulate -

Re: [R] How to compare stacked histograms/datasets

2012-07-07 Thread Joshua Wiley
Hi, Probably easier to work with the raw data, but whatever. If your data is in a data frame, dat, ## create row index dat$x - 1:21 ## load packages require(ggplot2) require(reshape2) ## melt the data frame to be long, long dat, ldat for short ldat - melt(dat, id.vars=x) ## plot the

Re: [R] number of decimal places in a number?

2012-07-07 Thread arun
Hi, I checked the count for the cases (A) and (F) with a variant of Josh's function: decimalnumcount-function(x){stopifnot(class(x)==character)  x-gsub((.*)(\\.)|([0]*$),,x)  nchar(x)  }  A) x-123456789.123456789  decimalnumcount(x) #[1] 9 x-923456789.123456789 decimalnumcount(x) #[1] 9 B)  

Re: [R] Mann-Whitney by group

2012-07-07 Thread David L Carlson
This works. First we assign the results of dput() to a variable So we can use it. Then we eliminate the groups we don't need. Third we remake the factors to eliminate the groups and genes that do not appear in the data subset. Finally, compute the tests. Dta - structure(list(Gene =

[R] Splitting a character vector.

2012-07-07 Thread John Kane
I am lousy at simple regex and I have not found a solution to a simple problem. I have a vector with some character values that I want to split. Sample data dd1 - c( XXY (mat harry),XXY (jim bob), CAMP (joe blow), ALP (max jack)) Desired result dd2 - data.frame( xx = c(XXY, XXY, CAMP, ALP),

Re: [R] Declaring a density function with for loop

2012-07-07 Thread David L Carlson
dnewdis - function(x, a, b, n) { i - 0:exp(10) term -sum-1)**i)*(choose(b-1,i))*(beta(x+a+a*i,n-x+1 a*b*choose(n,x)*term } -- David L Carlson Associate Professor of Anthropology Texas AM University College Station, TX 77843-4352

Re: [R] Splitting a character vector.

2012-07-07 Thread Rui Barradas
Hello, Try the following. open.par - \\( # with a blank before '(' close.par - \\) result - strsplit(sub(close.par, , dd1), open.par) Why the two '\\'? Because '(' is a meta-character so it must be escaped. But '\' is a meta character so it must also be escaped. Then choose the right way

Re: [R] Splitting a character vector.

2012-07-07 Thread John Kane
Thanks Rui It works perfectly so far on the test and real data. The annoying thing is that I had tried , or thought I'd tried the open.par format and keep getting an error. It looks like I had failed to add the , in the term. What is it doing? John Kane Kingston ON Canada

Re: [R] Splitting a character vector.

2012-07-07 Thread Rui Barradas
Hello, Sorry, but I don't understand, you're asking about 4 single quotes, the double quotes in open.par are just opening and closing the pattern, a character string. Rui Barradas Em 07-07-2012 23:03, John Kane escreveu: Thanks Rui It works perfectly so far on the test and real data. The

Re: [R] Splitting a character vector.

2012-07-07 Thread Jeff Newmiller
Just to clarify, the regex engine wants to see a \ before the ( if it is to treat it as an ordinary character. However, the source code interpreter also treats \ as an escape character. In order to get a \ into the string, you have to escape it. So it takes two \ characters in source code to

Re: [R] Splitting a character vector.

2012-07-07 Thread Rui Barradas
Oh, right! The close parenthesis isn't doing nothing in the result, t could be done after but since we're to it... Rui Barradas Em 07-07-2012 23:10, Mark Leeds escreveu: Hi Rui: I think he's asking about your replacement with blanks. On Sat, Jul 7, 2012 at 6:08 PM, Rui Barradas

Re: [R] Splitting a character vector.

2012-07-07 Thread John Kane
No sorry Rui, In the expression result - strsplit(sub(close.par, , dd1), open.par) there is close.par, '', open.par I probably am just blind but I don't understand what it is doing. John Kane Kingston ON Canada -Original Message- From: ruipbarra...@sapo.pt Sent: Sat, 07 Jul 2012

Re: [R] Splitting a character vector.

2012-07-07 Thread John Kane
Thanks Jeff. I actually had that figured out after a good hour of pounding my head against the wall but I still could not seem to get the syntax correct. I think I misunderstand strpsplt() just enough to keep making dumb mistakes. John Kane Kingston ON Canada -Original Message-

Re: [R] number of decimal places in a number?

2012-07-07 Thread Bert Gunter
mod Ted's comments, I believe that for your situation (not too many digits to represent, decimal point always present) countDecDigits - function(x)nchar(sapply(strsplit(as.character(x),\\.),[,2)) is simple and should work. No need for regular expressions here. -- Bert On Sat, Jul 7, 2012 at

Re: [R] Splitting a character vector.

2012-07-07 Thread Rui Barradas
It's an empty character string, meant to substitute nothing for close.par, to get rid of it. Rui Barradas Em 07-07-2012 23:17, John Kane escreveu: No sorry Rui, In the expression result - strsplit(sub(close.par, , dd1), open.par) there is close.par, '', open.par I probably am just blind

Re: [R] Splitting a character vector.

2012-07-07 Thread John Kane
How totaly obvious once you tell me! I would have spend days trying to figure it out. I think I have a total mental block on regex and their derivatives. Thanks very much. John Kane Kingston ON Canada -Original Message- From: ruipbarra...@sapo.pt Sent: Sat, 07 Jul 2012 23:21:19

Re: [R] Splitting a character vector.

2012-07-07 Thread John Kane
Ah, I think Mark may have it. See my earlier post. Why the space? John Kane Kingston ON Canada -Original Message- From: ruipbarra...@sapo.pt Sent: Sat, 07 Jul 2012 23:12:46 +0100 To: marklee...@gmail.com Subject: Re: [R] Splitting a character vector. Oh, right! The close

Re: [R] Splitting a character vector.

2012-07-07 Thread Rui Barradas
The space is for a different reason, strsplit doesn't put the split pattern in the result, so if a space is included it will be automatically deleted. For instance in XXY (mat harry) without the space it would become XXY and mat harry) but we want XXY so include the space in the pattern.

Re: [R] Splitting a character vector.

2012-07-07 Thread John Kane
I think I'm geting it a bit. Anyway time to shut down and have a beer. Life will be much nice tomorrow or Monday when I get back to cleaning up the data from that spreadsheet. Many thanks and have a good weekend. John Kane Kingston ON Canada -Original Message- From:

Re: [R] Tables extraction in R ?

2012-07-07 Thread David L Carlson
You could use xtable (no s). It produces latex and html formats, but for Excel you want to use html format. library(xtable) agec - sample(c(rep(1, 15), rep(2, 4), 3), 1000, replace=TRUE) table(agec) agec 1 2 3 759 202 39 print(xtable(table(agec)), type=html, file=clipboard-128)

Re: [R] degree of freedom GLM

2012-07-07 Thread Peter Ehlers
Please use 'Reply All' in your responses. Others may be better able to help than I. See comments inline below. On 2012-07-06 04:46, Jennifer Kaiser wrote: You probably intended all the variables that are of type integer (e.g. FAHRL_C) to be _factors_. My guess is that, for ease of data entry,

Re: [R] significant difference between Gompertz hazard parameters?

2012-07-07 Thread T-Bone
Hi, David. Thank you for the suggestions. If it makes a difference, I've included more information on the data and how the Gompertz model was fit to each sample below. I'm sure my methods are inefficient, and I should utilizing R's process of vectorization. Thanks, again. --Trey David

Re: [R] Specify model with polynomial interaction terms up to degree n

2012-07-07 Thread YTP
Hi Rui, Thanks for responding. I did not write raw=raw, and I'm not sure why R would return such a misleading error message. Indeed, the same error message comes up when I run the 2nd part of your code: m - matrix(1:6, ncol=2) p6 - poly(m, degree=6, raw=TRUE) Error in poly(dots[[1L]],

Re: [R] npRmpi trouble - mpi.comm.spawn causes segfault

2012-07-07 Thread claurin
Hi Peter, I had this same problem, but only when using Rmpi interactively. My scripts work when run in batch mode, following the examples at http://math.acadiau.ca/ACMMaC/Rmpi/ . Since this message is old, you may have discovered this already. Nevertheless, if others have the same problem,

Re: [R] How to compare stacked histograms/datasets

2012-07-07 Thread Atulkakrana
Hello Joshua, Thanks for taking time out to help me with problem. Actually the comparison is to be done among two (if possible, more than two) datasets and not within the dataset. Each dataset hold 5 variables (i.e Red, Purple, Blue, Grey and Yellow) for 21 different positions i.e 1-21n. So, we

[R] Questions about glht() and interpretation of output from Tukey's in multcomp

2012-07-07 Thread Adam Coble
Hi, I have a few questions about glht() and the interpretation of output from Tukey's in multcomp package for lme() model. The main issue is that I noticed that a plot that I produced with code letters seem to contradict the graph itself. I provide data and code below. I end with my questions.

Re: [R] Splitting a character vector.

2012-07-07 Thread arun
HI John, If I understand the post, in your original data, there is a space between XXY and (. If there was no space, dd1  -  c( XXY(mat harry),XXY(jim bob), CAMP(joe blow), ALP(max jack)) #Rui's original code will produce result-strsplit(sub(close.par,,dd1),open.par) result [[1]] [1] XXY(mat

Re: [R] 回复: Re: skipped correlation

2012-07-07 Thread R. Michael Weylandt michael.weyla...@gmail.com
On Jul 5, 2012, at 9:30 PM, qinjiaolongqinjiaol...@126.com wrote: Dear Michael, Thanks a lot for your help. As I searched, the “scor” function is a robust correlation, which is cited by Wilcox, R.R., Inferences Based on a Skipped Correlation Coefficient. Journal of Applied

Re: [R] Splitting a character vector.

2012-07-07 Thread David Winsemius
On Jul 7, 2012, at 5:37 PM, John Kane wrote: I am lousy at simple regex and I have not found a solution to a simple problem. I have a vector with some character values that I want to split. Sample data dd1 - c( XXY (mat harry),XXY (jim bob), CAMP (joe blow), ALP (max jack)) Desired

Re: [R] Specify model with polynomial interaction terms up to degree n

2012-07-07 Thread Peter Ehlers
On 2012-07-07 14:56, YTP wrote: Hi Rui, Thanks for responding. I did not write raw=raw, and I'm not sure why R would return such a misleading error message. Indeed, the same error message comes up when I run the 2nd part of your code: m - matrix(1:6, ncol=2) p6 - poly(m, degree=6, raw=TRUE)

Re: [R] Poisson Ridge Regression

2012-07-07 Thread cberry
umesh khatri khatriumes...@gmail.com writes: Dear everyone I'm dealing with a problem related to Poisson Ridge Regression. If anyone can help me in this regard by telling if any changes in the source code of glm.fit may help As John Kane suggested, the posting guide is a good start. So is

[R] Notation for previous observation in a data frame

2012-07-07 Thread Ernie Tedeschi
I've created a data frame in R, but in order to clean up some of the data, I need to set certain variable observations equal to the value of their previous observation (it would be conditional, but that part's less important right now). In Stata, I would simply set var = var[_n-1] in those cases.