[R] question about mixtools package

2011-08-18 Thread Dmitrij Kudriavcev
Hello all, May be silly question, but what exactly is beta parameter in functions like regmixEM from mixtools package? I mean, how to determine this beta, if i have a set of metrics for each case? Is there a function for that? I have try to put NULL at this parameter, but function just do not wor

Re: [R] How to count numbers of a vector and use them as index values?from Sabrina

2011-08-18 Thread Dennis Murphy
Hi: Another possibility is > x <- c(2,2,3,3,4,6) > tabulate(x, 8) [1] 0 2 2 1 0 1 0 0 where the second argument of tabulate() allows one to specify the number of bins, in order from 1 up to the specified value, with all others outside that range ignored. HTH, Dennis On Thu, Aug 18, 2011 at 12:

[R] Modeling unusual cyclical trends using dlm

2011-08-18 Thread rsteckel
I'm trying to use the dlm package to model some solar radiation data. There's both a cyclical and a seasonal pattern to the data. The seasonal portion follows a regular pattern and dlm can easily handle this. However, the cyclical pattern is more difficult. Since this is solar radiation data, some

Re: [R] dotchart vs. dotplot ... groups

2011-08-18 Thread Deepayan Sarkar
On Wed, Aug 17, 2011 at 11:59 PM, wrote: > I'm trying to create a dotplot with some grouping. > > I've been able to create what I want using dotchart (basic graphics), but > can't quite get it using dotplot (lattice). I prefer to use lattice (or > ggplot2) because I think it's a bit easier to c

Re: [R] More efficient option to append()?

2011-08-18 Thread Dennis Murphy
Hi: This seems to take a bit less code, avoids explicit loops (by using mapply() instead, where the loops are internal) and takes about 10 seconds on my system: m <- cbind(x = sample(1:15,200, replace=T), y = sample(1:10*1000, 200, replace=T)) sum(m[, 1]) # [1] 16005804 ff <- f

Re: [R] problem deparsing argument

2011-08-18 Thread Bert Gunter
The problem is scope -- the environment in which substitute() looks for x. Try: foo <- function(x){ deparse(substitute(x,env=parent.frame()))} a<-1 foo(a) bar <- function(x)foo(x) bar(a) -- Bert 2011/8/18 David Winsemius : > > On Aug 18, 2011, at 5:11 PM, Ernest Adrogué wrote: > >> Hi, >> >>

Re: [R] splitting sample names

2011-08-18 Thread Henrique Dallazuanna
Try this: transform(xx, Time = gsub(".*_", "", xx$Sample)) On Thu, Aug 18, 2011 at 6:43 PM, 1Rnwb wrote: > I have a data frame like this > xx<-data.frame(cbind(Sample=c('Ctrl_6h','1+0_6h','1+200_6h','1+5k_6h','Ctrl_5K_6h','ConA_6h'), >                 IFIT1=c(24,25,24.7,24.5,24.2,24.8))) > > gre

Re: [R] Little problem with robustbase::covOKG() [?]

2011-08-18 Thread Uwe Ligges
Please do read the posting guide and quote the original message and all others you are referring to. On 18.08.2011 22:28, kv wrote: R. Michael Weylandt Reply | Threaded | More Dear Michael, please explore: ?covOGK yields covOGK(X, n.iter = 2, sigmamu, rcov

Re: [R] splitting sample names

2011-08-18 Thread Jorge I Velez
Sorry for the noise. The code should have been sapply(with(xx, strsplit(as.character(Sample), "_")), "[", 2) instead of what I sent previously. HTH, Jorge On Aug 18, 2011, at 7:30 PM, Jorge I Velez wrote: > Hi Sharad, > > Try > > xx$newSample <- sapply(with(xx, strsplit(as.character(Sampl

Re: [R] Extracting Parts of Array (Index Comparison?)

2011-08-18 Thread David Winsemius
On Aug 18, 2011, at 6:48 PM, teriri wrote: I now know that those numbers to the left can be extracted using rowNames(). So how can I extract elements of B where rowNames = rowNames(A)? B[ rownames(B) %in% rownames(A), ] (Normally I don't answer Nabble Q's without context, but this one is

Re: [R] splitting sample names

2011-08-18 Thread Jorge I Velez
Hi Sharad, Try xx$newSample <- sapply(with(xx, strsplit(as.character(Sample), "_")), "[", 1) xx HTH, Jorge On Aug 18, 2011, at 5:43 PM, 1Rnwb wrote: > I have a data frame like this > xx<-data.frame(cbind(Sample=c('Ctrl_6h','1+0_6h','1+200_6h','1+5k_6h','Ctrl_5K_6h','ConA_6h'), >

Re: [R] splitting sample names

2011-08-18 Thread David Winsemius
On Aug 18, 2011, at 5:43 PM, 1Rnwb wrote: I have a data frame like this xx<- data .frame (cbind (Sample =c('Ctrl_6h','1+0_6h','1+200_6h','1+5k_6h','Ctrl_5K_6h','ConA_6h'), IFIT1=c(24,25,24.7,24.5,24.2,24.8))) grep('[[:digit:]]h',xx$Sample) yy<-xx$Sample strsplit(yy,"_")

Re: [R] problem deparsing argument

2011-08-18 Thread David Winsemius
On Aug 18, 2011, at 5:11 PM, Ernest Adrogué wrote: Hi, I don't know much about R's deparsing "magic", I simply use the deparse(substitute(arg)) trick to get the names of the variables passed as arguments to the function in order to set labels, etc. The problem is that this doesn't work with n

Re: [R] Extracting Parts of Array (Index Comparison?)

2011-08-18 Thread teriri
I now know that those numbers to the left can be extracted using rowNames(). So how can I extract elements of B where rowNames = rowNames(A)? -- View this message in context: http://r.789695.n4.nabble.com/Extracting-Parts-of-Array-Index-Comparison-tp3753792p3753839.html Sent from the R help mail

[R] Extracting Parts of Array (Index Comparison?)

2011-08-18 Thread teriri
Hi all, I have the following issue: head(A): C6 5 6.095243 6 12.622674 7 6.418493 8 11.726602 9 9.282112 25 9.625917 head(B): V1 2 30437 5 1102503 6 1102539 7 1103257 8 1103295 9 1104434 25 1100494 I would like to extract elements from B s

[R] How to count numbers of a vector and use them as index values?from Sabrina

2011-08-18 Thread Sabrina Friedman
Hi Paul, I would use something like this: > x <- c(2,2,3,3,4,6) > table(x) x 2 3 4 6 2 2 1 1 > x <- factor(x, levels=1:8) > table(x) x 1 2 3 4 5 6 7 8 0 2 2 1 0 1 0 0 Sarah On Sun, Jul 31, 2011 at 5:41 PM, Paul Menzel wrote: > Dear R folks, > > > I am sorry to ask this simple question, but my

[R] splitting sample names

2011-08-18 Thread 1Rnwb
I have a data frame like this xx<-data.frame(cbind(Sample=c('Ctrl_6h','1+0_6h','1+200_6h','1+5k_6h','Ctrl_5K_6h','ConA_6h'), IFIT1=c(24,25,24.7,24.5,24.2,24.8))) grep('[[:digit:]]h',xx$Sample) yy<-xx$Sample strsplit(yy,"_") I have to extract the time information separated by '_

[R] problem deparsing argument

2011-08-18 Thread Ernest Adrogué
Hi, I don't know much about R's deparsing "magic", I simply use the deparse(substitute(arg)) trick to get the names of the variables passed as arguments to the function in order to set labels, etc. The problem is that this doesn't work with nested functions. For example, > foo <- function(x) pr

[R] convert a matrix to binaryMatrix in Recommenderlab

2011-08-18 Thread Jing Xi
Does anyone have experience about how to convert a matrix to binaryMatrix using Recommenderlab package? Thanks, Jing [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] Best way/practice to create a new data frame from two given ones with last column computed from the two data frames?

2011-08-18 Thread Marius Hofert
Dear all, okay, I found a one liner based on mutate: (df3 <- mutate(df1, Value=Value[order(Year,Group)] / df2[with(df2, order(Year,Group)),"Value"])) Cheers, Marius On 2011-08-18, at 20:41 , Marius Hofert wrote: > Dear expeRts, > > What is the best approach to create a third data frame from

Re: [R] Comparison of means in survey package

2011-08-18 Thread Thomas Lumley
On Fri, Aug 19, 2011 at 7:25 AM, Simon Kiss wrote: > Dear list colleagues, > I'm trying to come up with a test question for undergraduates to illustrate > comparison of means from a complex survey design. The data for the example > looks roughly like this: > > mytest<-data.frame(harper=rnorm(500

Re: [R] odd behavior of data.matrix()

2011-08-18 Thread Brian Diggs
On 8/18/2011 1:40 PM, Alexander Schwall wrote: Hi R community, I have been trying to figure out why R is reversing the order of rows after I run data.matrix() Here is my data: df<-structure(list(itmID = c(1L, 2L, 1L, 2L, 1L, 2L), variable = structure(c(1L, 1L, 2L, 2L, 3L, 3L), .Label = c("3",

[R] odd behavior of data.matrix()

2011-08-18 Thread Alexander Schwall
Hi R community, I have been trying to figure out why R is reversing the order of rows after I run data.matrix() Here is my data: df<-structure(list(itmID = c(1L, 2L, 1L, 2L, 1L, 2L), variable = structure(c(1L, 1L, 2L, 2L, 3L, 3L), .Label = c("3", "2", "1"), class = "factor"), value = c(0.7,

Re: [R] Little problem with robustbase::covOKG() [?]

2011-08-18 Thread kv
R. Michael Weylandt Reply | Threaded | More Dear Michael, please explore: >?covOGK yields covOGK(X, n.iter = 2, sigmamu, rcov = covGK, weight.fn = hard.rejection, keep.data = FALSE, ...) and >hard.rejection function (distances, p, beta = 0.9

Re: [R] Best way/practice to create a new data frame from two given ones with last column computed from the two data frames?

2011-08-18 Thread Daniel Malter
The "problem" with your first solution is that it relies on that the each 'year x group' combination is present in both data frames. To avoid this, I would recommend to use merge() df3<-merge(df1,df2,by.x=c("Year","Group"),by.y=c("Year","Group")) df3$ratio<-with(df3,Value.x/Value.y) df3 HTH, Dani

Re: [R] Is this a bug for my fault?

2011-08-18 Thread Philipp Pagel
On Thu, Aug 18, 2011 at 04:52:58PM +0700, Rut S wrote: > I tried to recode some complex multiple variables and run into a problem that > r can change only some column that I want to change. > > I can reproduce the problem with this > > idfortest <- c(6,23,46,63,200,238,297,321,336,364,386,392,414

Re: [R] How to use PC1 of PCA and dim1 of MCA as a predictor in logistic regression model for data reduction

2011-08-18 Thread Mark Difford
On Aug 18, 2011 khosoda wrote: > I'm trying to do model reduction for logistic regression. Hi Kohkichi, My general advice to you would be to do this by fitting a penalized logistic model (see lrm in package rms and glmnet in package glmnet; there are several others). Other points are that the a

[R] Comparison of means in survey package

2011-08-18 Thread Simon Kiss
Dear list colleagues, I'm trying to come up with a test question for undergraduates to illustrate comparison of means from a complex survey design. The data for the example looks roughly like this: mytest<-data.frame(harper=rnorm(500, mean=60, sd=1), party=sample(c("BQ", "NDP", "Conservative",

Re: [R] dotchart vs. dotplot ... groups

2011-08-18 Thread Brian Diggs
On 8/17/2011 11:29 AM, mkzo...@comcast.net wrote: I'm trying to create a dotplot with some grouping. I've been able to create what I want using dotchart (basic graphics), but can't quite get it using dotplot (lattice). I prefer to use lattice (or ggplot2) because I think it's a bit easier to con

Re: [R] Using require() vs. library()

2011-08-18 Thread Brian Diggs
On 8/17/2011 11:13 AM, Uwe Ligges wrote: Actually require() is a wrapper around library() with more error handling to be used inside other functions. Just type require(), you can read the few lines of code quickly. I think the unstated corollary is that library() is preferred when not inside a

Re: [R] Using mixed models to analyze Longitudinal intervention

2011-08-18 Thread Daniel Malter
It looks like it. However, you provide very little information. Do you have measurements before and after the intervention and did the intervention occur at the same point in time for all treated? If so, you could do a simple difference in differences estimation. HTH, Daniel Troy S wrote: > > D

[R] Best way/practice to create a new data frame from two given ones with last column computed from the two data frames?

2011-08-18 Thread Marius Hofert
Dear expeRts, What is the best approach to create a third data frame from two given ones, when the new/third data frame has last column computed from the last columns of the two given data frames? ## Okay, sounds complicated, so here is an example. Assume we have the two data frames: df1 <- dat

Re: [R] Concatenate two strings in one in a string matrix

2011-08-18 Thread David Winsemius
On Aug 18, 2011, at 2:35 PM, Eduardo Mendes wrote: Dear R-Users I have the following matrix out$desc [,1][,2] [1,] "" "" [2,] "y_{01}(k-001)" "" [3,] "y_{01}(k-002)" "" [4,] "y_{01}(k-003)" "" [5,] "u_{01}(k-001)" "" [6,] "u_{01}(k-002)" "" [7,] "u_{01}(k-003)"

Re: [R] Concatenate two strings in one in a string matrix

2011-08-18 Thread R. Michael Weylandt
Assuming that the "*" in your [11,] example is a typo, would this work? apply(out$desc,1,paste,collapse="") Hope this helps, Michael Weylandt On Thu, Aug 18, 2011 at 2:35 PM, Eduardo Mendes wrote: > Dear R-Users > > I have the following matrix > > > out$desc [,1][,2] > [1,] "

[R] Concatenate two strings in one in a string matrix

2011-08-18 Thread Eduardo Mendes
Dear R-Users I have the following matrix > out$desc [,1][,2] [1,] "" "" [2,] "y_{01}(k-001)" "" [3,] "y_{01}(k-002)" "" [4,] "y_{01}(k-003)" "" [5,] "u_{01}(k-001)" "" [6,] "u_{01}(k-002)" "" [7,] "u_{01}(k-003)" "" [8,] "y_{01}(k-001)" "y_{01}(k-001)" [9,]

[R] Coding question for behavioral data analysis

2011-08-18 Thread jabroesch
Hello all, I have a question which I have been struggling with for several weeks now, that I think might be easy for more proficient coders than myself. I have a large behavioral dataset, with behaviors and the times (milliseconds) that they occurred. Each subject has a separate file, and a sample

[R] Using mixed models to analyze Longitudinal intervention

2011-08-18 Thread Troy S
Dear R List, I am trying to use mixed models to analyze an intervention and want to make sure I am doing it correctly. The intervention is for lowing cholesterol and there are two groups: one with an intervention and one without. The subjects were evaluated a differing amount of time, so there w

Re: [R] getting names of dimnames of xtabs into xtable latex output

2011-08-18 Thread Juliet Hannah
Thanks to Duncan Mackay and Dennis Murphy for help. The following solution seems to give me what I need. library(memisc) toLatex(ftable(cyl ~ am,data=mtcars)) For this to work, we have to use: \documentclass{article} \usepackage{booktabs} \usepackage{dcolumn} \begin{document} at the beginning

Re: [R] UNC Windows path beginning with backslashes

2011-08-18 Thread Henrik Bengtsson
I think you can also do this from within R (e.g. in your .Rprofile) using the R.utils package; library("R.utils") System$mapDriveOnWindows("K", "campden\\shares\\Workgroup\\Stats") driveLetters <- System$getMappedDrivesOnWindows() System$unmapDriveOnWindows("K") These methods utilize 'subst'

Re: [R] contrast package with interactions in gls model

2011-08-18 Thread Frank Harrell
Thanks. The reason I responded that way is that the error message mentioned a function gendata that is in the rms and Design packages. I guess it's in the contrast package too. Frank MarylinBejarano wrote: > > Hi, > > Sorry! I fited model with gls of nlme package. And I trying to contrast > in

Re: [R] prcomp

2011-08-18 Thread David L Carlson
I think David's idea about NA's was correct. This works: prcomp(na.omit(Chlor1[,-(1:2)]), scale=TRUE) The number of cases drops from 288 to 250. There also three 0's in the dataset that probably should be NA's. -- David L Carlson Texas A&M University C

Re: [R] Convert week value to date

2011-08-18 Thread Gabor Grothendieck
On Wed, Aug 17, 2011 at 4:52 PM, Folkes, Michael wrote: > Hello all, > I'm hoping to convert a decimal value for week of the year back to a date > object. > Eg: > strptime(paste(2010,1:52,sep=" "),format="%Y %W") > > I expected (hoped?) this would give me the date for Monday of each week.   > Ins

Re: [R] interpreting interactions in a model

2011-08-18 Thread gaiarrido
Thanks, I´ve found the differencies with a posteriori tests. I don't put the term month because it is not significant. - Mario Garrido Escudero PhD student Dpto. de Biología Animal, Ecología, Parasitología, Edafología y Qca. Agrícola Universidad de Salamanca -- View this message in context:

Re: [R] contrast package with interactions in gls model

2011-08-18 Thread MarylinBejarano [via R]
Hi, Sorry! I fited model with gls of nlme package. And I trying to contrast interaction with function contrast of contrast package. I thanks for your reply, Regards. Marylin Bejarano __ If you reply to this email, your message will be added to the discussio

[R] Error message: object of type 'closure' is not subsettable

2011-08-18 Thread Newbie
Dear R-users I need to calibrate kappa, rho, eta, theta, v0 in the following code, see below. However when I run it, I get: y <- function(kappahat, rhohat, etahat, thetahat, v0hat) {sum(difference(k, t, S0, X, r, implvol, q, kappahat, rhohat, etahat, thetahat, v0hat)^2)} > nlminb(start=list(kappa

Re: [R] How to use PC1 of PCA and dim1 of MCA as a predictor in logistic regression model for data reduction

2011-08-18 Thread khosoda
Dear Mark, Thank you very much for your mail. This is what I really wanted! I tried dudi.mix in ade4 package. > ade4plaque.df <- x18.df[c("age", "sex", "symptom", "HT", "DM", "IHD", "smoking", "DL", "Statin")] > head(ade4plaque.df) age sex symptom HT DM IHD smoking h

Re: [R] UNC Windows path beginning with backslashes

2011-08-18 Thread Keith Jewell
Just to close this off, in case it helps anyone else in a similar situation... Background: I have R installed on a UNC share with a site library named by major and minor version, thus: \\campden\shares\Workgroup\Stats 'root' \\campden\shares\Workgroup\Stats\R base for R related things \\campden

Re: [R] Convert week value to date

2011-08-18 Thread Folkes, Michael
Thanks David and Duncan, Before I posted I was considering the approach of multiplying week by 7, but I couldn't see a clean way to do it so it'll work for any year, and get Monday's date correct. I now realize I could write code to evaluate which of the first 7 days in the year is a Monday and the

Re: [R] Getting vastly different results when running GLMs

2011-08-18 Thread Michael Dewey
At 16:43 17/08/2011, Luke Duncan wrote: Dear R gurus Response in line below I am analysing data from a study of behaviour and shade utilization of chimpanzees. I am using GLMs in R (version 2.13.0) to test whether shade/sun utilization is predicted by behaviour observed. I am thus interested

[R] Where are the ticks on grid.xaxis?

2011-08-18 Thread David A. Johnston
Hi R list, I like the default ticks that are set up using grid.xaxis() or grid.yaxis() with no arguments. Finding good values for the 'at' argument is usually not a trivial task; the default behavior of these functions seems to work well. The problem with this strategy is that I cannot figure ou

Re: [R] How to get the descriptive statistic of the whole dataframe?

2011-08-18 Thread William Revelle
At 10:31 AM +0200 8/18/11, Petr PIKAL wrote: Hi look into the *apply series of functions. In your case apply(name.of.your.data.frame,2,min) or apply(name.of.your.data.frame,2,max) will do. You can also put any summary function to your liking instead of min/max. And summary has its

Re: [R] queue waiting times comparison

2011-08-18 Thread Gabor Grothendieck
On Thu, Aug 18, 2011 at 10:12 AM, Petr PIKAL wrote: > Hi Jim > >> >> If those values represent response times in a system, then when I was >> responsible for characterizing what the system would do from the >> viewpoint of an SLA (service level agreement) with customers using the >> system, we usu

Re: [R] Selecting subset of factor levels

2011-08-18 Thread Jeff Newmiller
Your expectations of the | operator don't seem fair... you should reread ?"|" and perhaps the "Introduction to R" document. In particular, there is no "between" operator in R. The %in% operator allows you an efficient way to identify any of many specific cases. If you are working with ordered f

Re: [R] Selecting subset of factor levels

2011-08-18 Thread David Winsemius
On Aug 18, 2011, at 10:27 AM, B Jessop wrote: Dear r-help, I would like to select a subset of levels from a factor variable in a data frame and return a data frame. The data set consists of 3 variables, 2 of which are factors (Site, Fish) and one numeric (Datavalue) as follows: Site

[R] Selecting subset of factor levels

2011-08-18 Thread B Jessop
Dear r-help, I would like to select a subset of levels from a factor variable in a data frame and return a data frame. The data set consists of 3 variables, 2 of which are factors (Site, Fish) and one numeric (Datavalue) as follows: Site Fish Datavalue AB 2-12.3 AB

Re: [R] what characteristics of model curve do parameters denote

2011-08-18 Thread Jeff Newmiller
Please refer to the posting guide... This is not a mathematics tutoring list. Your question does not appear to be about R, so no one has responded. --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#. Live Go

Re: [R] too many var in lm

2011-08-18 Thread Eik Vettorazzi
Hi Carol, I unsuccessfully tried to get credits right for the following quote (and they make a lot of fuzz about having citations right around here), so I have to stick with the plain line: "Statistics means never having to say you're certain". Bioconductor has a mailing list on its own, there mig

Re: [R] queue waiting times comparison

2011-08-18 Thread Petr PIKAL
Hi Jim > > If those values represent response times in a system, then when I was > responsible for characterizing what the system would do from the > viewpoint of an SLA (service level agreement) with customers using the > system, we usually specified that "90% of the transactions would have > a

Re: [R] Is this a bug for my fault?

2011-08-18 Thread David Winsemius
On Aug 18, 2011, at 5:52 AM, Rut S wrote: Dear sir/madam, I tried to recode some complex multiple variables and run into a problem that r can change only some column that I want to change. I can reproduce the problem with this idfortest <- c(6,23,46,63,200,238,297,321,336,364,386,392,414

Re: [R] Chi square test on data frame

2011-08-18 Thread R. Michael Weylandt
My reservations about the methodology aside, it's probably not a bad idea to include an error checking line for the case when the probability of the second event is 0 (and so, unsurprisingly, the chi-sq test rejects the null hypothesis) to look at things like the first line: Try this: Y = structu

Re: [R] Is this a bug for my fault?

2011-08-18 Thread jim holtman
you probably want to use %in%: > idfortest <- c(6,23,46,63,200,238,297,321,336,364,386,392,414,434,441) > id <- seq(1:500) > id[id %in% idfortest] [1] 6 23 46 63 200 238 297 321 336 364 386 392 414 434 441 take a look at what 'id == idfortest' gives; study up on the recycling of arguments.

Re: [R] Loop trouble with Excel Serial Numbers!

2011-08-18 Thread jim holtman
You don't need the loop; it was converting back to numeric. Try this: > thedate<-as.matrix(40548:40759,ncol=1) > > exdate<-function(){ + mynewdate<-as.Date(thedate[,1],origin="1899-12-30") + print(mynewdate) + } > exdate() [1] "2011-01-05" "2011-01-06" "2011-01-07" "2011-01-08" "2011-01-09" "

Re: [R] queue waiting times comparison

2011-08-18 Thread jim holtman
If those values represent response times in a system, then when I was responsible for characterizing what the system would do from the viewpoint of an SLA (service level agreement) with customers using the system, we usually specified that "90% of the transactions would have a response time of ---

Re: [R] diptest

2011-08-18 Thread Eik Vettorazzi
you loaded that package as well? library(diptest) ... best. Am 18.08.2011 15:16, schrieb matilde vaghi: > To whom it may concern. > > I d like to do use Hartigan & Hartigan's [1] "dip test" of unimodality via > the diptest package in R, even if I installed the package diptest, it does > not se

Re: [R] How to use PC1 of PCA and dim1 of MCA as a predictor in logistic regression model for data reduction

2011-08-18 Thread Mark Difford
On Aug 18, 2011; Daniel Malter wrote: > Pooling nominal with numeric variables and running pca on them sounds like > conceptual > nonsense to me. Hi Daniel, This is not true. There are methods that are specifically designed to do a PCA-type analysis on mixed categorical and continuous variables

[R] Loop trouble with Excel Serial Numbers!

2011-08-18 Thread Anna Dunietz
Hi All! I'm trying to convert serial numbers in Excel to dates in R. For each single "thedate" entry, I get a correct answer. But if I try using the for loop, I get bizarre numbers in "mynewdata". thedate<-as.matrix(40548:40759,ncol=1) exdate<-function(){ mynewdate<-NULL for(i in 1:nrow(th

[R] Call super methods from inherited classes R.oo

2011-08-18 Thread batnix
Hi R-community, I'm very busy with a software project which I would like to development completely with R.oo. Many of the object oriented aspects that I already know from Java development seems to be in place with this library. But...there is something that I'm really missing... *the super method

Re: [R] R-help Digest, Vol 102, Issue 19

2011-08-18 Thread fraenzi . korner
Wir sind bis am 20. August in den Ferien und werden keine e-mails beantworten. Bei dringenden Fällen melden Sie sich bei Stefanie von Felten steffi.vonfel...@oikostat.ch We are on vacation until 20. August. In urgent cases, please contact Stefanie von Felten steffi.vonfel...@oikostat.ch __

[R] Is this a bug for my fault?

2011-08-18 Thread Rut S
Dear sir/madam, I tried to recode some complex multiple variables and run into a problem that r can change only some column that I want to change. I can reproduce the problem with this idfortest <- c(6,23,46,63,200,238,297,321,336,364,386,392,414,434,441) id <- seq(1:500) id[id==idfortest] the

[R] what characteristics of model curve do parameters denote

2011-08-18 Thread Anna Gretschel
Dear list, I'm trying to fit a chapman-richards equation to my data, only I cannot interpret the parameters a, b and d. I know that the parameter b denotes the asymptote, but for the others I couldn't figure out. But I do need to know this in order to set my starting values. Here's the model: mod

Re: [R] How to use PC1 of PCA and dim1 of MCA as a predictor in logistic regression model for data reduction

2011-08-18 Thread Mark Difford
On Aug 17, 2011 khosoda wrote: > 1. Is it O.K. to perform PCA for data consisting of 1 continuous > variable and 8 binary variables? > 2. Is it O.K to perform transformation of age from continuous variable > to factor variable for MCA? > 3. Is "mjca1$rowcoord[, 1]" the correct values as a pred

[R] diptest

2011-08-18 Thread matilde vaghi
To whom it may concern. I d like to do use Hartigan & Hartigan's [1] "dip test" of unimodality via the diptest package in R, even if I installed the package diptest, it does not seem to find the function. Any help is welcome, thank you. Best wishes -- Matilde [[alternative HTML versio

[R] Odp: what characteristics of model curve do parameters denote

2011-08-18 Thread Petr PIKAL
Hi > > Dear list, > > I'm trying to fit a chapman-richards equation to my data, only I > cannot interpret the parameters a, b and d. I know that the parameter > b denotes the asymptote, but for the others I couldn't figure out. But No. d Is asymptote. You can easily check how the function behive

Re: [R] queue waiting times comparison

2011-08-18 Thread Petr PIKAL
Hallo Jim Thank you and see within text. jim holtman napsal dne 18.08.2011 14:09:11: > I am not sure why you say that "lapply(ml, mean)" shows (incorrectly) > that the second year has a larger average; it is correct for the data: > > > lapply(ml, my.func) > $y1 > Count MeanSD

Re: [R] How to use PC1 of PCA and dim1 of MCA as a predictor in logistic regression model for data reduction

2011-08-18 Thread khosoda
Dear Daniel, Thank you for your mail. Your comment is exactly what I was worried about. I konw very little about latent class analysis. So, I would like to use multiple correspondence analysis (MCA) for data redution. Besides, the first plane of the MCA captured 43% of the variance. Do you t

[R] what characteristics of model curve do parameters denote

2011-08-18 Thread Anna Lee
Dear list, I'm trying to fit a chapman-richards equation to my data, only I cannot interpret the parameters a, b and d. I know that the parameter b denotes the asymptote, but for the others I couldn't figure out. But I do need to know this in order to set my starting values. Here's the model: mod

Re: [R] Constructing an additional key inside of a lattice panel

2011-08-18 Thread Felix Andrews
'corner' is not a valid name for a component of 'legend'. See ?xyplot Try xyplot(1 ~ 1, legend = list(inside = list(fun="draw.key", args = list( key = list( text = list(month.name[1:2]), lines = list(lty = 1:2) ), draw = TRUE ),

Re: [R] queue waiting times comparison

2011-08-18 Thread jim holtman
I am not sure why you say that "lapply(ml, mean)" shows (incorrectly) that the second year has a larger average; it is correct for the data: > lapply(ml, my.func) $y1 Count MeanSD MinMedian 90% 95% Max Sum 18.0 16.8 12.42980 4.0 1

Re: [R] How would you calculate this type of p-value using R?

2011-08-18 Thread Patrick Breheny
On 08/17/2011 12:32 AM, RQuestion wrote: Let's say you want to compare "one observation" with a sample, how would you use R to get a p-value for that single observation itself? This is a rather vague question, but you seem to be describing the calculation of tail probabilities. If, for exampl

[R] queue waiting times comparison

2011-08-18 Thread Petr PIKAL
Hallo all I try to find a way how to compare set of waiting times during different periods. I tried learn something from queueing theory and used also R search. There is plenty of ways but I need to find the easiest and quite simple. Here is a list with actual waiting times. ml <- structure(li

Re: [R] How to change the color of the bar lines of a histogram?

2011-08-18 Thread Paul Smith
That is it, Uwe! Thanks! Paul 2011/8/18 Uwe Ligges : > Read further on and find "border": > > >  hist(rnorm(10), border="yellow") > > > Uwe Ligges > > On 18.08.2011 13:14, Paul Smith wrote: >> >> Dear All, >> >> How to change the color of the bar lines of a histogram? I have read >> >> ?hist >>

Re: [R] Chi square test on data frame

2011-08-18 Thread Uwe Ligges
If your data is d1: temp <- apply(d1[,1:4], 1, order, decreasing=TRUE)[1:2,] temp <- rbind(temp, temp+4) result <- sapply(1:nrow(d1), function(i) chisq.test(matrix(as.matrix(d1[i,temp[,i]]), ncol=2))) Uwe Ligges On 16.08.2011 23:26, Bansal, Vikas wrote: Dear all, I have been working on t

Re: [R] How to change the color of the bar lines of a histogram?

2011-08-18 Thread Jim Lemon
Paul Smith wrote: Dear All, How to change the color of the bar lines of a histogram? I have read ?hist which mentions the parameter 'col', but this one is to configure the color of the bars filling. Hi Paul, If you mean that you are using shading lines instead of color fill, I don't think t

Re: [R] Little problem with robustbase::covOKG() [?]

2011-08-18 Thread R. Michael Weylandt
I have no idea what covOGK is or does, but quickly skimming the code, one can see there is no beta parameter anywhere in it. (In fact, only two lines have a "b" at all; both in substitute().) The error message should have made this clear to you. Try args(covOGK) to see what parameters you are

Re: [R] How to change the color of the bar lines of a histogram?

2011-08-18 Thread Uwe Ligges
Read further on and find "border": hist(rnorm(10), border="yellow") Uwe Ligges On 18.08.2011 13:14, Paul Smith wrote: Dear All, How to change the color of the bar lines of a histogram? I have read ?hist which mentions the parameter 'col', but this one is to configure the color of the bar

[R] How to change the color of the bar lines of a histogram?

2011-08-18 Thread Paul Smith
Dear All, How to change the color of the bar lines of a histogram? I have read ?hist which mentions the parameter 'col', but this one is to configure the color of the bars filling. Thanks in advance, Paul __ R-help@r-project.org mailing list https:/

Re: [R] A question about using getSrcDirectory() with R/Rscript

2011-08-18 Thread Uwe Ligges
Works for me in R-patched: I guess your problem is that you have to set the options() before source()ing. Best, Uwe Ligges On 17.08.2011 10:31, Cormac Long wrote: Good morning R-help, I have an idiot question: I would like to use getSrcDirectory() and friends to allow me to identify wher

Re: [R] multinomRob - error message

2011-08-18 Thread Uwe Ligges
On 17.08.2011 10:42, Danielle Martin wrote: Hi, I would like to use the multinomRob function to test election results. However, depending on which independent variables I include and how many categories I have in the dependent variable, the model cannot be estimated. My data look like this (t

Re: [R] Constructing an additional key inside of a lattice panel

2011-08-18 Thread Fredrik Karlsson
Dear Deepayan, Thank you for your quick and enlightening reply. I'll try making a modifies version of the two functions and see what I end up with.. However, out of pure curiosity, what is wrong with the "legend" I constructed below: legend=list(corner=list( f

Re: [R] igraph - designing graph plot by attributes

2011-08-18 Thread Gábor Csárdi
Create a factor variable for the different age categories, see cut(). Then use as.integer() on the factor variable and index a vector of node sizes with it. E.g. g <- graph.ring(10) V(g)$age <- sample(20:78, vcount(g), replace=TRUE) V(g)$agecat <- cut(V(g)$age, breaks = c(20,35,50,65,78)) V(g)$siz

Re: [R] matrix into vector with vertex names

2011-08-18 Thread Gábor Csárdi
Joe, what is melt() supposed to do here? What's wrong with the simple solution of creating a data.frame first, and then filling it with values through a loop? Actually, keeping the matrix is just as good, indexing is just as fast, and takes the same amount of memory as your three column matrix, d

Re: [R] matrix indexing (igraph ?)

2011-08-18 Thread Gábor Csárdi
This is not an igraph issue, I believe. You need to go over your indices and update the matrix, i.e. for (i in seq_along(t.list)) { temp[t.list[i], c.list[i]] <- temp[t.list[i], c.list[i]] + 1 } Best, Gabor On Tue, Aug 2, 2011 at 4:50 PM, Robinson, David G wrote: > I realize that matrix indexin

[R] Little problem with robustbase::covOKG() [?]

2011-08-18 Thread kv
dear all, assume you type: covOGK(x,sigmamu=s_Qn,beta=h) you get: Error in Qn(x, ...) : unused argument(s) (beta = 0.552325581395349) i wanted to set the \beta in OGK to a different value-- Is it normal? Best, -- View this message in context: http://r.789695.n4.nabble.com/Little-problem-wit

[R] Fwd: Interpreting parameters of sigmoid fct

2011-08-18 Thread Anna Lee
Dear list, I'm trying to fit a chapman-richards equation to my data, only I cannot interpret the parameters a, b and d. I know that the parameter b denotes the asymptote, but for the others I couldn't figure out. But I do need to know this in order to set my starting values. Here's the model: mod

Re: [R] a question about lm on t-test.

2011-08-18 Thread Daniel Malter
I should have written "the standard errors of the coefficients are the SQUARE ROOT of the diagonal entries of the variance-covariance matrix," as I programmed it in the code. Daniel Malter wrote: > > Pick up a book or the like on ordinary least squares regression, which is > what lm() in its pla

Re: [R] How to use PC1 of PCA and dim1 of MCA as a predictor in logistic regression model for data reduction

2011-08-18 Thread Daniel Malter
Pooling nominal with numeric variables and running pca on them sounds like conceptual nonsense to me. You use PCA to reduce the dimensionality of the data if the data are numeric. For categorical data analysis, you should use latent class analysis or something along those lines. The fact that your

Re: [R] How to get the descriptive statistic of the whole dataframe?

2011-08-18 Thread Petr PIKAL
Hi > > look into the *apply series of functions. In your case > > apply(name.of.your.data.frame,2,min) > > or > > apply(name.of.your.data.frame,2,max) > > will do. You can also put any summary function to your liking instead of > min/max. And summary has its own data frame method so simply

[R] Odp: how to analysis a dataset with some missing value?

2011-08-18 Thread Petr PIKAL
Hi > > my qustion is if my miss value in my dataset is - > for example : > 1 3 21 33 - 23 33 - > how can I plot or analysis this dataset ignoring the missing value ? thanks > . Use NA instead of - and things will get better x<-as.numeric(read.table(textConnection("1 3 21 33

Re: [R] a question about lm on t-test.

2011-08-18 Thread Eik Vettorazzi
That is a speciality of your model - it is actually an ANOVA-model (with 2 groups). Even so the variance of the intercept is estimated from the whole sample, not only for group==1 (thats why the statistics and p-values differ) - and that analysis is equivalent to a t-test with common variance (aka

Re: [R] a question about lm on t-test.

2011-08-18 Thread Daniel Malter
Pick up a book or the like on ordinary least squares regression, which is what lm() in its plain vanilla application does. The t-value is the estimated coefficient divided by the standard error. The standard errors of the coefficients are the diagonal entries of the variance-covariance matrix. x<

  1   2   >