Re: [R] Test For Difference of Betas By Group in car

2025-01-19 Thread John Fox
Dear John, Here's the summary for your model: - snip - > summary(model) Call: lm(formula = income ~ education * gender, data = data) Residuals: 1 2 3 4 5 6 -4.286e+00 -5.000e+00 6.429e+00 -1.080e-14 -2.143e+00 5.000e+00 Coeffici

Re: [R] Test For Difference of Betas By Group in car

2025-01-19 Thread David Winsemius via R-help
Sent from my iPhone > On Jan 19, 2025, at 2:48 PM, David Winsemius wrote: > >  > Sent from my iPhone > >> On Jan 19, 2025, at 1:57 PM, David Winsemius wrote: >> >> I don’t understand why you don’t include the full text of the error. >> >> — >> David >> Sent from my iPhone >> On Jan

Re: [R] Test For Difference of Betas By Group in car

2025-01-18 Thread David Winsemius via R-help
Sent from my iPhone > On Jan 19, 2025, at 1:57 PM, David Winsemius wrote: > > I don’t understand why you don’t include the full text of the error. > > — > David > Sent from my iPhone > >> On Jan 19, 2025, at 10:00 AM, Sparks, John via R-help >> wrote: >> >> Hello R-Helpers, >> >> I was

Re: [R] Test For Difference of Betas By Group in car

2025-01-18 Thread David Winsemius via R-help
I don’t understand why you don’t include the full text of the error. — David Sent from my iPhone > On Jan 19, 2025, at 10:00 AM, Sparks, John via R-help > wrote: > > Hello R-Helpers, > > I was looking into how to test whether the beta coefficient from a regression > would be the same for

Re: [R] test logistic regression model

2022-11-20 Thread Mitchell Maltenfort
, or present both and highlight the difference in outcome. A > third option is to gather more data. > > Tim > > -Original Message- > From: R-help On Behalf Of Bert Gunter > Sent: Sunday, November 20, 2022 1:06 PM > To: Mitchell Maltenfort > Cc: R-help > Subject: R

Re: [R] test logistic regression model

2022-11-20 Thread Ebert,Timothy Aaron
- From: R-help On Behalf Of Bert Gunter Sent: Sunday, November 20, 2022 1:06 PM To: Mitchell Maltenfort Cc: R-help Subject: Re: [R] test logistic regression model [External Email] I think (2) might be a bad idea if one of the "sparse"categories has high predictive power. You'll l

Re: [R] test logistic regression model

2022-11-20 Thread Bert Gunter
I think (2) might be a bad idea if one of the "sparse"categories has high predictive power. You'll lose it when you pool, will you not? Also, there is the problem of subjectively defining "sparse." However, 1) seems quite sensible to me. But IANAE. -- Bert On Sun, Nov 20, 2022 at 9:49 AM Mitchel

Re: [R] test logistic regression model

2022-11-20 Thread Mitchell Maltenfort
Two possible fixes occur to me 1) Redo the test/training split but within levels of factor - so you have the same split within each level and each level accounted for in training and testing 2) if you have a lot of levels, and perhaps sparse representation in a few, consider recoding levels to po

Re: [R] test logistic regression model

2022-11-20 Thread Bert Gunter
small reprex: set.seed(5) dat <- data.frame(f = rep(c('r','g'),4), y = runif(8)) newdat <- data.frame(f =rep(c('r','g','b'),2)) ## convert values in newdat not seen in dat to NA is.na(newdat$f) <-!( newdat$f %in% dat$f) lmfit <- lm(y~f, data = dat) ##Result: > predict(lmfit,newdat) 1

Re: [R] test logistic regression model

2022-11-20 Thread Rui Barradas
Às 15:29 de 20/11/2022, Gábor Malomsoki escreveu: Dear Bert, Yes, was trying to fill the not existing categories with NAs, but the suggested solutions in stackoverflow.com unfortunately did not work. Best regards Gabor Bert Gunter schrieb am So., 20. Nov. 2022, 16:20: You can't predict res

Re: [R] test logistic regression model

2022-11-20 Thread Gábor Malomsoki
Dear Bert, Yes, was trying to fill the not existing categories with NAs, but the suggested solutions in stackoverflow.com unfortunately did not work. Best regards Gabor Bert Gunter schrieb am So., 20. Nov. 2022, 16:20: > You can't predict results for categories that you've not seen before > (

Re: [R] test logistic regression model

2022-11-20 Thread Bert Gunter
You can't predict results for categories that you've not seen before (think about it). You will need to remove those cases from your test set (or convert them to NA and predict them as NA). -- Bert On Sun, Nov 20, 2022 at 7:02 AM Gábor Malomsoki wrote: > Dear all, > > i have created a logistic

Re: [R] test if something was plotted on pdf device

2019-09-13 Thread PIKAL Petr
er it is finished to pdf. The only obstacle is that my code flashes during plotting to basic device, however I can live with it. Thank you again and best regards Petr > -Original Message- > From: Duncan Murdoch > Sent: Thursday, September 12, 2019 2:29 PM > To: PIKAL Petr

Re: [R] test if something was plotted on pdf device

2019-09-12 Thread Duncan Murdoch
On 12/09/2019 7:10 a.m., PIKAL Petr wrote: Dear all Is there any simple way checking whether after calling pdf device something was plotted into it? In interactive session I used if (dev.cur()==1) plot(ecdf(rnorm(100))) else plot(ecdf(rnorm(100)), add=T, col=i) which enabled me to test if pl

Re: [R] test of independence

2018-12-20 Thread Greg Snow
The basic test of independence for a table based on the Chi-squared distribution can be done using the `chisq.test` function. This is in the stats package which is installed and loaded by default, so you don't need to do anything additional. There is also the `fisher.test` function for Fisher's e

Re: [R] test of independence

2018-12-20 Thread PIKAL Petr
Hi Did you search CRAN? I got **many** results for test of independence which may or may not provide you with suitable procedures. Cheers Petr > -Original Message- > From: R-help On Behalf Of km > Sent: Thursday, December 20, 2018 8:07 AM > To: r-help@r-project.org > Subject: [R] tes

Re: [R] Test if data uniformly distributed (newbie)

2018-04-10 Thread Huber, Florian
Dear Mr. Savicky, I am currently working on a project where I want to test a random number generator, which is supposed to create 10.000 continuously uniformly distributed random numbers between 0 and 1. I am now wondering if I can use the Chi-Squared-Test to solve this problem or if the Kolmog

Re: [R] test for proportion or concordance

2017-08-03 Thread Bert Gunter
This list is about R programming, not statistics, although admittedly there is a nonempty intersection. However, I think you would do better posting this on a statistics list like stats.stackexchange.com. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along

Re: [R] Test individual slope for each factor level in ANCOVA

2017-03-16 Thread li li
Hi John. Thanks much for your help. It is great to know this. Hanna 2017-03-16 8:02 GMT-04:00 Fox, John : > Dear Hanna, > > You can test the slope in each non-reference group as a linear hypothesis. > You didn’t make the data available for your example, so here’s an example > using the linearHy

Re: [R] Test individual slope for each factor level in ANCOVA

2017-03-16 Thread Fox, John
Dear Hanna, You can test the slope in each non-reference group as a linear hypothesis. You didn’t make the data available for your example, so here’s an example using the linearHypothesis() function in the car package with the Moore data set in the same package: - - - snip - - - > library(car) >

Re: [R] Test for Homoscedesticity in R Without BP Test

2016-04-04 Thread Deepak Singh
I have tried and got the result. Thank you every one. On Tue, Apr 5, 2016 at 12:58 AM, Achim Zeileis wrote: > On Mon, 4 Apr 2016, varin sacha via R-help wrote: > > Hi Deepak, >> >> In econometrics there is another test very often used : the white test. >> The white test is based on the comparis

Re: [R] Test for Homoscedesticity in R Without BP Test

2016-04-04 Thread Achim Zeileis
On Mon, 4 Apr 2016, varin sacha via R-help wrote: Hi Deepak, In econometrics there is another test very often used : the white test. The white test is based on the comparison of the estimated variances of residuals when the model is estimated by OLS under the assumption of homoscedasticity a

Re: [R] Test for Homoscedesticity in R Without BP Test

2016-04-04 Thread Achim Zeileis
On Mon, 4 Apr 2016, Deepak Singh wrote: Respected Sir, I am doing a project on multiple linear model fitting and in that project I have to test Homoscedesticity of errors I have google for the same and found bptest for the same but in R version 3.2.4 bp test is not available. The function is c

Re: [R] Test for Homoscedesticity in R Without BP Test

2016-04-04 Thread varin sacha via R-help
Hi Deepak, In econometrics there is another test very often used : the white test. The white test is based on the comparison of the estimated variances of residuals when the model is estimated by OLS under the assumption of homoscedasticity and when the model is estimated by OLS under the assump

Re: [R] Test for Homoscedesticity in R Without BP Test

2016-04-04 Thread John C Frain
You might "google Breusch Pagan test r" and find that the test is implemented in lmtest package. On 4 Apr 2016 17:28, "Deepak Singh" wrote: > Respected Sir, > I am doing a project on multiple linear model fitting and in that project I > have to test Homoscedesticity of errors I have google for th

Re: [R] test hypothesis in R

2016-03-23 Thread David Winsemius
> On Mar 23, 2016, at 1:44 PM, ruipbarra...@sapo.pt wrote: > > Hello, > > Try > > ?t.test > t.test(mA, mB, alternative = "greater") > > Hope this helps, > > Rui Barradas > > > Citando Eliza Botto : > >> Dear All, >> I want to test a hypothesis in R by using student' t-test (P-values). >>

Re: [R] test hypothesis in R

2016-03-23 Thread ruipbarradas
s is that model A produced less error. >   > regards, >   > Eliza >   > - > Date: Wed, 23 Mar 2016 20:44:20 + > From: ruipbarra...@sapo.pt > To: eliza_bo...@outlook.com > CC: r-help@r-project.org > Subject: Re: [R] test hypothesis in R > Dear All, > I want to test

Re: [R] test hypothesis in R

2016-03-23 Thread Eliza Botto
Thnx Rui, Just one point though Should it be alternative="greater" or "less"? Since alternative hypothesis is that model A produced less error. regards, Eliza Date: Wed, 23 Mar 2016 20:44:20 + From: ruipbarra...@sapo.pt To: eliza_bo...@outlook.com CC: r-help@r-project

Re: [R] test hypothesis in R

2016-03-23 Thread ruipbarradas
Hello, Try ?t.test t.test(mA, mB, alternative = "greater") Hope this helps, Rui Barradas   Citando Eliza Botto : > Dear All, > I want to test a hypothesis in R by using student' t-test (P-values). > The hypothesis is that model A produces lesser error than model B at > ten stations. Obvious

Re: [R] test if a url exists

2014-06-28 Thread Duncan Murdoch
On 29/06/2014, 7:12 AM, Hui Du wrote: > Hi all, > > I need to test if a url exists. I used url.exists() in RCurl package > > library(RCurl) > > however the test result is kind of weird. For example, > >> url.exists("http://www.amazon.com";) > [1] FALSE > > although www.amazon.com

Re: [R] test the return from grep or agrep

2014-03-02 Thread Prof Brian Ripley
On 01/03/2014 23:32, Hui Du wrote: Hi All, My sample code looks like options(stringsAsFactors = FALSE); clean = function(x) { loc = agrep("ABC", x$name); x[loc,]$new_name <- "NEW"; x; } name = c("12", "dad", "dfd"); y = data.frame(name = as.character(name), idx = 1:3); y$new_nam

Re: [R] Test to determine if there is a difference between two means

2013-12-24 Thread Bert Gunter
Inline below. Cheers, Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." H. Gilbert Welch On Tue, Dec 24, 2013 at 7:38 AM, wesley bell wrote: > Hi, > I have a data set where there ar

Re: [R] Test ADF differences in R and Eviews

2013-12-05 Thread David Winsemius
On Dec 5, 2013, at 3:18 PM, nooldor wrote: > Hi, > > > In attachment you can find source data on which I run adf.test() and > print-screen with results in R and Eviews. > > Results are very different. Did I missed something? Yes. You missed the list of acceptable file types for r-help. -- D

Re: [R] test wilcoxon sur R help!

2013-10-24 Thread arun
It looks much better than mine. with p value adjustment: p.adjust(fun1(dat1), method = "holm", n = 153) # dat1$id <- 1:10 library(reshape2) dat2 <- melt(dat1,id.var="id") with(dat2,pairwise.wilcox.test(value,variable))  with(dat2,pairwise.wilcox.test(value,variable,p.adj="none")) A.K.

Re: [R] test wilcoxon sur R help!

2013-10-24 Thread vikram ranga
Hi, Check out this function:- pairwise.wilcox.test {package=stats}. example(pairwise.wilcox.test) On Fri, Oct 25, 2013 at 2:15 AM, Rui Barradas wrote: > Hello, > > There's a bug in your function, it should be 'dat', not 'dat1'. In the line > marked, below. > > fun1 <- function(dat){ > m

Re: [R] test wilcoxon sur R help!

2013-10-24 Thread Rui Barradas
Hello, There's a bug in your function, it should be 'dat', not 'dat1'. In the line marked, below. fun1 <- function(dat){ mat1 <- combn(colnames(dat),2) # Here, 'dat' not 'dat1' res <- sapply(seq_len(ncol(mat1)),function(i) {x1<- dat[,mat1[,i]]; wilcox.test(x1[,1],x1[,2])$p.value})

Re: [R] test wilcoxon sur R help!

2013-10-24 Thread arun
Hi, Try: fun1 <- function(dat){ mat1 <- combn(colnames(dat1),2)  res <- sapply(seq_len(ncol(mat1)),function(i) {x1<- dat[,mat1[,i]]; wilcox.test(x1[,1],x1[,2])$p.value}) names(res) <- apply(mat1,2,paste,collapse="_") res } set.seed(432) dat1 <- as.data.frame(matrix(sample(18*10,18*10,replace=FALS

Re: [R] Test if 2 samples differ if they have autocorrelation

2013-07-18 Thread Rolf Turner
I imagine that most readers of this list will put your question in the too hard basket. That being so, here is my inexpert take on the question. The issue is to estimate the uncertainty in the estimated difference of the means. This uncertainty depends on the nature of the serial dependence

Re: [R] Test for column equality across matrices

2013-07-14 Thread William Dunlap
:smartpink...@yahoo.com] > Sent: Saturday, July 13, 2013 10:57 AM > To: William Dunlap > Cc: R help; Thiem Alrik > Subject: Re: [R] Test for column equality across matrices > > I tried it on a slightly bigger dataset: > A1 <- matrix(t(expand.grid(1:90, 15, 16)), nrow = 3) &

Re: [R] Test for column equality across matrices

2013-07-14 Thread Thiem Alrik
ilto:smartpink...@yahoo.com] Gesendet: Samstag, 13. Juli 2013 19:57 An: William Dunlap Cc: mailman, r-help; Thiem Alrik Betreff: Re: [R] Test for column equality across matrices I tried it on a slightly bigger dataset: A1 <- matrix(t(expand.grid(1:90, 15, 16)), nrow = 3) B1 <- combn(90, 3) which(is.

Re: [R] Test for column equality across matrices

2013-07-13 Thread arun
[[14]] #[1] 14 15 16  is.element(B1Sp[[44331]],A1Sp[[14]]) #[1] TRUE TRUE TRUE A.K. - Original Message - From: William Dunlap To: Thiem Alrik ; "mailman, r-help" Cc: Sent: Saturday, July 13, 2013 1:30 PM Subject: Re: [R] Test for column equality across matrices Try  

Re: [R] Test for column equality across matrices

2013-07-13 Thread arun
Hi, One way would be:  which(apply(t(B),1,paste,collapse="")%in%apply(t(A),1,paste,collapse="")) #[1] 105 196 274 340 395 B[,105] #[1]  1 15 16  B[,196] #[1]  2 15 16  B1<-B[,!apply(t(B),1,paste,collapse="")%in%apply(t(A),1,paste,collapse="")]  dim(B1) #[1]   3 555  dim(B) #[1]   3 560 #or B2<-B[,

Re: [R] Test for column equality across matrices

2013-07-13 Thread William Dunlap
Try columnsOf <- function(mat) split(mat, col(mat)) newB <- B[ , !is.element(columnsOf(B), columnsOf(A))] Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Thiem A

Re: [R] Test of Parallel Regression Assumption in R

2013-03-11 Thread Rune Haubo
Dear Heather, You can make this test using the ordinal package. Here the function clm fits cumulative link models where the ordinal logistic regression model is a special case (using the logit link). Let me illustrate how to test the parallel regression assumption for a particular variable using

Re: [R] Test of Parallel Regression Assumption in R

2013-03-11 Thread Nicole Ford
here's some code as an example hope it helps! mod<-polr(vote~age+demsat+eusup+lrself+male+retnat+union+urban, data=dat) summary(mod) mod<-polr(vote~age+demsat+eusup+lrself+male+retnat+union+urban, data=dat) levs<-levels(dat$vote) tmpdat<-list() for(i in 1:(nlevels(dat$vote)-1)){ tmpdat[[i]

Re: [R] Test of Parallel Regression Assumption in R

2013-03-11 Thread Jeff Newmiller
Perhaps you should be asking whether such an algorithm exists, regardless of whether it is already implemented in R. However, this is the wrong place to ask such theory questions... your local statistics expert might know, or you could ask on a statistics theory forum such as stats.stackexchange

Re: [R] Test of Parallel Regression Assumption in R

2013-03-11 Thread Bert Gunter
Heather: You are at Vanderbilt, whose statistics department under Frank Harrell is a veritable bastion of R and statistical wisdom. I strongly recommend that you take a stroll over there in the lovely spring weather and seek their help. I can't imagine how you could do better than that! Cheers, B

Re: [R] test for a condition in a vector for loop not working

2012-11-10 Thread scoyoc
Once again, thanks! MVS - MVS = Matthew Van Scoyoc Graduate Research Assistant, Ecology Wildland Resources Department & Ecology Center Quinney College of Natural Resources Utah State University Logan, UT = Think SNOW! -- View this message in context: http://r.789695.n4.nabble.com/

Re: [R] Test for Random Points on a Sphere

2012-10-07 Thread 周果
Hi Lorenzo, Just a quick thought, the uniform probability density on a unit sphere is 1 / (4pi), what about binning those random points according to their directions and do a chi-square test? Regards, Guo On Sun, Oct 7, 2012 at 2:16 AM, wrote: > "Lorenzo Isella" writes: > > > Dear All, > > I

Re: [R] Test for Random Points on a Sphere

2012-10-06 Thread cberry
"Lorenzo Isella" writes: > Dear All, > I implemented an algorithm for (uniform) random rotations. > In order to test it, I can apply it to a unit vector (0,0,1) in > Cartesian coordinates. > The result is supposed to be a set of random, uniformly distributed, > points on a sphere (not the point o

Re: [R] Test for Random Points on a Sphere

2012-10-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 R. Michael Weylandt > Sent: Friday, October 05, 2012 11:17 AM > To: Lorenzo Isella > Cc: r-help@r-project.org > Subject: Re: [R] Test for Random Points on

Re: [R] Test for Random Points on a Sphere

2012-10-05 Thread R. Michael Weylandt
On Fri, Oct 5, 2012 at 5:39 PM, Lorenzo Isella wrote: > Dear All, > I implemented an algorithm for (uniform) random rotations. > In order to test it, I can apply it to a unit vector (0,0,1) in Cartesian > coordinates. > The result is supposed to be a set of random, uniformly distributed, points >

Re: [R] test Breslow-Day for svytable??

2012-08-31 Thread Thomas Lumley
On Sat, Sep 1, 2012 at 4:27 AM, David Winsemius wrote: > > On Aug 31, 2012, at 7:20 AM, Diana Marcela Martinez Ruiz wrote: > >> Hi all, >> >> I want to know how to perform the test Breslow-Day test for homogeneity of >> odds ratios (OR) stratified for svytable. This test is obtained with the >> f

Re: [R] test Breslow-Day for svytable??

2012-08-31 Thread David Winsemius
On Aug 31, 2012, at 7:20 AM, Diana Marcela Martinez Ruiz wrote: > Hi all, > > I want to know how to perform the test Breslow-Day test for homogeneity of > odds ratios (OR) stratified for svytable. This test is obtained with the > following code: > > epi.2by2 (dat = daty, method = "case.contro

Re: [R] test Breslow-Day for svytable??

2012-08-31 Thread John Sorkin
Suggstion: You need to send us more information, i.e. the code that genrated daty, or a listing of the daty structure, and a copy of the listing produced by epi.2by2 John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Ger

Re: [R] test if elements of a character vector contain letters

2012-08-08 Thread Liviu Andronic
On Tue, Aug 7, 2012 at 10:26 PM, Marc Schwartz wrote: > since there are alpha-numerics present, whereas the first option will: > >> grepl("[^[:alnum:]]", "ab%") > [1] TRUE > > > So, use the first option. > And I should start reading more carefully. The above works fine for me. I ended up defining

Re: [R] test if elements of a character vector contain letters

2012-08-07 Thread Liviu Andronic
On Tue, Aug 7, 2012 at 10:18 PM, Marc Schwartz wrote: > That will get you values where punctuation characters are used, but there may > be other non-alphanumeric characters in the vector. There may be ASCII > control codes, tabs, newlines, CR, LF, spaces, etc. which would not be found > by usin

Re: [R] test if elements of a character vector contain letters

2012-08-07 Thread Marc Schwartz
On Aug 7, 2012, at 3:18 PM, Marc Schwartz wrote: > > On Aug 7, 2012, at 3:02 PM, Liviu Andronic wrote: > >> On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz wrote: >>> is.letter <- function(x) grepl("[[:alpha:]]", x) >>> is.number <- function(x) grepl("[[:digit:]]", x) >>> >> >> Another follo

Re: [R] test if elements of a character vector contain letters

2012-08-07 Thread Marc Schwartz
On Aug 7, 2012, at 3:02 PM, Liviu Andronic wrote: > On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz wrote: >> is.letter <- function(x) grepl("[[:alpha:]]", x) >> is.number <- function(x) grepl("[[:digit:]]", x) >> > > Another follow-up. To test for (non-)alphanumeric one would do the following:

Re: [R] test if elements of a character vector contain letters

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 4:28 AM, Liviu Andronic wrote: > On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz wrote: >> is.letter <- function(x) grepl("[[:alpha:]]", x) >> is.number <- function(x) grepl("[[:digit:]]", x) >> > Quick follow-up question. > > I'm always reluctant to create functions that wou

Re: [R] test if elements of a character vector contain letters

2012-08-07 Thread Liviu Andronic
On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz wrote: > is.letter <- function(x) grepl("[[:alpha:]]", x) > is.number <- function(x) grepl("[[:digit:]]", x) > Another follow-up. To test for (non-)alphanumeric one would do the following: > x <- c(letters, 1:26, '+', '-', '%^&') > x[1:10] <- paste(x[

Re: [R] test if elements of a character vector contain letters

2012-08-07 Thread Liviu Andronic
On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz wrote: > is.letter <- function(x) grepl("[[:alpha:]]", x) > is.number <- function(x) grepl("[[:digit:]]", x) > Quick follow-up question. I'm always reluctant to create functions that would resemble the method of a function (here, is() ), but would in

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Liviu Andronic
On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz wrote: > is.letter <- function(x) grepl("[[:alpha:]]", x) > is.number <- function(x) grepl("[[:digit:]]", x) > This does exactly what I wanted: > x [1] "a10" "b8" "c9" "d2" "e3" "f4" "g1" "h7" "i6" "j5" "k" "l" "m" "n" [15] "o" "p"

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Yihui Xie
You probably mean grepl('[a-zA-Z]', x) Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Mon, Aug 6, 2012 at 3:29 PM, Liviu Andronic wrote: > On Mon, Aug 6, 2012 at 6:42 PM, Bert Gunter wrote:

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Liviu Andronic
On Mon, Aug 6, 2012 at 6:42 PM, Bert Gunter wrote: > nzchar(x) & !is.na(x) > > No? > It doesn't work for what I need: > x [1] "a10" "b8" "c9" "d2" "e3" "f4" "g1" "h7" "i6" "j5" "k" "l" "m" "n" [15] "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" "1" "2" [29]

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread David L Carlson
is.letter <- function(x) grepl("[[:alpha:]]", x) > is.letter(x) [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE [13] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE [25] TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE F

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Marc Schwartz
On Aug 6, 2012, at 12:06 PM, Marc Schwartz wrote: > Perhaps I am missing something, but why use sapply() when grepl() is already > vectorized? > > is.letter <- function(x) grepl("[:alpha:]", x) > is.number <- function(x) grepl("[:digit:]", x) Sorry, typos in the above from my C&P. Should be:

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread arun
Hi, Not sure whether this is you wanted. x<-letters   (x[1:10] <- paste(x[1:10], sample(1:10, 10), sep=''))  x1<-c(x,1:26) x1  [1] "a4"  "b3"  "c5"  "d2"  "e9"  "f6"  "g1"  "h8"  "i10" "j7"  "k"   "l"  [13] "m"   "n"   "o"   "p"   "q"   "r"   "s"   "t"   "u"   "v"   "w"   "x"  [25] "y"   "z"  

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Marc Schwartz
Perhaps I am missing something, but why use sapply() when grepl() is already vectorized? is.letter <- function(x) grepl("[:alpha:]", x) is.number <- function(x) grepl("[:digit:]", x) x <- c(letters, 1:26) x[1:10] <- paste(x[1:10], sample(1:10, 10), sep='') x <- rep(x, 1e3) > str(x) chr [1:52

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Martin Morgan
On 08/06/2012 09:51 AM, Rui Barradas wrote: Hello, Fun as an exercise in vectorization. 30 times faster. Don't look, guess. > system.time(res0 <- grepl("[[:alpha:]]", x)) user system elapsed 0.060 0.000 0.061 > system.time(res1 <- has_letter(x)) user system elapsed 3.728 0.00

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Rui Barradas
Hello, Fun as an exercise in vectorization. 30 times faster. Don't look, guess. Gave it up? Ok, here it is. is_letter <- function(x, pattern=c(letters, LETTERS)){ sapply(x, function(y){ any(sapply(pattern, function(z) grepl(z, y, fixed=T))) }) } # test ascii codes, just one loo

Re: [R] test if elements of a character vector contain letters

2012-08-06 Thread Bert Gunter
nzchar(x) & !is.na(x) No? -- Bert On Mon, Aug 6, 2012 at 9:25 AM, Liviu Andronic wrote: > Dear all > I'm pretty sure that I'm approaching the problem in a wrong way. > Suppose the following character vector: >> (x[1:10] <- paste(x[1:10], sample(1:10, 10), sep='')) > [1] "a10" "b7" "c2" "d3"

Re: [R] test parallel slopes with svyolr

2012-07-08 Thread Thomas Lumley
On Sun, Jul 8, 2012 at 2:32 AM, Diana Marcela Martinez Ruiz wrote: > 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 I wouldn't, but if someone finds a clear reference I'd be prepared to

Re: [R] Test Binary File

2012-06-12 Thread Nortisiv
As an alternative to the hexview package, an external Hex-Editor may help you investigate how the data is organised. -- View this message in context: http://r.789695.n4.nabble.com/Test-Binary-File-tp833690p4633075.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Test if a sample mean of integers with range -inf; inf is different from zero

2012-05-04 Thread Petr Savicky
On Fri, May 04, 2012 at 11:29:51AM +0200, Kay Cichini wrote: > Hi all, > > how would you test if a sample mean of integers with range -inf;inf is > different from zero: > > # my sample of integers: > c <- c(-3, -1, 0, 1, 0, 3, 4, 10, 12) > > # is mean of c <> 0?: > mean(c) Hi. It is better t

Re: [R] Test if a sample mean of integers with range -inf; inf is different from zero

2012-05-04 Thread R. Michael Weylandt
mean(c) != 0 But if you mean in a statistical sense... t.test() is one possibility. Michael On Fri, May 4, 2012 at 5:29 AM, Kay Cichini wrote: > Hi all, > > how would you test  if a sample mean of integers with range -inf;inf  is > different from zero: > > # my sample of integers: > c <- c(-3,

Re: [R] Test-Predict R survival analysis

2012-04-18 Thread Terry Therneau
On 04/18/2012 05:00 AM, r-help-requ...@r-project.org wrote: Hi, I'm trying to use the R Survival analysis on a windows 7 system. The input data format is described at the end of this mail. 1/ I tried to perform a survival analysis including stratified variables using the following formula. cox.

Re: [R] Test Normality

2012-03-28 Thread Michael Friendly
On 3/27/2012 8:32 PM, Sindy Carolina Lizarazo wrote: Good Night I made different test to check normality and multinormality in my dataset, but I don´t know which test is better. To verify univariate normality I checked: shapiro.test, cvm.test, ad.test, lillie.test, sf.test or jaque.bera.test an

Re: [R] Test Normality

2012-03-28 Thread Eik Vettorazzi
Hi Sindy, you might try Snows penultimate normality test from the TeachingDemos package. But read the help file carefully. http://www.inside-r.org/packages/cran/TeachingDemos/docs/SnowsPenultimateNormalityTest cheers. Am 28.03.2012 02:32, schrieb Sindy Carolina Lizarazo: > Good Night > > I made

Re: [R] test if text is part of vector

2012-01-20 Thread R. Michael Weylandt
; Von: Rainer M Krug >> An: Johannes Radinger >> CC: R-help@r-project.org >> Betreff: Re: [R] test if text is part of vector > >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> On 20/01/12 12:50, Johannes Radinger wrote: >>> Hello,

Re: [R] test if text is part of vector

2012-01-20 Thread Johannes Radinger
Hi, thank you very much... %in% is the operator I was looking for. cheers, johannes Original-Nachricht > Datum: Fri, 20 Jan 2012 13:01:54 +0100 > Von: Rainer M Krug > An: Johannes Radinger > CC: R-help@r-project.org > Betreff: Re: [R] test if text is

Re: [R] test if text is part of vector

2012-01-20 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 20/01/12 12:50, Johannes Radinger wrote: > Hello, > > this is a very simple question: How can I find out if a word is > part of a list of words > > like: a <- "word1" b <- "word4" > > vector <- c("word1","word2","word3") > > I tried it with matc

Re: [R] test if text is part of vector

2012-01-20 Thread Petr PIKAL
Hi > Hello, > > this is a very simple question: > How can I find out if a word is part of a list of words > > like: > a <- "word1" > b <- "word4" > > vector <- c("word1","word2","word3") > > I tried it with match(a,vector) > but this gives the position of the word. > Perhaps a %in% vector

Re: [R] Test Case for Package

2011-10-19 Thread Uwe Ligges
On 19.10.2011 10:13, Vikram Bahure wrote: Hi, I had a query for writing a test case for a package. If we are testing a function then do we need to call that function for testing; library(mypackage)? Is that any circular logic any way. For eg. if I create a package mypackage, can I have a fil

Re: [R] Test for Random Walk and Makov Process

2011-09-03 Thread Ken
For random walk, there are entropy based tests (Robinson 1991), or you could empirically test the hypothesis by generating random normal data with the same mean and standard deviation and looking at the distribution of your quantiles. You could make generic statements also about whether or not t

Re: [R] test if vector contains elements of another vector (disregarding the position)

2011-08-22 Thread Henrique Dallazuanna
Try this: i %in% j * 1 On Mon, Aug 22, 2011 at 12:51 PM, Martin Batholdy wrote: > Hi, > > > I have the following problem: > > > I have two vectors: > > i <- c('a','c','g','h','b','d','f','k','l','e','i') > > j <- c('a', 'b', 'c') > > > > now I would like to generate a vector with the length of i

Re: [R] test if vector contains elements of another vector (disregarding the position)

2011-08-22 Thread R. Michael Weylandt
%in% Here, i %in% j Hope this helps, Michael On Mon, Aug 22, 2011 at 11:51 AM, Martin Batholdy wrote: > Hi, > > > I have the following problem: > > > I have two vectors: > > i <- c('a','c','g','h','b','d','f','k','l','e','i') > > j <- c('a', 'b', 'c') > > > > now I would like to generate a ve

Re: [R] Test if data uniformly distributed (newbie)

2011-06-12 Thread Petr Savicky
On Fri, Jun 10, 2011 at 10:15:36PM +0200, Kairavi Bhakta wrote: > Thanks for your answer. The reason I want the data to be uniform: It's the > first step in a machine learning project I am working on. If I know the data > isn't uniformly distributed, then this means there is probably something > wr

Re: [R] Test if data uniformly distributed (newbie)

2011-06-10 Thread Kairavi Bhakta
Thanks for your answer. The reason I want the data to be uniform: It's the first step in a machine learning project I am working on. If I know the data isn't uniformly distributed, then this means there is probably something wrong and the following steps will be biased by the non-uniform input data

Re: [R] Test if data uniformly distributed (newbie)

2011-06-10 Thread Greg Snow
Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 From: kairavibha...@googlemail.com [mailto:kairavibha...@googlemail.com] On Behalf Of Kairavi Bhakta Sent: Friday, June 10, 2011 2:16 PM To: Greg Snow; r-help@r-project.org Subject: RE: [R] Test if data

Re: [R] Test if data uniformly distributed (newbie)

2011-06-10 Thread Greg Snow
Yes, punif is the function to use, however the KS test (and the others) are based on an assumption of independence, and if you know that your data points sum to 1, then they are not independent (and not uniform if there are more than 2). Also note that these tests only rule out distributions (w

Re: [R] Test for list membership

2011-05-30 Thread Marcin Włodarczak
On 05/30/2011 04:14 PM, Uwe Ligges wrote: On 30.05.2011 15:36, Marcin Wlodarczak wrote: Hi, I need some help with this one: how do I check whether a vector is already present in a list of vectors. I have seen %in% recommended in a similar case but that obviously does not work here. c(1,2,3)

Re: [R] Test for list membership

2011-05-30 Thread Sarah Goslee
You almost solved your own problem with that last statement. Instead of comparing apples and oranges, you need to compare oranges and oranges: > list(c(1,2,3)) %in% list(c(1,2,3), c(4,5,6)) [1] TRUE > list(c(1,2,3)) %in% list(c(1,2,9), c(4,5,6)) [1] FALSE Sarah On Mon, May 30, 2011 at 9:36 AM,

Re: [R] Test for list membership

2011-05-30 Thread Uwe Ligges
On 30.05.2011 15:36, Marcin Wlodarczak wrote: Hi, I need some help with this one: how do I check whether a vector is already present in a list of vectors. I have seen %in% recommended in a similar case but that obviously does not work here. c(1,2,3) %in% list(c(1,2,3), c(4,5,6)) You said

Re: [R] Test for list membership

2011-05-30 Thread Henrique Dallazuanna
Try this: list(c(1,2,3), c(4,5,6)) %in% list(c(1,2,3)) On Mon, May 30, 2011 at 10:36 AM, Marcin Wlodarczak wrote: > > Hi, > > I need some help with this one: how do I check whether a vector is > already present in a list of vectors. > > I have seen %in% recommended in a similar case but that obv

Re: [R] Test for equivalence

2011-02-14 Thread syrvn
Hi! first of all. Thank you all very much for your input. I am sorry but I haven't had yet the time to reply to all of your messages. I will give you a more detailed description of my problem within the next 2 days! Many thanks again. Best, syrvn -- View this message in context: http://r.7896

Re: [R] Test for equivalence

2011-02-14 Thread Albyn Jones
al problem. > > -- > Gregory (Greg) L. Snow Ph.D. > Statistical Data Center > Intermountain Healthcare > greg.s...@imail.org > 801.408.8111 > > > > -Original Message- > > From: Albyn Jones [mailto:jo...@reed.edu] > > Sent: Sunday,

Re: [R] Test for equivalence

2011-02-14 Thread Greg Snow
elp us understand the real problem. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: Albyn Jones [mailto:jo...@reed.edu] > Sent: Sunday, February 13, 2011 9:53 PM > To: Greg Snow > Cc: syrvn

Re: [R] Test for equivalence

2011-02-13 Thread Albyn Jones
testing the null hypothesis of no interaction is not the same as a test of equivalence for the two differences. There is a literature on tests of equivalence. First you must develop a definition of equivalence, for example the difference is in the interval (-a,a). Then, for example, you

Re: [R] Test for equivalence

2011-02-13 Thread Mike Marchywka
> From: greg.s...@imail.org > To: ment...@gmx.net; r-help@r-project.org > Date: Sat, 12 Feb 2011 18:04:34 -0700 > Subject: Re: [R] Test for equivalence > > Does it make sense for you to combine the 2 data sets and do a 2-way anova > with treatment vs. control as one factor

  1   2   >