Re: [R] question: ragged array

2011-10-16 Thread Weidong Gu
if you set parameter simplify=TRUE, it returns a vector of the ragged mean. In your case, mean_rating - tapply(ratok$value, ratok$project_id , mean,simplify = TRUE) df-data.frame(ID=dimnames(mean_rating)[[1]], mean=mean_rating) Weidong Gu On Sun, Oct 16, 2011 at 9:53 AM, Helene Schreyer

Re: [R] question: ragged array

2011-10-16 Thread Dennis Murphy
Hi: Try this: ratok - data.frame(Id = rep(1:3, 3:1), value = c(2, 3, 4, 2, 1, 5)) aggregate(value ~ Id, data = ratok, FUN = mean) Id value 1 1 3.0 2 2 1.5 3 3 5.0 aggregate() returns a data frame with the Id variable and mean(value). HTH, Dennis On Sun, Oct 16, 2011 at 6:53 AM,

Re: [R] Question about GAMs

2011-10-14 Thread pigpigmeow
pre-predict(ozonea,groupA,type=terms,terms=NULL,newdata.guaranteed=FALSE,na.action=na.pass) yeah! but I don't know how to only show the value of s(ratio,bs=cr) -- View this message in context: http://r.789695.n4.nabble.com/Question-about-GAMs-tp3900848p3903753.html Sent from the R help mailing

Re: [R] Question about GAMs

2011-10-14 Thread Simon Wood
predict.gam is returning a matrix with a named column for each term. Select the appropriate column. Example below library(mgcv) n-200;sig - 2 dat - gamSim(1,n=n,scale=sig) b - gam(y~s(x0)+s(I(x1^2))+s(x2)+offset(x3),data=dat) newd -

[R] Question about GAMs

2011-10-13 Thread pigpigmeow
hi! I hope all of you can help me this question for example GAMs: ozonea-gam(newozone~ pressure+maxtemp+s(avetemp,bs=cr)+s(ratio,bs=cr),family=gaussian (link=log),groupA,methods=REML) formula(ozonea) newozone ~ pressure + maxtemp + s(avetemp, bs = cr) + s(ratio,bs = cr) #formula of gams

Re: [R] Question about GAMs

2011-10-13 Thread Daniel Malter
I am not an expert on this, but there is a way to check this. You can predict from a gam using predict(ozonea, newdata=...). In the newdata argument you can specify the X-values of interest to you. Thus, you can compare if your predictions are the same when predicted directly from the gam or when

Re: [R] Question about GAMs

2011-10-13 Thread Simon Wood
I'd be inclined to use predict(ozonea,type=terms) to extract the estimates of s(ratio,bs = cr) that you need. But do you really want newozone - s(ratio,bs=cr) when you've used a log link? best, Simon On 10/13/2011 09:05 AM, pigpigmeow wrote: hi! I hope all of you can help me this question

Re: [R] Question about GAMs

2011-10-13 Thread pigpigmeow
I'm confused... I type .. predict.gam(ozonea,type=s(ratio,bs=cr)) pressure maxtemp s(avetemp) s(ratio) 1 -0.0459102290 -0.185178463 0.263358446 -0.164558673 2 -0.0286464652 -0.194731320 0.199315027 0.727823293 30.0478073459 -0.013227033 0.002228896 0.342373202 4

Re: [R] Question about GAMs

2011-10-13 Thread Gavin Simpson
On Thu, 2011-10-13 at 08:20 -0700, pigpigmeow wrote: I'm confused... I type .. predict.gam(ozonea,type=s(ratio,bs=cr)) That is not a valid 'type'; normally you'd use `type = terms` or `type = iterms`, depending on whether you want (any) standard errors to include the uncertainty about the

Re: [R] Question about GAMs

2011-10-13 Thread David Winsemius
On Oct 13, 2011, at 11:20 AM, pigpigmeow wrote: I'm confused... I type .. predict.gam(ozonea,type=s(ratio,bs=cr)) pressure maxtemp s(avetemp) s(ratio) 1 -0.0459102290 -0.185178463 0.263358446 -0.164558673 2 -0.0286464652 -0.194731320 0.199315027 0.727823293 3

[R] Question: Self selection bias and censoring in R

2011-10-13 Thread Mary Swinson
Hi All, I am a relative newbie to R and have the following problem I was trying to solve. I had taken a look at the 'sample selection' package but was having trouble applying it to my use case and was wondering if anyone out there had done something similar and could share code or

Re: [R] question about string to boor?

2011-10-11 Thread song_gpqg
Thanks guys, that's a great help. Nellie -- View this message in context: http://r.789695.n4.nabble.com/question-about-string-to-boor-tp3890983p3894996.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Question about ggplot2 and stat_smooth

2011-10-10 Thread Dylan Beaudette
for the 'boxplots' using 5%, 25%,75%, 95% limits as we have with the 'boxplots'. Tom - Original Message - From: Hadley Wickham had...@rice.edu Date: Tuesday, October 4, 2011 10:23 am Subject: Re: [R] Question about ggplot2 and stat_smooth To: Thomas Adams thomas.ad...@noaa.gov

[R] question about string to boor?

2011-10-10 Thread song_gpqg
Hello! So I am handling this problem with some arrays grp1-grp7, I want to write a loop to avoid tedious work, but I don't know how to transform string to boor? For example I used i=1 paste(grp,i, sep=) I only got grp1 instead of grp1, which can't be manipulate using mean() or other function.

Re: [R] question about string to boor?

2011-10-10 Thread David Winsemius
On Oct 10, 2011, at 12:52 PM, song_gpqg wrote: Hello! So I am handling this problem with some arrays grp1-grp7, I want to write a loop to avoid tedious work, but I don't know how to transform string to boor? For example I used i=1 paste(grp,i, sep=) ?get e.g. get( paste(grp,i, sep=) )

Re: [R] question about string to boor?

2011-10-10 Thread Christoph Molnar
Hi Nellie, hope I got you right. I guess you want something like that. for (i in 1:7) { oneOfNelliesArray - eval(parse(text=paste(grp,i, sep=))) anyFunction(oneOfNelliesArray) } Paste() just returns you a string. But you want R to evaluate the expression. So you have to parse it and tell

Re: [R] question about string to boor?

2011-10-10 Thread Rolf Turner
On 11/10/11 08:21, Christoph Molnar wrote: Hi Nellie, hope I got you right. I guess you want something like that. for (i in 1:7) { oneOfNelliesArray- eval(parse(text=paste(grp,i, sep=))) anyFunction(oneOfNelliesArray) } Paste() just returns you a string. But you want R to evaluate the

Re: [R] Question about ggplot2 and stat_smooth

2011-10-06 Thread Thomas Adams
Dennis Hadley, This does exactly what I need — thank you so much! Regards, Tom On 10/4/11 5:34 PM, Dennis Murphy wrote: Hi Hadley: When I tried your function on the example data, I got the following: dd- data.frame(year = rep(2000:2008, each = 500), y = rnorm(4500)) g- function(df, qs =

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Hadley Wickham
On Mon, Oct 3, 2011 at 12:24 PM, Thomas Adams thomas.ad...@noaa.gov wrote:  I'm interested in creating a graphic -like- this: c - ggplot(mtcars, aes(qsec, wt)) c + geom_point() + stat_smooth(fill=blue, colour=darkblue, size=2, alpha = 0.2) but I need to show 2 sets of bands (with different

[R] Question about linear mixed effects model (nlme)

2011-10-04 Thread Panagiotis
Hi, I applied a linear mixed effect model in my data using the nlme package. lme2-lme(distance~temperature*condition, random=~+1|trial, data) and then anova. I want to ask if it is posible to get the least squares means for the interaction effect and the corresponding 95%ci. And then plot this

Re: [R] Question about linear mixed effects model (nlme)

2011-10-04 Thread Bert Gunter
Below. On Tue, Oct 4, 2011 at 7:34 AM, Panagiotis p...@hi.is wrote: Hi, I applied a linear mixed effect model in my data using the nlme package. lme2-lme(distance~temperature*condition, random=~+1|trial, data) and then anova. I want to ask if it is posible to get the least squares means

Re: [R] Question about linear mixed effects model (nlme)

2011-10-04 Thread Ben Bolker
Bert Gunter gunter.berton at gene.com writes: Below. On Tue, Oct 4, 2011 at 7:34 AM, Panagiotis pat2 at hi.is wrote: Hi, I applied a linear mixed effect model in my data using the nlme package. lme2-lme(distance~temperature*condition, random=~+1|trial, data) and then anova. I

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Thomas . Adams
where I can specify the limits calculated for the 'boxplots' using 5%, 25%,75%, 95% limits as we have with the 'boxplots'. Tom - Original Message - From: Hadley Wickham had...@rice.edu Date: Tuesday, October 4, 2011 10:23 am Subject: Re: [R] Question about ggplot2 and stat_smooth To: Thomas

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Dennis Murphy
...@rice.edu Date: Tuesday, October 4, 2011 10:23 am Subject: Re: [R] Question about ggplot2 and stat_smooth To: Thomas Adams thomas.ad...@noaa.gov Cc: R-help forum r-help@r-project.org On Mon, Oct 3, 2011 at 12:24 PM, Thomas Adams thomas.ad...@noaa.gov wrote:  I'm interested in creating

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Hadley Wickham
# Function to compute quantiles and return a data frame g - function(d) {   qq - as.data.frame(as.list(quantile(d$y, c(.05, .25, .50, .75, .95   names(qq) - paste('Q', c(5, 25, 50, 75, 95), sep = '')   qq   } You could cut out the melt step by making this return a data frame: g -

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Dennis Murphy
Hi Hadley: When I tried your function on the example data, I got the following: dd - data.frame(year = rep(2000:2008, each = 500), y = rnorm(4500)) g - function(df, qs = c(.05, .25, .50, .75, .95)) { data.frame(q = qs, quantile(d$y, qs)) } ddply(dd, .(year), g) ddply(dd, .(year), g) year

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Thomas Adams
the limits calculated for the 'boxplots' using 5%, 25%,75%, 95% limits as we have with the 'boxplots'. Tom - Original Message - From: Hadley Wickhamhad...@rice.edu Date: Tuesday, October 4, 2011 10:23 am Subject: Re: [R] Question about ggplot2 and stat_smooth To: Thomas Adamsthomas.ad

[R] Question about ggplot2 and stat_smooth

2011-10-03 Thread Thomas Adams
I'm interested in creating a graphic -like- this: c - ggplot(mtcars, aes(qsec, wt)) c + geom_point() + stat_smooth(fill=blue, colour=darkblue, size=2, alpha = 0.2) but I need to show 2 sets of bands (with different shading) using 5%, 25%, 75%, 95% limits that I specify and where the heavy

Re: [R] Question about ggplot2 and stat_smooth

2011-10-03 Thread Dennis Murphy
Hi: I would think that, at least in principle, this should work: a - ggplot(mtcars, aes(qsec, wt)) a + geom_point() + stat_smooth(fill=blue, colour=darkblue, size=2, level = 0.9, alpha = 0.2) + stat_smooth(fill = 'blue', colour = 'darkblue', size = 2,

Re: [R] Question about ggplot2 and stat_smooth

2011-10-03 Thread Thomas Adams
Andrés, Thank you for your help, but that does not capture what I'm looking for. I need to be able to control the shaded bound limits and they need to be coincident. Tom On 10/3/11 3:37 PM, Andrés Aragón wrote: Hi, Try some like this: c- ggplot(mtcars, aes(qsec, mpg, colour=factor(cyl)))

Re: [R] Question about ggplot2 and stat_smooth

2011-10-03 Thread Andrés Aragón
Hi, Try some like this: c - ggplot(mtcars, aes(qsec, mpg, colour=factor(cyl))) c + stat_smooth(aes(group=cyl))+stat_smooth(aes(fill=factor(cyl)))+geom_point() Andrés AM 2011/10/3, Thomas Adams thomas.ad...@noaa.gov: I'm interested in creating a graphic -like- this: c - ggplot(mtcars,

Re: [R] Question concerning Box.test

2011-09-28 Thread R. Michael Weylandt
*An:* Samir Benzerfa; r-help *Betreff:* Re: [R] Question concerning Box.test ** ** Plaintext data looks like this: P - structure(list(X77.BANK = c(0, 0, 0, 0.003181659, -0.006386799, 0.028028724, -0.015347692, -0.015910002, 0.00322897, -0.013062473, 0, -0.03809005, 0.021189299

[R] Question concerning Box.test

2011-09-27 Thread Samir Benzerfa
Hi everyone, I've got a question concerning the function Box.test for testing autocorrelation in my data. My data consist of (daily) returns of several stocks over time (first row=time, all other rows=stock returns). I intend to perform a Box-Ljung test for my returns (for each stock).

Re: [R] Question concerning Box.test

2011-09-27 Thread R. Michael Weylandt
Did you try regular apply? If you have univariate input, there's no reason to use the multivariate mapply. Or more generally: apply(P[-1,],1,function(p) Box.test(p)$p.value) Michael On Tue, Sep 27, 2011 at 4:45 AM, Samir Benzerfa benze...@gmx.ch wrote: Hi everyone, I've got a question

Re: [R] Question concerning Box.test

2011-09-27 Thread R. Michael Weylandt
Weylandt [mailto:michael.weyla...@gmail.com] *Gesendet:* Dienstag, 27. September 2011 13:12 *An:* Samir Benzerfa *Cc:* r-help@r-project.org *Betreff:* Re: [R] Question concerning Box.test ** ** Did you try regular apply? If you have univariate input, there's no reason to use

Re: [R] Question concerning Box.test

2011-09-27 Thread R. Michael Weylandt
and columns. Actually, I want to perform the test for each column and not row. ** ** *Von:* R. Michael Weylandt [mailto:michael.weyla...@gmail.com] *Gesendet:* Dienstag, 27. September 2011 17:51 *An:* Samir Benzerfa; r-help *Betreff:* Re: [R] Question concerning Box.test

[R] Question about syntax in lm function

2011-09-25 Thread 阮铮
I encounters some codes in ggplot2 manual and confused with one of its lm syntax. The code is here: library(ggplot2) d - subset(diamonds, carat 2.5 rbinom(nrow(diamonds), 1, 0.2) == 1) d$lcarat - log10(d$carat) d$lprice - log10(d$price) detrend - lm(lprice ~ lcarat, data = d) d$lprice2 -

Re: [R] Question about syntax in lm function

2011-09-25 Thread Ben Bolker
阮铮 rz1991 at foxmail.com writes: I encounters some codes in ggplot2 manual and confused with one of its lm syntax. [snip] mod - lm(lprice2 ~ lcarat * color, data = d) # *** what puzzled me is the last statement marked with ***. How does R deal with lcarat * color, since color is not of

Re: [R] question concerning the acf function

2011-09-20 Thread Jean-Christophe BOUËTTÉ
. Do you understand my intention? THX, SB -Ursprüngliche Nachricht- Von: Jean-Christophe BOUËTTÉ [mailto:jcboue...@gmail.com] Gesendet: Freitag, 16. September 2011 17:31 An: Samir Benzerfa Cc: r-help@r-project.org Betreff: Re: [R] question concerning the acf function Hi Samir

[R] question, minimize quadratic form

2011-09-19 Thread Sai Tong
I have a question about what is the best function or package to use to do the following in R: minimize Q = g W g' where respect to \gamma where g is n x 1 vector, W is a n x n matrix and is given, and g = 1 / T * sum_from_i=1_to_1=60 [ (1-R[i+1] * ( E[i+1]/E[i ] )^(\gamma) ) ]

Re: [R] question about glm vs. loglin()

2011-09-17 Thread Ted Harding
On 17-Sep-11 01:20:53, Rolf Turner wrote: On 17/09/11 01:19, Michael Friendly wrote: SNIP Trying to interpret associations in complex loglinear models from tables of parameter estimates is like trying to extract sunlight from a cucumber. You have to squeeze very hard, and then are

[R] question concerning the acf function

2011-09-16 Thread Samir Benzerfa
Hi everyone, I've got a question concerning the function acf(.) in R for calculating the autocorrelation in my data. I have a table with daily returns of several stocks over time and I would like to calculate the autocorrelation for all the series (not only for one time series). How can I

Re: [R] question about glm vs. loglin()

2011-09-16 Thread Michael Friendly
Hi Yana Trying to interpret associations in complex loglinear models from tables of parameter estimates is like trying to extract sunlight from a cucumber. You have to squeeze very hard, and then are usually unhappy with the quality of the sunlight. Instead, you can visualize the

Re: [R] question concerning the acf function

2011-09-16 Thread Jean-Christophe BOUËTTÉ
Hi, you did not supply a reproducible example. We do not know what your data nor your code looks like. Please follow the recommandations found at the bottom of this email! You're more likely to get a quick and meaningful reply. JC 2011/9/16 Samir Benzerfa benze...@gmx.ch: Hi everyone, I've

Re: [R] question concerning the acf function

2011-09-16 Thread R. Michael Weylandt
Would not something like V = apply(P,2,acf, plot=FALSE) V = sapply(V,`[[`,acf) work? I'm pretty sure acf() doesn't return any sort of residuals so you'll have to calculate those on your own. Hope this helps, Michael Weylandt On Fri, Sep 16, 2011 at 9:20 AM, Jean-Christophe BOUËTTÉ

Re: [R] question concerning the acf function

2011-09-16 Thread Jean-Christophe BOUËTTÉ
Benzerfa Cc: r-help@r-project.org Betreff: Re: [R] question concerning the acf function Hi, you did not supply a reproducible example. We do not know what your data nor your code looks like. Please follow the recommandations found at the bottom of this email! You're more likely to get a quick

[R] Question about permutation test

2011-09-16 Thread song_gpqg
Hi! I am doing a permutation test on 7 data randomly selected into two groups, one has 4 and the other 3. The purpose is to list all the 35 possible outcomes and calculate p-value. I googled the function perm.test() and not sure if my usage is correct. So I set a=c(7 data), b=(1,1,1,1,2,2,2)

Re: [R] Question about permutation test

2011-09-16 Thread csrabak
Hope you don't find this a rethorical question, but why did you prefer to google the function instead of reading the fine manual? Em 16/9/2011 16:07, song_gpqg escreveu: Hi! I am doing a permutation test on 7 data randomly selected into two groups, one has 4 and the other 3. The purpose is to

Re: [R] question about glm vs. loglin()

2011-09-16 Thread Rolf Turner
On 17/09/11 01:19, Michael Friendly wrote: SNIP Trying to interpret associations in complex loglinear models from tables of parameter estimates is like trying to extract sunlight from a cucumber. You have to squeeze very hard, and then are usually unhappy with the quality of the sunlight.

[R] question about glm vs. loglin()

2011-09-15 Thread Yana Kane-Esrig
Dear R gurus, I am looking for a way to fit a predictive model for a contingency table which has counts. I found that glm( family=poisson) is very good for figuring out which of several alternative models I should select. But once I select a model it is hard to present and interpret it,

Re: [R] question about glm vs. loglin()

2011-09-15 Thread David Winsemius
On Sep 15, 2011, at 4:33 PM, Yana Kane-Esrig wrote: Dear R gurus, I am looking for a way to fit a predictive model for a contingency table which has counts. I found that glm( family=poisson) is very good for figuring out which of several alternative models I should select. But once I

[R] Question regarding dnorm()

2011-09-14 Thread Vincy Pyne
Hi, I have one basic doubt. Suppose X ~ N(50,10). I need to calculate Probability X = 50. dnorm(50, 50, 10) gives me [1] 0.03989423 My understanding is (which is bit statistical or may be mathematical) on a continuous scale, Probability of the type P(X = .) are nothing but 1/Infinity

Re: [R] Question regarding dnorm()

2011-09-14 Thread S Ellison
-project.org] On Behalf Of Vincy Pyne Sent: 14 September 2011 12:24 To: r-help@r-project.org Subject: [R] Question regarding dnorm() Hi, I have one basic doubt. Suppose X ~ N(50,10). I need to calculate Probability X = 50. dnorm(50, 50, 10) gives me [1] 0.03989423 My understanding is (which

Re: [R] Question regarding dnorm()

2011-09-14 Thread Vincy Pyne
Ellison and Mr Mark for your guidance. Regards Vincy --- On Wed, 9/14/11, S Ellison s.elli...@lgcgroup.com wrote: From: S Ellison s.elli...@lgcgroup.com Subject: RE: [R] Question regarding dnorm() To: Vincy Pyne vincy_p...@yahoo.ca, r-help@r-project.org r-help@r-project.org Received: Wednesday

[R] Question on reading nodes info from all random forests generated trees

2011-09-12 Thread k
Hi All, I have a quick question on random forests. Simply, I am not sure how to read the values of independent variables related to the highest value of a response variable from all trees generated from random forests. It is easy to do this in a single regression tree. But I am not clear how

[R] Question about plot.mona {cluster}

2011-09-09 Thread trekvana
Hello all, I what to print the banner plot that is output from the mona method in the cluster package but the problem is I dont want to print all that red ink. Here is an example: data(animals) ma - mona(animals) ma ## Plot similar to Figure 10 in Struyf et al (1996) plot(ma) I can change the

Re: [R] Question about plot.mona {cluster}

2011-09-09 Thread Dennis Murphy
Hi: Here are a couple of ways to do this. The barplot() attempt is pretty close to the original banner plot except that the color is transparent to the (white) background. The ggplot2 graph is similar, but the code may be less familiar if you don't use the package. In the latter, the variable

Re: [R] Question about model selection for glm -- how to select features based on BIC?

2011-09-08 Thread Jean V Adams
If you read the help file on the step() function ?step you will see a reference to BIC under the description of the k= argument. This suggests that you could try: BIC.fitted = step(glm.fit, k=log(dim(dat)[1])) Jean Andra Isan wrote on 09/07/2011 06:12:19 PM: Hi All, After

[R] Question about model selection for glm -- how to select features based on BIC?

2011-09-07 Thread Andra Isan
Hi All,  After fitting a model with glm function, I would like to do the model selection and select some of the features and I am using the step function as follows:  glm.fit - glm (Y ~ . , data = dat, family = binomial(link=logit)) AIC_fitted = step(glm.fit, direction = both) I was wondering is

[R] Question about Natural Splines (ns function)

2011-09-06 Thread Axel Urbiz
Hi - How can I 'manually' reproduce the results in 'pred1' below? My attempt is pred_manual, but is not correct. Any help is much appreciated. library(splines) set.seed(12345) y - rgamma(1000, shape =0.5) age - rnorm(1000, 45, 10) glm1 - glm(y ~ ns(age, 4), family=Gamma(link=log)) dd -

Re: [R] Question about Natural Splines (ns function)

2011-09-06 Thread David Winsemius
On Sep 6, 2011, at 5:08 PM, Axel Urbiz wrote: Hi - How can I 'manually' reproduce the results in 'pred1' below? Well, not by constructing the prediction function from a different data basis that the glm function gets. My attempt is pred_manual, but is not correct. Any help is much

Re: [R] question with uniroot function

2011-09-04 Thread Carl Witthoft
As others will tell you: you need to provide a reproducible example. What are p1, u1, u2 ? quote Dear all, I have the following problem with the uniroot function. I want to find roots for the fucntion Fp2 which is defined as below. Fz -

[R] question with uniroot function

2011-09-03 Thread li li
Dear all, I have the following problem with the uniroot function. I want to find roots for the fucntion Fp2 which is defined as below. Fz - function(z){0.8*pnorm(z)+p1*pnorm(z-u1)+(0.2-p1)*pnorm(z-u2)} Fp - function(t){(1-Fz(abs(qnorm(1-(t/2)+(Fz(-abs(qnorm(1-(t/2)} Fp2 -

Re: [R] question with uniroot function

2011-09-03 Thread li li
Dear all, I forgot to mention the values for the parameters in the first email. u1 - -3 u2 - 4 alpha - 0.05 p1 - 0.15 Thank you very much. 2011/9/3 li li hannah@gmail.com Dear all, I have the following problem with the uniroot function. I want to find roots for the fucntion

Re: [R] question with uniroot function

2011-09-03 Thread Uwe Ligges
On 03.09.2011 18:31, li li wrote: Dear all, I forgot to mention the values for the parameters in the first email. u1- -3 u2- 4 alpha- 0.05 p1- 0.15 Thank you very much. 2011/9/3 li lihannah@gmail.com Dear all, I have the following problem with the uniroot function. I want

Re: [R] Question about BIC of two different regression models? how should we compare two regression models?

2011-09-02 Thread Ben Bolker
a stats and not an R question; (b) it might be a good idea to review a stats text, or even http://en.wikipedia.org/wiki/Bayesian_information_criterion , since this is a pretty basic question. __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] Question about BIC of two different regression models? how should we compare two regression models?

2011-09-02 Thread John Sorkin
. stats.stackexchange.com), since it's a stats and not an R question; (b) it might be a good idea to review a stats text, or even http://en.wikipedia.org/wiki/Bayesian_information_criterion , since this is a pretty basic question. __ R-help@r-project.org

Re: [R] Question about BIC of two different regression models? how should we compare two regression models?

2011-09-02 Thread Patrick Breheny
On 09/02/2011 08:48 AM, John Sorkin wrote: I believe when using BIC one needs to compare nested models This is wrong. Hypothesis tests rely on nested models; information criteria do not. -- Patrick Breheny Assistant Professor Department of Biostatistics Department of Statistics University

Re: [R] Question about BIC of two different regression models? how should we compare two regression models?

2011-09-02 Thread Prof Brian Ripley
On Fri, 2 Sep 2011, Patrick Breheny wrote: On 09/02/2011 08:48 AM, John Sorkin wrote: I believe when using BIC one needs to compare nested models This is wrong. Hypothesis tests rely on nested models; information criteria do not. Actually, this is off-topic on this list. But blanket

Re: [R] Question about BIC of two different regression models? how should we compare two regression models?

2011-09-02 Thread Bert Gunter
Inline: On Fri, Sep 2, 2011 at 8:09 AM, Patrick Breheny patrick.breh...@uky.edu wrote: On 09/02/2011 08:48 AM, John Sorkin wrote: I believe when using BIC one needs to compare nested models This is wrong.  Hypothesis tests rely on nested models; information criteria do not. Yes, indeed.

Re: [R] Question about BIC of two different regression models? how should we compare two regression models?

2011-09-02 Thread Patrick Breheny
On 09/02/2011 11:26 AM, Prof Brian Ripley wrote: This is wrong. Hypothesis tests rely on nested models; information criteria do not. Actually, this is off-topic on this list. But blanket statements are often themselves untrue: there are hypothesis tests of non-nested models (most famously due

[R] Question about BIC of two different regression models? how should we compare two regression models?

2011-09-01 Thread Andra Isan
Hi All,  In order to compare two different logistic regressions, I think I need to compare them based on their BIC values, but I am not sure if the smaller BIC would mean a better model or the reverse is true? Thanks a lot,Andra [[alternative HTML version deleted]]

[R] Question about paste

2011-08-30 Thread Andra Isan
Hello All,  I have a data frame called train.data which has 100 columns. I am using an statistical package to learn a model and the format of using that package is as follows: ex5 - stepFlexmix(cbind(y,1-y)~x|id2, data=NPreg, k=2, model=FLXMRglm(family=binomial), nrep=5) the

Re: [R] R question: generating data using MASS

2011-08-29 Thread Ben Bolker
uf_mike michael.parent at ufl.edu writes: Hi, all! I'm new to R but need to use it to solve a little problem I'm having with a paper I'm writing. The question has a few components and I'd appreciate guidance on any of them. 1. The most essential thing is that I need to generate some

Re: [R] question on silhouette colours

2011-08-29 Thread Martin Maechler
Gordon Robertson grobert...@bcgsc.ca on Wed, 24 Aug 2011 22:21:22 -0700 writes: I'm fairly new to the silhouette functionality in the cluster package, so apologize if I'm asking something naive. If I run the 'agnes(ruspini)' example from the silhouette section of the

Re: [R] R question: generating data using MASS

2011-08-29 Thread Michael Parent
Thanks! This problem isn't uniquely defined. Are you willing to generate more samples than you need and then throw away extreme values? Or do you want to 'censor' extreme values (i.e. set values = 1 to 1 and values =7 to 7)? I'd like the retain a normal distribution so I wouldn't want to

Re: [R] R question: generating data using MASS

2011-08-29 Thread Ben Bolker
Michael Parent michael.parent at ufl.edu writes: Thanks! This problem isn't uniquely defined. Are you willing to generate more samples than you need and then throw away extreme values? Or do you want to 'censor' extreme values (i.e. set values = 1 to 1 and values =7 to 7)? I'd like

[R] R question: generating data using MASS

2011-08-28 Thread uf_mike
and at a specific prevalence (say, 5%). Is there a simple way to take the initial data set and randomly replace 5% of values with NA missing values? Thanks, I appreciate any guidance folks can offer. :-) -- View this message in context: http://r.789695.n4.nabble.com/R-question-generating-data-using-MASS

[R] question on silhouette colours

2011-08-25 Thread Gordon Robertson
I'm fairly new to the silhouette functionality in the cluster package, so apologize if I'm asking something naive. If I run the 'agnes(ruspini)' example from the silhouette section of the cluster package vignette, and assign colours to clusters, two clusters have what appear to be incorrect

[R] Question about object permanence/marshalling

2011-08-25 Thread Albert-Jan Roskam
Hello,   I am trying to write some code that dumps R objects to the harddisk in a binary format so they can be quickly re-used later. Goal is to save time. The objects may be quite large (e.g. classes for a GUI). I was thinking that save() and load() would be suitable for this (until now I only

Re: [R] Question about object permanence/marshalling

2011-08-25 Thread jim holtman
The problem I think is in your unmarshal. 'load' will load the object into the local environment, not the global. You have to explicitly return it, that means you have to know the name that its was 'save'd by; unmarshal - function(xdr) {     object - strsplit(strsplit(xdr, \\.)[[1]][[1]], /)

Re: [R] Question about object permanence/marshalling

2011-08-25 Thread Albert-Jan Roskam
Cc: R Mailing List r-help@r-project.org Sent: Thursday, August 25, 2011 4:07 PM Subject: Re: [R] Question about object permanence/marshalling The problem I think is in your unmarshal.  'load' will load the object into the local environment, not the global.  You have to explicitly return

Re: [R] Question about object permanence/marshalling

2011-08-25 Thread jim holtman
jholt...@gmail.com To: Albert-Jan Roskam fo...@yahoo.com Cc: R Mailing List r-help@r-project.org Sent: Thursday, August 25, 2011 4:07 PM Subject: Re: [R] Question about object permanence/marshalling The problem I think is in your unmarshal.  'load' will load the object into the local

[R] Question about FlexMix package

2011-08-25 Thread Andra Isan
Hello All, I am trying to use FlexMix package for my two linear regression models: http://finzi.psych.upenn.edu/R/library/flexmix/doc/regression-examples.pdf y1 = w1 * x1 + w2 *x2 + w3 * x3 +beta1 y2 = w4 * x4 + w4 *x4 + w4 * x4 +beta2 and I would like to combine these two regression models

[R] question about mixtools package

2011-08-19 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

[R] question regarding gregexpr and read.table

2011-08-17 Thread Jack Luo
Hi, I have a silly question regarding the usage of two commands: read.table and gregexpr: For read.table, if I read a matrix and set header = T, I found that all the dash (-) becomes dots (.) A = read.table(Matrix.txt, sep = \t, header = F) A[1,1] # A-B-C-D. A = read.table(Matrix.txt, sep =

Re: [R] question regarding gregexpr and read.table

2011-08-17 Thread Eik Vettorazzi
Hi Jack, yes there is. see ?read.table for option check.names and to the 2nd task . is a special character in regular expressions, so mask it or don't use regular expressions: gregexpr([.],A.B.C.D) #or gregexpr(.,A.B.C.D,fixed=T) cheers. Am 17.08.2011 15:03, schrieb Jack Luo: Hi, I have a

Re: [R] question regarding gregexpr and read.table

2011-08-17 Thread Raphael Saldanha
Hi! You can try import the file with header = F, and after inform that the first row is a header. On this post is some idea: http://stackoverflow.com/questions/2293131/reading-first-row-as-header-is-easy-what-gives-with-two-rows-being-the-header On Wed, Aug 17, 2011 at 10:03 AM, Jack Luo

Re: [R] question regarding gregexpr and read.table

2011-08-17 Thread Jack Luo
Thank, Eik, it works! -Jack On Wed, Aug 17, 2011 at 9:19 AM, Eik Vettorazzi e.vettora...@uke.uni-hamburg.de wrote: Hi Jack, yes there is. see ?read.table for option check.names and to the 2nd task . is a special character in regular expressions, so mask it or don't use regular

[R] question regarding headers with space in the names

2011-08-17 Thread Jack Luo
Hi, After I read an xlsx file into the work space: A - read.xlsx(B.xls, header = T, check.names = F) There are several headers with the names like: colnames(A) [1:4] # [1] A 1B [3] C 2 D I can get the content of column 2 and column 4 easily by A$B

Re: [R] question regarding headers with space in the names

2011-08-17 Thread Ista Zahn
Hi Jack, You need to quote non-syntactic names. A$`A 1` A$'A 1' A$A 1 should all work, with the first form being the recommended one. Best, Ista On Wed, Aug 17, 2011 at 1:45 PM, Jack Luo jluo.rh...@gmail.com wrote: Hi, After I read an xlsx file into the work space: A - read.xlsx(B.xls,

[R] Question about NULL matrix? Can I define a NULL matrix in R?

2011-08-10 Thread Andra Isan
Hi All,  I would like to create a matrix in R but I dont know the size of my matrix. I only know the size of the columns but not the size of the rows. So, is there any way to create a dynamic matrix of size NULL by n_cols? and then add to that matrix? I know for a vector, I can do this: x= NULL

Re: [R] Question about NULL matrix? Can I define a NULL matrix in R?

2011-08-10 Thread David Winsemius
On Aug 10, 2011, at 8:23 PM, Andra Isan wrote: Hi All, I would like to create a matrix in R but I dont know the size of my matrix. I only know the size of the columns but not the size of the rows. So, is there any way to create a dynamic matrix of size NULL by n_cols? and then add to

Re: [R] Question about NULL matrix? Can I define a NULL matrix in R?

2011-08-10 Thread Rolf Turner
On 11/08/11 13:11, David Winsemius wrote: On Aug 10, 2011, at 8:23 PM, Andra Isan wrote: Hi All, I would like to create a matrix in R but I dont know the size of my matrix. I only know the size of the columns but not the size of the rows. So, is there any way to create a dynamic matrix of

Re: [R] Question about NULL matrix? Can I define a NULL matrix in R?

2011-08-10 Thread David Winsemius
On Aug 10, 2011, at 9:22 PM, Rolf Turner wrote: On 11/08/11 13:11, David Winsemius wrote: On Aug 10, 2011, at 8:23 PM, Andra Isan wrote: Hi All, I would like to create a matrix in R but I dont know the size of my matrix. I only know the size of the columns but not the size of the rows.

Re: [R] Question about NULL matrix? Can I define a NULL matrix in R?

2011-08-10 Thread Rolf Turner
On 11/08/11 13:27, David Winsemius wrote: On Aug 10, 2011, at 9:22 PM, Rolf Turner wrote: On 11/08/11 13:11, David Winsemius wrote: On Aug 10, 2011, at 8:23 PM, Andra Isan wrote: Hi All, I would like to create a matrix in R but I dont know the size of my matrix. I only know the size of

Re: [R] Question about NULL matrix? Can I define a NULL matrix in R?

2011-08-10 Thread David Winsemius
On Aug 10, 2011, at 10:03 PM, Rolf Turner wrote: On 11/08/11 13:27, David Winsemius wrote: On Aug 10, 2011, at 9:22 PM, Rolf Turner wrote: On 11/08/11 13:11, David Winsemius wrote: On Aug 10, 2011, at 8:23 PM, Andra Isan wrote: Hi All, I would like to create a matrix in R but I dont

[R] Question

2011-08-08 Thread Tyler Gruhn
I just signed up for R Help, so please let me know if I'm doing this incorrectly. I've been working with R for a couple of weeks, attempting to process microarray data. This means 20,000+ rows of data to work with x 24 columns. I am trying to produce heatmaps and found that the best computer

Re: [R] Question

2011-08-08 Thread Martin Morgan
Hi Tyler -- On 08/08/2011 12:54 PM, Tyler Gruhn wrote: I just signed up for R Help, so please let me know if I'm doing this incorrectly. Better to provide an informative subject line -- microarray heatmap memory use ? I've been working with R for a couple of weeks, attempting to process

Re: [R] Question on RNG

2011-08-07 Thread Petr Savicky
On Sat, Aug 06, 2011 at 09:37:22PM +0200, Petr Savicky wrote: On Fri, Aug 05, 2011 at 11:47:49PM +0530, Ron Michael wrote: Hi all, I have happened to work on MS .NET for sometime now, and I found that this language offers RNG what is called as Donald E. Knuth's subtractive random number

<    5   6   7   8   9   10   11   12   13   14   >