Hi Everybody,

please can you help me how to call BayesX in R in order to see the graph
already exist in BayesX
Thanks


---------- Forwarded message ----------
From: <r-help-request@r-project.org>
Date: Sat, Jan 22, 2011 at 5:00 AM
Subject: R-help Digest, Vol 95, Issue 22
To: r-help@r-project.org


Send R-help mailing list submissions to
       r-help@r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
       https://stat.ethz.ch/mailman/listinfo/r-help
or, via email, send a message with subject or body 'help' to
       r-help-request@r-project.org

You can reach the person managing the list at
       r-help-owner@r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-help digest..."


Today's Topics:

  1. 3D Binning (vioravis)
  2. help! complete the reviewer's suggest: carry out GA+GP
     (gaussian process)! (bbslover)
  3. nlminb doesn't converge and produce a warning (kamel gaanoun)
  4. Loop and store results (Sam)
  5. Re: auc function (Petr Savicky)
  6. stochastic models for population growth (Vassily Shvets)
  7. Re: Loop and store results (Henrique Dallazuanna)
  8. Function comparable to cutpt.coxph from "Survival Analysis
     using S" (Schneider, Friederike Dr.)
  9. Re: nlminb doesn't converge and produce a warning
     (Karl Ove Hufthammer)
 10. User input in R program (christiaan pauw)
 11. How to look into the asterisked function? (Bogaso Christofer)
 12. Re: How to look into the asterisked function?
     (Henrique Dallazuanna)
 13. Re: How to look into the asterisked function? (jim holtman)
 14. Re: data and parameters (jim holtman)
 15. Re: data and parameters (jim holtman)
 16. Re: Extraction and replacement of data in a data frame
     (michael.hopgood)
 17.  complex transformation of data (Den)
 18. Re: User input in R program (Hugo Mildenberger)
 19. Re: Function comparable to cutpt.coxph from "Survival
     Analysis using S" (Frank Harrell)
 20. Re: Regression Testing (Mojo)
 21. Re: Regression Testing (Achim Zeileis)
 22. Re: User input in R program (Matt Shotwell)
 23. Re: User input in R program (D Kelly O'Day)
 24. Re: complex transformation of data (ONKELINX, Thierry)
 25. Re: complex transformation of data (Moritz Grenke)
 26. Re: User input in R program (Mauricio Zambrano)
 27. Error in ANOVA for model comparison (Rosario Garcia Gil)
 28. HHT-methodology (Torbj?rn Lorentzen)
 29. Help for lattice. par(new=TRUE) (Fabrice Tourre)
 30. Re: Regression Testing (Mojo)
 31. Re: Regression Testing (Achim Zeileis)
 32. Re: How to look into the asterisked function? (Bogaso Christofer)
 33. Re: Error in ANOVA for model comparison (John Fox)
 34. clustering fuzzy (pete)
 35. Re: complex transformation of data (Henrique Dallazuanna)
 36. Re: clustering fuzzy (jim holtman)
 37. Maxiter specification in R (Hongwei Dong)
 38. Re: Maxiter specification in R (David Winsemius)
 39. Re: number of iterations in a Tobit model (Terry Therneau)
 40. Re: randomForest: too many elements specified? (Liaw, Andy)
 41. Re: nlminb doesn't converge and produce a warning (Douglas Bates)
 42. Re: nlminb doesn't converge and produce a warning (Ravi Varadhan)
 43. Re: Unexpected Gap in simple line plot (Duncan Murdoch)
 44. Marginality rule between powers and interaction terms in lm()
     (JiHO)
 45. extracting random intercept (Xebar Saram)
 46. Extracting random intercept (Xebar Saram)
 47. Re: Inconsisten graphics i/o when using Rscript versus GUI
     (MacQueen, Don)
 48. Re: complex transformation of data (Henrique Dallazuanna)
 49. Re: complex transformation of data (Henrique Dallazuanna)
 50. Information (Akash)
 51. Re: complex transformation of data (Den)
 52. Storm Clustering using clusters in evd (dpender)
 53. confidence interval (Francesco Petrogalli)
 54. ordering a vector (Francesco Petrogalli)
 55. How to find data that includes certain values (poppinkid)
 56. Re: User input in R program (jverzani)
 57. Looping with incremented object name and increment function
     (Michael Costello)
 58. Re: clustering fuzzy (pete)
 59. Re: How to find data that includes certain values (jim holtman)
 60. Re: complex transformation of data (Henrique Dallazuanna)
 61. Re: How to find data that includes certain values
     (Henrique Dallazuanna)
 62. Re: ordering a vector (jim holtman)
 63. Re: ordering a vector (Peter Langfelder)
 64. Re: Pearson correlation with randomization (David Winsemius)
 65. Re: Information (David Winsemius)
 66. Re: confidence interval (David Winsemius)
 67. Re: Looping with incremented object name and increment
     function (Greg Snow)
 68. Re: complex transformation of data (Den)
 69. Help with LMSreg (eniven)
 70. TRADUCING lmer() syntax into lme() (Freddy Gamma)
 71. building package (las65@buffalo.edu)
 72. Re: Pearson correlation with randomization (Brahmachary, Manisha)
 73. glitch in building R package (Horace Tso)
 74. Re: building package (Duncan Murdoch)
 75. Re: complex transformation of data (Den)
 76. Re: How to find data that includes certain values (Den)
 77. lm(y ~ x1) vs. lm(y ~ x0 + x1 - 1) with x0 <- rep(1,
     length(y)) (jochen laubrock)
 78. Re: Looping with incremented object name and increment
     function (Dennis Murphy)
 79. Re: lm(y ~ x1) vs. lm(y ~ x0 + x1 - 1) with x0 <- rep(1,
     length(y)) (David Winsemius)
 80. R - Vectorization and Functional Programming Constructs (Mingo)
 81. Re: lm(y ~ x1) vs. lm(y ~ x0 + x1 - 1) with x0 <- rep(1,
     length(y)) (Bert Gunter)
 82. Re: lm(y ~ x1) vs. lm(y ~ x0 + x1 - 1) with x0 <- rep(1,
     length(y)) (jochen laubrock)
 83. about matrices merge and retrieve algorithm. (pratik wankhade)
 84. Debian ?Ubuntu version of latest R using synaptic in Ubuntu
     10.10 (Ajay Ohri)
 85. Re: Accessing MySQL Database in R (Sascha Vieweg)
 86. Re: [R-sig-Debian] Debian ?Ubuntu version of latest R using
     synaptic inUbuntu 10.10 (Daniel Nordlund)
 87. effect size measure for dependent samples (Steve Powell)


----------------------------------------------------------------------

Message: 1
Date: Fri, 21 Jan 2011 00:30:46 -0800 (PST)
From: vioravis <vioravis@gmail.com>
To: r-help@r-project.org
Subject: [R] 3D Binning
Message-ID: <1295598646482-3229137.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


I am trying to do binning on three variables (3d binning). The bin
boundaries
are specified by the user separately for each variable. I used the bin2
function in the 'ash' package for 2d binning that involves only two
variables but didn't any package for similar binning with three variables.
Are there any packages or codes available for 3d binning?? Thank you.

--
View this message in context:
http://r.789695.n4.nabble.com/3D-Binning-tp3229137p3229137.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 2
Date: Thu, 20 Jan 2011 23:40:00 -0800 (PST)
From: bbslover <dluthm@yeah.net>
To: r-help@r-project.org
Subject: [R] help! complete the reviewer's suggest: carry out GA+GP
       (gaussian process)!
Message-ID: <1295595600201-3229097.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hello, all experts,

My major is computer-aied drug design ( main QSAR).

Now, my paper need be reviesed, and one reviewer ask me do genetic algorithm
coupled with gaussian process method (GA+GP).

my data:
training set: 191*106
   test set: 73*106

here, I need use GA+GP to do variable selection when building the model.

In R, there are not GA package like in matlab
GA-toolbox(http://www.sheffield.ac.uk/acse/research/ecrg/gat.html) .

now, I just can use the matlab GA-tool box, however, I can not use
GP-toolbox in matlab. so I search the internet, find R package "genalg" can
do GA. and an example given is to do wavelength selection by GA+PLS, so I
think i certainly do the GA+GP. unfortunately, in this genalg package, i do
not know how to extract the selected variables, it seems likes there is not
such function. So I want to all friends help me to solve the reviewer's
suggestion: do GA+GP and extract the optimal variables and get the some
statistical parameters (i.e., cross-validation R2, pred R2 etc).

now, I can do GA+svm to do variable selection and build the models and get
some statistical paramets depicted above.

GA: matlab GA toolbox
(http://www.sheffield.ac.uk/acse/research/ecrg/gat.html)
svm: libsvm (http://www.csie.ntu.edu.tw/~cjlin/libsvm/<http://www.csie.ntu.edu.tw/%7Ecjlin/libsvm/>
)

now I want to know, how to get the predicted values :

In libsvm for example:
cmd = ['-v ',num2str(v),' -c',num2str(cgp(nind,1)),  '-g
',num2str(cgp(nind,2)),' -p ',num2str(cgp(nind,3)),' -s 3'];
model = svmtrain(train_y,train_data_best,cmd);
train_pred = svmpredict(train_y,train_data_best,model); % get the predicted
values for the training set

I can get the train_pred, likewise I can get the test_pred (tes_pred =
svmpredict(test_y,test_data_best,model);)

If I have the obsved train_y,test_y and the predicted train_pred and
test_pred, some statistical parameter can be calculated.

But For GP, how can i get the predicted values?

(from GP website:  http://www.gaussianprocess.org/gpml/code/matlab/doc/)

prediction: [ymu ys2 fmu fs2   ] = gp(hyp, inf, mean, cov, lik, x, y, xs);

here, the "ymu" are the predicted values that similar to "test_pred" in
libsvm?

I hope all friends  can give me a hand, sincere there are little days i
should upload my revised manuscript, but until now this quest can not be
soved.

thanks for your help.

kevin




--
View this message in context:
http://r.789695.n4.nabble.com/help-complete-the-reviewer-s-suggest-carry-out-GA-GP-gaussian-process-tp3229097p3229097.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 3
Date: Fri, 21 Jan 2011 10:51:19 +0100
From: kamel gaanoun <kamel.gaanoun@gmail.com>
To: r-help@r-project.org
Subject: [R] nlminb doesn't converge and produce a warning
Message-ID:
       <AANLkTi=og=Ji530FVys1NJxHLGAx7xufAr3QSD82uBZF@mail.gmail.com>
Content-Type: text/plain

Hi Everybody,

My problem is that nlminb doesn't converge, in minimising a logLikelihood
function, with 31*6 parameters(2 weibull parameters+29 regressors repeated 6
times).


I use nlminb like this :
res1<-nlminb(vect, V, lower=c(rep(0.01, 12), rep(0.01, 3), rep(-Inf, n-15)),
upper=c(rep(Inf, 12), rep(0.99, 3), rep(Inf, n-15)), control =
list(maxit=1000) )

and that's the result :

Message d'avis :
In nlminb(vect, V, lower = c(rep(0.01, 12), rep(0.01, 3), rep(-Inf,  :
 unrecognized control element(s) named `maxit' ignored
> res1
$par
 [1]   2.48843979   4.75209125   2.57199837  16.80712783   3.15211075
16.86606178  58.61925499  37.85793462  48.78215699
 [10] 151.64638501  43.60420299  15.14639541   0.58754382   0.76180935
0.66191763  -0.26802757  -0.96378197  -0.68369525
 [19]   0.37813096   0.89778593 -10.26471908  -0.87265813   6.43973968
-1.74417166  12.00193419   0.60638326  -1.66675589
 [28]   1.29312079   1.39846863  -0.48449361  20.14470193  -0.50729841
-2.15177967  -0.78155345   0.41857810  -0.40863744
 [37] -17.18489562  -1.69140562   1.45236861  -0.23738183   5.47688642
-0.71546576   9.95015047  -2.16096138  -0.74503151
 [46]  -0.66258461   5.38871217   2.53147752 -12.58827379  -0.45669589
-0.37285088   2.15116198  -2.50414066  -0.99752892
 [55]   4.83972450  -1.16496925  -3.53429528   0.56083677  -9.87490932
-1.75153657   9.87912224  -0.75783517  -9.95423392
 [64]  -0.07530469  -0.73466191  -0.27397382  15.15891548  -0.02489436
12.91493065  -4.65335356   0.03524561   0.00000000
 [73]  -9.06720312  -0.25413758  -0.18578765   0.53283198  -4.02688497
-0.50581412  -0.31544940   0.57450848   6.15206152
 [82]   0.08178377   0.82978606   0.39337352  -3.65304712  -0.06833839
3.87790848  -1.08017043   3.62779184  -0.14700541
 [91] -13.95610827  -1.50385432   8.05851743  -1.24250013  -0.01249817
0.38085483  -4.97064573  -0.98852401  -3.00305183
[100]   0.35053875  -4.26833889  -0.12463188  16.05828402   0.41736764
-0.94678922  -0.75813452   2.15378348   0.39586048
[109]   1.41359441   0.81603207  -4.43963958  -0.79438435   0.49530882
0.11197484  -8.43196798   1.00456535 -22.04423030
[118]  -0.11532887   2.58085765   1.41912515  -0.78120889  -1.23850824
12.39079062   0.23567444   1.39557879  -2.22993802
[127] -12.58827379  -0.45669589  -0.37285088  -0.73563805   3.40201735
0.58550247  -3.62769828   0.21657740  -7.37785506
[136]  -0.68218180   6.41876225   0.38708385  -0.33009429  -0.25230736
3.53672719   1.53676202   3.65074513   0.42623602
[145]  -7.26982010   0.70597611 -23.15198788  -0.36822845  -2.29863267
0.70223129 -14.45665129  -0.54094864  -2.17858443
[154]  -0.56501734   2.50032796  -0.45677181  12.04113439  -1.42294094
-16.16874444  -0.49101846  -6.29724769  -1.38333722
[163] -14.16552579   1.57502968   5.04329383   0.24857745  -1.69885428
-0.46757266   4.41795651  -2.41006349   4.61648610
[172]   0.42235314  -3.22153895  -0.15443857   1.07661101  -0.63653449
-2.74034265   0.20898466   1.37927183   0.26722477
[181] -15.09685067   0.87160467 -24.79722150   1.48810684   1.70068893
-0.22538026   7.63908028   1.60431981  -7.52661064

$objective
[1] 1514.691

$convergence
[1] 1

$message
[1] "iteration limit reached without convergence (9)"

$iterations
[1] 150

$evaluations
function gradient
    176    44935

I tried many times to take the res1$par as initial values and retry againe
but still doesn't converge.


Any help will save me Thanks

--
Kamel Gaanoun
(+33) (0)6.76.04.65.77

       [[alternative HTML version deleted]]



------------------------------

Message: 4
Date: Fri, 21 Jan 2011 10:47:10 +0000
From: Sam <Sam_Smith@me.com>
To: r-help@r-project.org
Subject: [R] Loop and store results
Message-ID: <3E88A48C-CE33-4022-8A92-D7224374EC80@me.com>
Content-Type: text/plain; CHARSET=US-ASCII

Dear List,

I have a data-frame

#prepare the data
example <- data.frame(letters[1:9],
      sample(letters, 9),
      sample(letters, 9),
      sample(letters, 9),
      sample(letters, 9),
      sample(letters, 9),
      sample(letters, 9),
      sample(letters, 9),
      sample(letters, 9))
colnames(example) <- c("individuals", 1:8)

I want to sample this

#sample the data
a_1 <- example[sample(nrow(example),3),]

individuals 1 2 3 4 5 6 7 8
8           h w m r a n v v b
6           f e b g u v r b p
3           c z c s k t e i g

However i want to sample it 500 times, so i need to use the loop function -
which is something, unfortunately i am unsure how to write.

Furthermore, i want to output the results in a data-frame ( i think i need
the list function, but again i am unsure)

Ideally it would be separated by sample but i am unsure if this is possible?
However as long as the order is kept intact that will be fine. I.E the top 3
are sample 1, the next 3 are sample 2 etc

What i require:-

individuals 1 2 3 4 5 6 7 8

8                    h w m r a n v v b
6                   f e b g u v r b p
3                   c z c s k t e i g

9                   h w m f a n v v b
4                   f e b g b v r b p
2                   c z c s k t e i g

If its not too much to ask: I will then sample it 4 individuals 500 times ,
5 individuals etc etc and store these _ i can always do these separately if
its asking too much!

Thanks,

Sam



------------------------------

Message: 5
Date: Fri, 21 Jan 2011 10:10:17 +0100
From: Petr Savicky <savicky@praha1.ff.cuni.cz>
To: r-help@r-project.org
Subject: Re: [R] auc function
Message-ID: <20110121091017.GB28150@praha1.ff.cuni.cz>
Content-Type: text/plain; charset=us-ascii

On Thu, Jan 20, 2011 at 03:14:01PM -0800, Changbin Du wrote:
> ROCR
>

I appreciate this information, which is new for me. Up to now, i was
using the function

 get.auc <- function(statistic, label, negative, positive)
 {
     xmove <- as.numeric(label == negative)
     ymove <- as.numeric(label == positive)
     stopifnot(xmove + ymove == 1)
     rank.stat <- rank(statistic, ties.method="min")
     steps <- aggregate(cbind(xmove, ymove), by=list(rank.stat), sum)
     n <- nrow(steps)
     x <- c(0, cumsum(steps[n:1, 2]))
     y <- c(0, cumsum(steps[n:1, 3]))
     sum(diff(x) * (y[1:n] + y[2:(n+1)]))/(2*max(x)*max(y))
 }

CRAN package ROCR allows to compute many different measures and
visualisations of classifier performance. In particular, AUC may
be computed as follows

 library(ROCR)

 n <- 50
 label <- ordered(rep(c("c1", "c2"), length=n))
 set.seed(12345)
 statistic <- rnorm(n) + (label == "c2")
 pred <- prediction(statistic, label)
 AUC <- performance(pred, "auc")@y.values[[1]]
 cbind(AUC, diff=AUC - get.auc(statistic, label, "c1", "c2"))
 #         AUC diff
 # [1,] 0.7392    0

The difference is not always exactly zero, but is at the level
of the machine rounding error.

Petr Savicky.

>
>
> On Thu, Jan 20, 2011 at 3:04 PM, He, Yulei <he@hcp.med.harvard.edu> wrote:
>
> > Hi, there.
> >
> > Suppose I already have sensitivities and specificities. What is the
quick
> > R-function to calculate AUC for the ROC plot? There seem to be many R
> > functions to calculate AUC.
> >
> > Thanks.
> >
> > Yulei
> >
> >



------------------------------

Message: 6
Date: Thu, 20 Jan 2011 23:57:18 -0800 (PST)
From: Vassily Shvets <shv736@yahoo.com>
To: r-help@stat.math.ethz.ch
Subject: [R] stochastic models for population growth
Message-ID: <338050.63047.qm@web130201.mail.mud.yahoo.com>
Content-Type: text/plain; charset=us-ascii

Hello,
Having measured two populations' characteristics at one particular time[with
great precision] with R, I would like to extend this to measuring the same
populations starting at t1, and then again at t2, and try to develop a
growth model (something like dpop1/dt=r*pop^(...),dpop2/dt=r*pop^(...)). I
think the idea is to create a model that will predict the growth of a
population(N(mu, sigma)) within a margin of error. This kind of modeling
isn't well known or publicized in terms of R, am I right?
regards,
s



------------------------------

Message: 7
Date: Fri, 21 Jan 2011 09:25:05 -0200
From: Henrique Dallazuanna <wwwhsd@gmail.com>
To: Sam <Sam_Smith@me.com>
Cc: r-help@r-project.org
Subject: Re: [R] Loop and store results
Message-ID:
       <AANLkTim5n4AnxR_g4MLz71s-rJBp1opPXXqcVicFoDkp@mail.gmail.com>
Content-Type: text/plain

Try this:

replicate(500, example[sample(nrow(example), 3),], simplify = FALSE)


On Fri, Jan 21, 2011 at 8:47 AM, Sam <Sam_Smith@me.com> wrote:

> Dear List,
>
> I have a data-frame
>
> #prepare the data
> example <- data.frame(letters[1:9],
>       sample(letters, 9),
>       sample(letters, 9),
>       sample(letters, 9),
>       sample(letters, 9),
>       sample(letters, 9),
>       sample(letters, 9),
>       sample(letters, 9),
>       sample(letters, 9))
> colnames(example) <- c("individuals", 1:8)
>
> I want to sample this
>
> #sample the data
> a_1 <- example[sample(nrow(example),3),]
>
> individuals 1 2 3 4 5 6 7 8
> 8           h w m r a n v v b
> 6           f e b g u v r b p
> 3           c z c s k t e i g
>
> However i want to sample it 500 times, so i need to use the loop function
-
> which is something, unfortunately i am unsure how to write.
>
> Furthermore, i want to output the results in a data-frame ( i think i need
> the list function, but again i am unsure)
>
> Ideally it would be separated by sample but i am unsure if this is
> possible? However as long as the order is kept intact that will be fine.
I.E
> the top 3 are sample 1, the next 3 are sample 2 etc
>
> What i require:-
>
> individuals 1 2 3 4 5 6 7 8
>
> 8                    h w m r a n v v b
> 6                   f e b g u v r b p
> 3                   c z c s k t e i g
>
> 9                   h w m f a n v v b
> 4                   f e b g b v r b p
> 2                   c z c s k t e i g
>
> If its not too much to ask: I will then sample it 4 individuals 500 times
,
> 5 individuals etc etc and store these _ i can always do these separately
if
[[elided Yahoo spam]]
>
> Thanks,
>
> Sam
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

       [[alternative HTML version deleted]]



------------------------------

Message: 8
Date: Fri, 21 Jan 2011 12:17:00 +0100
From: "Schneider, Friederike Dr."
       <Friederike.Schneider@med.uni-muenchen.de>
To: "r-help@stat.math.ethz.ch" <r-help@stat.math.ethz.ch>
Subject: [R] Function comparable to cutpt.coxph from "Survival
       Analysis using S"
Message-ID:
       <
67CE706A4F74ED42A5936E106985CC405009A5C925@MITEX03N.helios.med.uni-muenchen.de
>

Content-Type: text/plain; charset="iso-8859-1"

Dear Mrs Rachel Pearce,
I am looking for a function "cutpt-coxph" in R - like you did some years
ago.
How have you solved the problem? Have you found it or a similar function?

thank you, Sincerely, Friederike


"The title says it all really; I am looking for a function along the lines
of
cutpt.coxph as described in "Survival Analysis Using S" (Tableman and
Kim), Chapter 6. As may be guessed, the function optimises the
cutpoint of a continuous variable for cox proportional hazard
modelling. I can't find it, or any similar function, on CRAN.

Alternatively, perhaps there is a way of extracting the likelihoods
from the output of coxph."


Dr. med. Friederike Schneider
Assistenz?rztin
Klinikum der LMU
Campus Grosshadern
Marchioninistr. 15
81377 M?nchen
Tel.: 089-7099-425
Friederike.Schneider@med.uni-muenchen.de



------------------------------

Message: 9
Date: Fri, 21 Jan 2011 12:47:55 +0100
From: Karl Ove Hufthammer <karl@huftis.org>
To: r-help@stat.math.ethz.ch
Subject: Re: [R] nlminb doesn't converge and produce a warning
Message-ID: <ihbrp3$fki$2@dough.gmane.org>
Content-Type: text/plain; charset="UTF-8"

kamel gaanoun wrote:

> I use nlminb like this :
> res1<-nlminb(vect, V, lower=c(rep(0.01, 12), rep(0.01, 3), rep(-Inf,
> n-15)), upper=c(rep(Inf, 12), rep(0.99, 3), rep(Inf, n-15)), control =
> list(maxit=1000) )
>
> and that's the result :
>
> Message d'avis :
> In nlminb(vect, V, lower = c(rep(0.01, 12), rep(0.01, 3), rep(-Inf,  :
> unrecognized control element(s) named `maxit' ignored

Just increase the maximum number of iterations. Which you tried to do, but
didn?t succeed in, as the above warnings shows. The argument is called
?iter.max?, not ?max.iter?.

--
Karl Ove Hufthammer



------------------------------

Message: 10
Date: Fri, 21 Jan 2011 14:26:26 +0200
From: christiaan pauw <cjpauw@gmail.com>
To: r-help@r-project.org
Subject: [R] User input in R program
Message-ID:
       <AANLkTimZc98GJtTyJ2a6Pn-1v-Sd6vK4sv2BOkQsdppP@mail.gmail.com>
Content-Type: text/plain

HI Everybody

Does anyone know of documentation about different ways of obtaining user
input in R. I have used readline() but I wondered is there are sophisticated
packages that does things like validate answers or generate selection
lists.

bets regards
Christaan

       [[alternative HTML version deleted]]



------------------------------

Message: 11
Date: Fri, 21 Jan 2011 18:32:26 +0530
From: "Bogaso Christofer" <bogaso.christofer@gmail.com>
To: <r-help@r-project.org>
Subject: [R] How to look into the asterisked function?
Message-ID: <001e01cbb96b$774941c0$65dbc540$@gmail.com>
Content-Type: text/plain

Hi friends, there is methods() function to see the all available methods for
a particular function, for example:



> head(methods("print"))

[1] "print.acf"     "print.anova"   "print.aov"     "print.aovlist"
"print.ar"      "print.Arima"



In this list, there are some functions which are asterisked like
print.acf(). How can I see the contents of those function?



Thanks and regards,


       [[alternative HTML version deleted]]



------------------------------

Message: 12
Date: Fri, 21 Jan 2011 10:45:45 -0200
From: Henrique Dallazuanna <wwwhsd@gmail.com>
To: Bogaso Christofer <bogaso.christofer@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] How to look into the asterisked function?
Message-ID:
       <AANLkTimWQtvcXHJ99+=T9zD=ShY5pEOGeFJsBZoonACD@mail.gmail.com>
Content-Type: text/plain

Try this:

getS3method("print", "acf")

On Fri, Jan 21, 2011 at 11:02 AM, Bogaso Christofer <
bogaso.christofer@gmail.com> wrote:

> Hi friends, there is methods() function to see the all available methods
> for
> a particular function, for example:
>
>
>
> > head(methods("print"))
>
> [1] "print.acf"     "print.anova"   "print.aov"     "print.aovlist"
> "print.ar"      "print.Arima"
>
>
>
> In this list, there are some functions which are asterisked like
> print.acf(). How can I see the contents of those function?
>
>
>
> Thanks and regards,
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

       [[alternative HTML version deleted]]



------------------------------

Message: 13
Date: Fri, 21 Jan 2011 07:49:36 -0500
From: jim holtman <jholtman@gmail.com>
To: Bogaso Christofer <bogaso.christofer@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] How to look into the asterisked function?
Message-ID:
       <AANLkTinBbv70pmtFxQCiyKC_sqM6xPuNd8mzUoRqrVud@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

You can also use:

getAnywhere("functionName")


On Fri, Jan 21, 2011 at 8:02 AM, Bogaso Christofer
<bogaso.christofer@gmail.com> wrote:
> Hi friends, there is methods() function to see the all available methods
for
> a particular function, for example:
>
>
>
>> head(methods("print"))
>
> [1] "print.acf" ? ? "print.anova" ? "print.aov" ? ? "print.aovlist"
> "print.ar" ? ? ?"print.Arima"
>
>
>
> In this list, there are some functions which are asterisked like
> print.acf(). How can I see the contents of those function?
>
>
>
> Thanks and regards,
>
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?



------------------------------

Message: 14
Date: Fri, 21 Jan 2011 07:58:04 -0500
From: jim holtman <jholtman@gmail.com>
To: "analyst41@hotmail.com" <analyst41@hotmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] data and parameters
Message-ID:
       <AANLkTimn=o7kcuD3jZyVyjH=kMK=-5Yb+rNJW2eO-sod@mail.gmail.com<5Yb%2BrNJW2eO-sod@mail.gmail.com>
>
Content-Type: text/plain; charset=ISO-8859-1

try 'sqldf'

> master=as.data.frame(list(clientId=c(1:4,2), date=1001:1005,
+ value=10001:10005))
> control=as.data.frame(list(clientId=c(2,3), mindate=c(100,1005),
+ maxdate=c(1005,1005), control.params=c(1,2)))
> master
 clientId date value
1        1 1001 10001
2        2 1002 10002
3        3 1003 10003
4        4 1004 10004
5        2 1005 10005
> control
 clientId mindate maxdate control.params
1        2     100    1005              1
2        3    1005    1005              2
> require(sqldf)
> sqldf("
+     select m.*
+         from master m, control c
+         where m.clientId = c.clientID
+             and m.date between c.mindate and c.maxdate
+     ")
 clientId date value
1        2 1002 10002
2        2 1005 10005
>
>


On Thu, Jan 20, 2011 at 9:02 PM, analyst41@hotmail.com
<analyst41@hotmail.com> wrote:
> (1) I have a master data frame that reads
>
> ClientID |date |value
>
> (2) I also have a control data frame that reads
>
> Client ID| Min date| Max date| control parameters
>
> The control data set may not have all client IDs .
>
> I want to use the control data frame on the master data frame to
> remove client IDS that don't exist in the control data set and for
> those that do, remove dates outside the required range.
>
> (3) We can either put the control parameters on all rows corresponding
> to a client ID or look it up from the control data frame
>
> (4) The basic function call looks like
>
> do.something(df,control parameters)
>
> where df is the subset of the master data set that corresponds to a
> single client with unwanted dates removed and the control parameters
> pertain to that client.
>
> Any help would be appreciated.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?



------------------------------

Message: 15
Date: Fri, 21 Jan 2011 08:01:46 -0500
From: jim holtman <jholtman@gmail.com>
To: "analyst41@hotmail.com" <analyst41@hotmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] data and parameters
Message-ID:
       <AANLkTi=DgXuj1NrHAUM=5nT4RWVX1D5KaStOs-5uuS-M@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

forgot the control parameters:

> sqldf("
+     select m.*, c.control_params
+         from master m, control c
+         where m.clientId = c.clientID
+             and m.date between c.mindate and c.maxdate
+     ")
 clientId date value control_params
1        2 1002 10002              1
2        2 1005 10005              1
>


On Thu, Jan 20, 2011 at 9:02 PM, analyst41@hotmail.com
<analyst41@hotmail.com> wrote:
> (1) I have a master data frame that reads
>
> ClientID |date |value
>
> (2) I also have a control data frame that reads
>
> Client ID| Min date| Max date| control parameters
>
> The control data set may not have all client IDs .
>
> I want to use the control data frame on the master data frame to
> remove client IDS that don't exist in the control data set and for
> those that do, remove dates outside the required range.
>
> (3) We can either put the control parameters on all rows corresponding
> to a client ID or look it up from the control data frame
>
> (4) The basic function call looks like
>
> do.something(df,control parameters)
>
> where df is the subset of the master data set that corresponds to a
> single client with unwanted dates removed and the control parameters
> pertain to that client.
>
> Any help would be appreciated.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?



------------------------------

Message: 16
Date: Fri, 21 Jan 2011 04:03:42 -0800 (PST)
From: "michael.hopgood" <michael.hopgood@mrm.se>
To: r-help@r-project.org
Subject: Re: [R] Extraction and replacement of data in a data frame
Message-ID: <1295611422452-3229476.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


Dear all,

Thank you for the prompt responses.  It is until today that I have managed
to scrap together the time to develop my R-project further.  In my free
time, I have been reading various intro manuals, so I have a rough idea of
what needs doing.  Sometimes, though, putting it into practice is more
troublesome than it looks. It is fascinating how pliable this programming
language is.  I will report on my progress as soon as I can.

Sincerely,
Michael Hopgood.
--
View this message in context:
http://r.789695.n4.nabble.com/Extraction-and-replacement-of-data-in-a-data-frame-tp3221261p3229476.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 17
Date: Fri, 21 Jan 2011 14:25:38 +0200
From: Den <d.kazakiewicz@gmail.com>
To: R-help <r-help@r-project.org>
Subject: [R]  complex transformation of data
Message-ID: <1295612738.1880.45.camel@den2042-desktop>
Content-Type: text/plain; charset="UTF-8"

Dear [R] people
Could you please help with following data transformation.
Any suggestions, hints, references and even guessing on performing any
of the following steps are highly appreciated. Those transformations are
crucial for my work.

(n_, _n, j_, k_ signify numbers)

SOURCE DATA:
id      cycle1  cycle2  cycle3  ?       cycle_n
1       c       c       c               c
1       m       m       m               m
1       f       f       f               f
2       m       m       m               NA
2       f       f       f               NA
2       c       c       c               NA
3       a       a       NA              NA
3       c       c       c               NA
3       f       f       f               NA
3       NA      NA      m               NA
...........................................



RESULT DATA1:
id      cyc1    cyc2    cyc3    ?       cyc_n
1       cfm     cfm     cfm             cfm
2       cfm     cfm     cfm             NA
3       acf     acf     cfm             NA
...........................................


RESULT DATA2:
id      treatment
1       n_cfm
2       j_cfm
3       2acf->k_cfm
...................


RESULT DATA3:
id      regimen numOfCycles
1       cfm     n_
2       cfm     j_
3       asf->cfm        {2+k_}
.............................



Thank you
Denis



------------------------------

Message: 18
Date: Fri, 21 Jan 2011 13:41:27 +0100
From: Hugo Mildenberger <Hugo.Mildenberger@web.de>
To: r-help@r-project.org
Subject: Re: [R] User input in R program
Message-ID: <201101211341.28202.Hugo.Mildenberger@web.de>
Content-Type: Text/Plain;  charset="iso-8859-1"

Hello Christian,

for an example of interacting with graphic output, just run

   example(getGraphicsEvent)

However, on X11, that feature had ceased to work since a pre-release
of R-2.12 if Cairo support was enabled at compile time. The reason for
this defect had already been documented in R's bugs database for long.
Maybe getGraphicsEvent still runs on Windows.

Best

Hugo

On Friday 21 January 2011 13:26:26 christiaan pauw wrote:
> HI Everybody
>
> Does anyone know of documentation about different ways of obtaining user
> input in R. I have used readline() but I wondered is there are
sophisticated
> packages that does things like validate answers or generate selection
> lists.
>
> bets regards
> Christaan
>
>       [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



------------------------------

Message: 19
Date: Fri, 21 Jan 2011 06:03:25 -0800 (PST)
From: Frank Harrell <f.harrell@vanderbilt.edu>
To: r-help@r-project.org
Subject: Re: [R] Function comparable to cutpt.coxph from "Survival
       Analysis using S"
Message-ID: <1295618605938-3229704.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


It is very uncommon for the assumptions underlying this method to be
satisfied.  These assumptions include (1) the relationship between X and log
relative hazard is discontinuous at X=c and only X=c; (2) c is correctly
found as the cutpoint; (3) X vs log hazard is flat to the left of c; (4) X
vs log hazard is flat to the right of c; (5) the 'optimal' cutpoint does not
depend on the values of other predictors.

These relationships rarely occur in nature unless X=time.  Failure to have
these assumptions satisfied will result in (1) great error in estimating c
(because c doesn't exist); (2) low predictive accuracy; (3) serious lack of
fit; (4) residual confounding; and (5) overestimation of effects of
remaining variables.

This non-existence of cutpoints is why in medical research no two
investigators seem to find the same cutpoint for the same predictor in
different datasets.

Frank


-----
Frank Harrell
Department of Biostatistics, Vanderbilt University
--
View this message in context:
http://r.789695.n4.nabble.com/Function-comparable-to-cutpt-coxph-from-Survival-Analysis-using-S-tp3229420p3229704.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 20
Date: Fri, 21 Jan 2011 09:10:29 -0500
From: Mojo <mojo@sispyrc.com>
To: Achim Zeileis <Achim.Zeileis@uibk.ac.at>
Cc: r-help@r-project.org
Subject: Re: [R] Regression Testing
Message-ID: <4D3993D5.9050303@sispyrc.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 1/20/2011 4:42 PM, Achim Zeileis wrote:
> On Thu, 20 Jan 2011, Mojo wrote:
>
>> I'm new to R and some what new to the world of stats.  I got
>> frustrated with excel and found R.  Enough of that already.
>>
>> I'm trying to test and correct for Heteroskedasticity
>>
>> I have data in a csv file that I load and store in a dataframe.
>>
>>> ds <- read.csv("book2.csv")
>>> df <- data.frame(ds)
>>
>> I then preform a OLS regression:
>>
>>> lmfit <- lm(df$y~df$x)
>
> Just btw: lm(y ~ x, data = df) is somewhat easier to read and also
> easier to write when the formula involves more regressors.
>
>> To test for Heteroskedasticity, I run the BPtest:
>>
>>> bptest(lmfit)
>>
>>        studentized Breusch-Pagan test
>>
>> data:  lmfit
>> BP = 11.6768, df = 1, p-value = 0.0006329
>>
>> From the above, if I'm interpreting this correctly, there is
>> Heteroskedasticity present.  To correct for this, I need to calculate
>> robust error terms.
>
> That is one option. Another one would be using WLS instead of OLS - or
> maybe FGLS. As the model just has one regressor, this might be
> possible and result in a more efficient estimate than OLS.

I thought that WLS (which I guessing is a weighted regression) is really
only useful when you know or at least have an idea of what is causing
the Heteroskedasticity?  I'm not familiar with FGLS.  I plan on adding
additional independent variables as I get more comfortable with everything.

>
>> From my reading on this list, it seems like I need to vcovHC.
>
> That's another option, yes.
>
>>> vcovHC(lmfit)
>>              (Intercept)         df$x
>> (Intercept)  1.057460e-03 -4.961118e-05
>> df$x       -4.961118e-05  2.378465e-06
>>
>> I'm having a little bit of a hard time following the help pages.
>
> Yes, the manual page is somewhat technical but the first thing the
> "Details" section does is: It points you to some references that
> should be easier to read. I recommend starting with
>
>      Zeileis A (2004), Econometric Computing with HC and HAC Covariance
>      Matrix Estimators. _Journal of Statistical Software_, *11*(10),
>      1-17. URL <URL: http://www.jstatsoft.org/v11/i10/>.

I will look into that.

Thanks,
Mojo



------------------------------

Message: 21
Date: Fri, 21 Jan 2011 15:13:27 +0100 (CET)
From: Achim Zeileis <Achim.Zeileis@uibk.ac.at>
To: Mojo <mojo@sispyrc.com>
Cc: r-help@r-project.org
Subject: Re: [R] Regression Testing
Message-ID: <alpine.DEB.2.00.1101211510110.20336@paninaro.uibk.ac.at>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Fri, 21 Jan 2011, Mojo wrote:

> On 1/20/2011 4:42 PM, Achim Zeileis wrote:
>> On Thu, 20 Jan 2011, Mojo wrote:
>>
>>> I'm new to R and some what new to the world of stats.  I got frustrated
>>> with excel and found R.  Enough of that already.
>>>
>>> I'm trying to test and correct for Heteroskedasticity
>>>
>>> I have data in a csv file that I load and store in a dataframe.
>>>
>>>> ds <- read.csv("book2.csv")
>>>> df <- data.frame(ds)
>>>
>>> I then preform a OLS regression:
>>>
>>>> lmfit <- lm(df$y~df$x)
>>
>> Just btw: lm(y ~ x, data = df) is somewhat easier to read and also easier
>> to write when the formula involves more regressors.
>>
>>> To test for Heteroskedasticity, I run the BPtest:
>>>
>>>> bptest(lmfit)
>>>
>>>        studentized Breusch-Pagan test
>>>
>>> data:  lmfit
>>> BP = 11.6768, df = 1, p-value = 0.0006329
>>>
>>> From the above, if I'm interpreting this correctly, there is
>>> Heteroskedasticity present.  To correct for this, I need to calculate
>>> robust error terms.
>>
>> That is one option. Another one would be using WLS instead of OLS - or
>> maybe FGLS. As the model just has one regressor, this might be possible
and
>> result in a more efficient estimate than OLS.
>
> I thought that WLS (which I guessing is a weighted regression) is really
only
> useful when you know or at least have an idea of what is causing the
> Heteroskedasticity?

Yes. But with only a single variable that shouldn't be too hard to do.
Also in the Breusch-Pagan test you specify a hypothesized functional form
for the variance.

> I'm not familiar with FGLS.

There is a worked example in

  demo("Ch-LinearRegression", package = "AER")

The corresponding book has some more details.

hth,
Z

> I plan on adding additional
> independent variables as I get more comfortable with everything.
>
>>
>>> From my reading on this list, it seems like I need to vcovHC.
>>
>> That's another option, yes.
>>
>>>> vcovHC(lmfit)
>>>              (Intercept)         df$x
>>> (Intercept)  1.057460e-03 -4.961118e-05
>>> df$x       -4.961118e-05  2.378465e-06
>>>
>>> I'm having a little bit of a hard time following the help pages.
>>
>> Yes, the manual page is somewhat technical but the first thing the
>> "Details" section does is: It points you to some references that should
be
>> easier to read. I recommend starting with
>>
>>      Zeileis A (2004), Econometric Computing with HC and HAC Covariance
>>      Matrix Estimators. _Journal of Statistical Software_, *11*(10),
>>      1-17. URL <URL: http://www.jstatsoft.org/v11/i10/>.
>
> I will look into that.
>
> Thanks,
> Mojo
>
>



------------------------------

Message: 22
Date: Fri, 21 Jan 2011 09:21:27 -0500
From: Matt Shotwell <matt@biostatmatt.com>
To: r-help@r-project.org
Subject: Re: [R] User input in R program
Message-ID: <1295619687.1588.4.camel@matt-laptop>
Content-Type: text/plain; charset="UTF-8"

Martyn Plummer's 'coda' package has some nice interactive menus. The
package appears to be written entirely in R. You could start with the
codamenu() function in the package source:

http://cran.r-project.org/web/packages/coda/index.html

-Matt

On Fri, 2011-01-21 at 14:26 +0200, christiaan pauw wrote:
> HI Everybody
>
> Does anyone know of documentation about different ways of obtaining user
> input in R. I have used readline() but I wondered is there are
sophisticated
> packages that does things like validate answers or generate selection
> lists.
>
> bets regards
> Christaan
>
>       [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



------------------------------

Message: 23
Date: Fri, 21 Jan 2011 06:22:23 -0800 (PST)
From: "D Kelly O'Day" <koday@processtrends.com>
To: r-help@r-project.org
Subject: Re: [R] User input in R program
Message-ID: <1295619743631-3229738.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


Christian

Have you looked at the
http://www.stats.gla.ac.uk/~adrian/rpanel/<http://www.stats.gla.ac.uk/%7Eadrian/rpanel/>rpanel
package?

I have a post which shows an example of interactive input that allows user
to adjust plot parameters.
http://chartsgraphs.wordpress.com/2009/05/08/rpanel-package-adds-interactive-capabilites-to-r/
link
--
View this message in context:
http://r.789695.n4.nabble.com/User-input-in-R-program-tp3229515p3229738.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 24
Date: Fri, 21 Jan 2011 14:25:56 +0000
From: "ONKELINX, Thierry" <Thierry.ONKELINX@inbo.be>
To: Den <d.kazakiewicz@gmail.com>, R-help <r-help@r-project.org>
Subject: Re: [R] complex transformation of data
Message-ID: <AA818EAD2576BC488B4F623941DA7427F3A9@inbomail.inbo.be>
Content-Type: text/plain; charset="us-ascii"

Denis,

Have a look at paste(), aggregate(), ddply() (from the plyr package) and
melt() and cast() (both from the reshape package).

Best regards,

Thierry

----------------------------------------------------------------------------
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
Thierry.Onkelinx@inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more than
asking him to perform a post-mortem examination: he may be able to say what
the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey


> -----Oorspronkelijk bericht-----
> Van: r-help-bounces@r-project.org
> [mailto:r-help-bounces@r-project.org] Namens Den
> Verzonden: vrijdag 21 januari 2011 13:26
> Aan: R-help
> Onderwerp: [R] complex transformation of data
>
> Dear [R] people
> Could you please help with following data transformation.
> Any suggestions, hints, references and even guessing on
> performing any of the following steps are highly appreciated.
> Those transformations are crucial for my work.
>
> (n_, _n, j_, k_ signify numbers)
>
> SOURCE DATA:
> id    cycle1  cycle2  cycle3  ...     cycle_n
> 1     c       c       c               c
> 1     m       m       m               m
> 1     f       f       f               f
> 2     m       m       m               NA
> 2     f       f       f               NA
> 2     c       c       c               NA
> 3     a       a       NA              NA
> 3     c       c       c               NA
> 3     f       f       f               NA
> 3     NA      NA      m               NA
> ...........................................
>
>
>
> RESULT DATA1:
> id    cyc1    cyc2    cyc3    ...     cyc_n
> 1     cfm     cfm     cfm             cfm
> 2     cfm     cfm     cfm             NA
> 3     acf     acf     cfm             NA
> ...........................................
>
>
> RESULT DATA2:
> id    treatment
> 1     n_cfm
> 2     j_cfm
> 3     2acf->k_cfm
> ...................
>
>
> RESULT DATA3:
> id    regimen numOfCycles
> 1     cfm     n_
> 2     cfm     j_
> 3     asf->cfm        {2+k_}
> .............................
>
>
>
> Thank you
> Denis
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


------------------------------

Message: 25
Date: Fri, 21 Jan 2011 15:46:06 +0100
From: "Moritz Grenke" <r-list@360mix.de>
To: "'Den'" <d.kazakiewicz@gmail.com>, "'R-help'"
       <r-help@r-project.org>
Subject: Re: [R] complex transformation of data
Message-ID: <E1PgIFY-00010N-3e@smtprelay05.ispgateway.de>
Content-Type: text/plain;       charset="iso-8859-1"

Hi Denis,

#minimal example:
test<-as.data.frame(list(id=c(1,1,1,2,2,2), cycle1=c("c", "m", "f", "m",
"f", "c")))

#gettin your first cell of Result 1
paste(sort(test$cycle1[test$id==1]), collapse="")


Hope this helps for the first task ...
Moritz

______________________
Moritz Grenke
http://www.360mix.de

-----Urspr?ngliche Nachricht-----
Von: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org] Im
Auftrag von Den
Gesendet: Freitag, 21. Januar 2011 13:26
An: R-help
Betreff: [R] complex transformation of data

Dear [R] people
Could you please help with following data transformation.
Any suggestions, hints, references and even guessing on performing any
of the following steps are highly appreciated. Those transformations are
crucial for my work.

(n_, _n, j_, k_ signify numbers)

SOURCE DATA:
id      cycle1  cycle2  cycle3  ?       cycle_n
1       c       c       c               c
1       m       m       m               m
1       f       f       f               f
2       m       m       m               NA
2       f       f       f               NA
2       c       c       c               NA
3       a       a       NA              NA
3       c       c       c               NA
3       f       f       f               NA
3       NA      NA      m               NA
...........................................



RESULT DATA1:
id      cyc1    cyc2    cyc3    ?       cyc_n
1       cfm     cfm     cfm             cfm
2       cfm     cfm     cfm             NA
3       acf     acf     cfm             NA
...........................................


RESULT DATA2:
id      treatment
1       n_cfm
2       j_cfm
3       2acf->k_cfm
...................


RESULT DATA3:
id      regimen numOfCycles
1       cfm     n_
2       cfm     j_
3       asf->cfm        {2+k_}
.............................



Thank you
Denis

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



------------------------------

Message: 26
Date: Fri, 21 Jan 2011 15:46:56 +0100
From: Mauricio Zambrano <hzambran.newsgroups@gmail.com>
To: christiaan pauw <cjpauw@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] User input in R program
Message-ID:
       <AANLkTinM+fJ-qAOyJtFeTJNJ7Z_S_=WO=MFUBzdtSqZZ@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Probably, iplots may be useful for you:

http://cran.r-project.org/web/packages/iplots/index.html

Kinds,

Mauricio
--
===============================
Linux user #454569 -- Ubuntu user #17469
===============================

2011/1/21 christiaan pauw <cjpauw@gmail.com>:
> HI Everybody
>
> Does anyone know of documentation about different ways of obtaining user
> input in R. I have used readline() but I wondered is there are
sophisticated
> packages that does things like validate answers or generate selection
> lists.
>
> bets regards
> Christaan
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



------------------------------

Message: 27
Date: Fri, 21 Jan 2011 15:30:36 +0100
From: Rosario Garcia Gil <M.Rosario.Garcia@slu.se>
To: "r-help@r-project.org" <r-help@r-project.org>
Subject: [R] Error in ANOVA for model comparison
Message-ID:
       <74776A1FD44FB94E9182E2C524E78772BD0783A8B1@exmbx3.ad.slu.se>
Content-Type: text/plain; charset="us-ascii"

Hello

I am trying to compare two models using anova(), however I get a message
error (see below).
In the net I only found some information on certain library(car) for which
one should use anova with A capital letter (Anova instead of anova), but I
could not find car library as it says it does not exist.


> Model <- lm(interceptG ~ SW + TSC + FSC + PF + SlopeG + K, data=AllTrait)
> Model1 <- lm(interceptG ~ SW + TSC + FSC + PF + SlopeG + PHt,
data=AllTrait)

Error in anova.lmlist(object, ...) :
 models were not all fitted to the same size of dataset

I have NA in the datafile, should that be the problem?

Kind regards and thanks in advance
Rosario


------------------------------

Message: 28
Date: Fri, 21 Jan 2011 15:23:38 +0100
From: Torbj?rn Lorentzen        <torbjorn.lorentzen@bjerknes.uib.no>
To: r-help@R-project.org
Subject: [R] HHT-methodology
Message-ID: <4D3996EA.8000109@bjerknes.uib.no>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hello R-experts,

I wonder whether any of the R-packages cover the Hilbert-Huang Transform
methodology (HHT)?

Regards,
Torbjorn



--
Torbj?rn Lorentzen | torbjorn.lorentzen@bjerknes.uib.no
|torbjorn.lorentzen@uni.no | http://www.bjerknes.uib.no/
Phone: +47 55 58 25 05 | Cellphone: +47 906 972 36 | Bjerknes Centre for
Climate Research | Geophysical Institute |
University of Bergen | Allegaten 55 | NO-5007 Bergen | Norway |



------------------------------

Message: 29
Date: Fri, 21 Jan 2011 15:52:56 +0100
From: Fabrice Tourre <fabrice.ciup@gmail.com>
To: r-help@r-project.org
Subject: [R] Help for lattice. par(new=TRUE)
Message-ID:
       <AANLkTinvE5La7uTpRa_YMZaBFwnbY8FVdHvnH8iCWqG9@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi list,
I want to plot two plot in the same figure. I set par(new=TRUE). But
it does not work.

library(lattice)
myPanel <- function(x,...)
{
      panel.histogram(x,alpha=0.4,...)
      ltext(0.4,1.5,paste("Mean=","0.05",digit=2)),cex=0.8)
      ltext(0.8,1.5,paste("s.d.=","0.06",digit=2)),cex=0.8)
}
histogram(sh2,
type="percent",panel=myPanel,breaks=seq(0,1,by=0.01),ylim=c(0,5),col=rgb(0.1,0.1,0.8,0.5))

par(new=TRUE) #### Here is does not work. Warning message: In par(new
= TRUE) : calling par(new=TRUE) with no plot

histogram(sh2,
type="percent",panel=myPanel,breaks=seq(0,1,by=0.01),ylim=c(0,5))

I want to the two hist in the same map. How can I set it in lattice?
Thanks.



------------------------------

Message: 30
Date: Fri, 21 Jan 2011 10:00:32 -0500
From: Mojo <mojo@sispyrc.com>
To: Achim Zeileis <Achim.Zeileis@uibk.ac.at>
Cc: r-help@r-project.org
Subject: Re: [R] Regression Testing
Message-ID: <4D399F90.2020702@sispyrc.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 1/21/2011 9:13 AM, Achim Zeileis wrote:
> On Fri, 21 Jan 2011, Mojo wrote:
>
>> On 1/20/2011 4:42 PM, Achim Zeileis wrote:
>>> On Thu, 20 Jan 2011, Mojo wrote:
>>>
>>>> I'm new to R and some what new to the world of stats.  I got
>>>> frustrated with excel and found R.  Enough of that already.
>>>>
>>>> I'm trying to test and correct for Heteroskedasticity
>>>>
>>>> I have data in a csv file that I load and store in a dataframe.
>>>>
>>>>> ds <- read.csv("book2.csv")
>>>>> df <- data.frame(ds)
>>>>
>>>> I then preform a OLS regression:
>>>>
>>>>> lmfit <- lm(df$y~df$x)
>>>
>>> Just btw: lm(y ~ x, data = df) is somewhat easier to read and also
>>> easier to write when the formula involves more regressors.
>>>
>>>> To test for Heteroskedasticity, I run the BPtest:
>>>>
>>>>> bptest(lmfit)
>>>>
>>>>        studentized Breusch-Pagan test
>>>>
>>>> data:  lmfit
>>>> BP = 11.6768, df = 1, p-value = 0.0006329
>>>>
>>>> From the above, if I'm interpreting this correctly, there is
>>>> Heteroskedasticity present.  To correct for this, I need to
>>>> calculate robust error terms.
>>>
>>> That is one option. Another one would be using WLS instead of OLS -
>>> or maybe FGLS. As the model just has one regressor, this might be
>>> possible and result in a more efficient estimate than OLS.
>>
>> I thought that WLS (which I guessing is a weighted regression) is
>> really only useful when you know or at least have an idea of what is
>> causing the Heteroskedasticity?
>
> Yes. But with only a single variable that shouldn't be too hard to do.
> Also in the Breusch-Pagan test you specify a hypothesized functional
> form for the variance.
>
>> I'm not familiar with FGLS.
>
> There is a worked example in
>
>   demo("Ch-LinearRegression", package = "AER")
>
> The corresponding book has some more details.
>
> hth,
> Z
>
>> I plan on adding additional independent variables as I get more
>> comfortable with everything.
>>
>>>
>>>> From my reading on this list, it seems like I need to vcovHC.
>>>
>>> That's another option, yes.
>>>
>>>>> vcovHC(lmfit)
>>>>              (Intercept)         df$x
>>>> (Intercept)  1.057460e-03 -4.961118e-05
>>>> df$x       -4.961118e-05  2.378465e-06
>>>>
>>>> I'm having a little bit of a hard time following the help pages.
>>>
>>> Yes, the manual page is somewhat technical but the first thing the
>>> "Details" section does is: It points you to some references that
>>> should be easier to read. I recommend starting with
>>>
>>>      Zeileis A (2004), Econometric Computing with HC and HAC Covariance
>>>      Matrix Estimators. _Journal of Statistical Software_, *11*(10),
>>>      1-17. URL <URL: http://www.jstatsoft.org/v11/i10/>.
>>
>> I will look into that.
>>
>> Thanks,
>> Mojo
>>
>>

If I were to use vcovHAC instead of vcovHC, does that correct for serial
correlation as well as Heteroskedasticity?

Thanks,
Mojo



------------------------------

Message: 31
Date: Fri, 21 Jan 2011 16:20:15 +0100 (CET)
From: Achim Zeileis <Achim.Zeileis@uibk.ac.at>
To: Mojo <mojo@sispyrc.com>
Cc: r-help@r-project.org
Subject: Re: [R] Regression Testing
Message-ID: <alpine.DEB.2.00.1101211618360.20336@paninaro.uibk.ac.at>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Fri, 21 Jan 2011, Mojo wrote:

> On 1/21/2011 9:13 AM, Achim Zeileis wrote:
>> On Fri, 21 Jan 2011, Mojo wrote:
>>
>>> On 1/20/2011 4:42 PM, Achim Zeileis wrote:
>>>> On Thu, 20 Jan 2011, Mojo wrote:
>>>>
>>>>> I'm new to R and some what new to the world of stats.  I got
frustrated
>>>>> with excel and found R.  Enough of that already.
>>>>>
>>>>> I'm trying to test and correct for Heteroskedasticity
>>>>>
>>>>> I have data in a csv file that I load and store in a dataframe.
>>>>>
>>>>>> ds <- read.csv("book2.csv")
>>>>>> df <- data.frame(ds)
>>>>>
>>>>> I then preform a OLS regression:
>>>>>
>>>>>> lmfit <- lm(df$y~df$x)
>>>>
>>>> Just btw: lm(y ~ x, data = df) is somewhat easier to read and also
easier
>>>> to write when the formula involves more regressors.
>>>>
>>>>> To test for Heteroskedasticity, I run the BPtest:
>>>>>
>>>>>> bptest(lmfit)
>>>>>
>>>>>        studentized Breusch-Pagan test
>>>>>
>>>>> data:  lmfit
>>>>> BP = 11.6768, df = 1, p-value = 0.0006329
>>>>>
>>>>> From the above, if I'm interpreting this correctly, there is
>>>>> Heteroskedasticity present.  To correct for this, I need to calculate
>>>>> robust error terms.
>>>>
>>>> That is one option. Another one would be using WLS instead of OLS - or
>>>> maybe FGLS. As the model just has one regressor, this might be possible
>>>> and result in a more efficient estimate than OLS.
>>>
>>> I thought that WLS (which I guessing is a weighted regression) is really
>>> only useful when you know or at least have an idea of what is causing
the
>>> Heteroskedasticity?
>>
>> Yes. But with only a single variable that shouldn't be too hard to do.
Also
>> in the Breusch-Pagan test you specify a hypothesized functional form for
>> the variance.
>>
>>> I'm not familiar with FGLS.
>>
>> There is a worked example in
>>
>>   demo("Ch-LinearRegression", package = "AER")
>>
>> The corresponding book has some more details.
>>
>> hth,
>> Z
>>
>>> I plan on adding additional independent variables as I get more
>>> comfortable with everything.
>>>
>>>>
>>>>> From my reading on this list, it seems like I need to vcovHC.
>>>>
>>>> That's another option, yes.
>>>>
>>>>>> vcovHC(lmfit)
>>>>>              (Intercept)         df$x
>>>>> (Intercept)  1.057460e-03 -4.961118e-05
>>>>> df$x       -4.961118e-05  2.378465e-06
>>>>>
>>>>> I'm having a little bit of a hard time following the help pages.
>>>>
>>>> Yes, the manual page is somewhat technical but the first thing the
>>>> "Details" section does is: It points you to some references that should
>>>> be easier to read. I recommend starting with
>>>>
>>>>      Zeileis A (2004), Econometric Computing with HC and HAC Covariance
>>>>      Matrix Estimators. _Journal of Statistical Software_, *11*(10),
>>>>      1-17. URL <URL: http://www.jstatsoft.org/v11/i10/>.
>>>
>>> I will look into that.
>>>
>>> Thanks,
>>> Mojo
>>>
>>>
>
> If I were to use vcovHAC instead of vcovHC, does that correct for serial
> correlation as well as Heteroskedasticity?

Yes, as the name (HAC = Heteroskedasticity and Autocorrelation Consistent)
conveys. But for details please read the papers that accompany the
software package and the original references cited therein.
Z

> Thanks,
> Mojo
>



------------------------------

Message: 32
Date: Fri, 21 Jan 2011 21:23:27 +0530
From: "Bogaso Christofer" <bogaso.christofer@gmail.com>
To: "'jim holtman'" <jholtman@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] How to look into the asterisked function?
Message-ID: <005001cbb983$5aa358e0$0fea0aa0$@gmail.com>
Content-Type: text/plain;       charset="iso-8859-1"

Thanks Jim and Henrique for your replies. I would like to know why some
particular functions are asterisked? What is the pros and cons while making
a typical UDF asterisked? How can I make a typical function asterisked? For
example print.anova() is not asterisked however print.acf() is. How can I
make print.anova() asterisked?

Thanks and regards,

-----Original Message-----
From: jim holtman [mailto:jholtman@gmail.com]
Sent: 21 January 2011 18:20
To: Bogaso Christofer
Cc: r-help@r-project.org
Subject: Re: [R] How to look into the asterisked function?

You can also use:

getAnywhere("functionName")


On Fri, Jan 21, 2011 at 8:02 AM, Bogaso Christofer
<bogaso.christofer@gmail.com> wrote:
> Hi friends, there is methods() function to see the all available
> methods for a particular function, for example:
>
>
>
>> head(methods("print"))
>
> [1] "print.acf" ? ? "print.anova" ? "print.aov" ? ? "print.aovlist"
> "print.ar" ? ? ?"print.Arima"
>
>
>
> In this list, there are some functions which are asterisked like
> print.acf(). How can I see the contents of those function?
>
>
>
> Thanks and regards,
>
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?



------------------------------

Message: 33
Date: Fri, 21 Jan 2011 10:37:17 -0500
From: "John Fox" <jfox@mcmaster.ca>
To: "'Rosario Garcia Gil'" <M.Rosario.Garcia@slu.se>
Cc: r-help@r-project.org
Subject: Re: [R] Error in ANOVA for model comparison
Message-ID: <002601cbb981$15e1cb30$41a56190$@mcmaster.ca>
Content-Type: text/plain;       charset="us-ascii"

Dear Rosario,

Because of missing data in the additional variable PHt, the two models
weren't fit to the same subset of valid observations -- the default in lm()
is to use complete cases for the variables in the model.

A mechanical solution is to use na.omit() to filter your data set, only for
the variables you intend to use, to produce a data set with no NAs. Then
you'll fit each model to a consistent subset of valid cases.

Of course, if you have a substantial amount of missing data, complete-case
analysis is probably a poor strategy.

I hope this helps,
 John

--------------------------------
John Fox
Senator William McMaster
 Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox




> -----Original Message-----
> From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org]
> On Behalf Of Rosario Garcia Gil
> Sent: January-21-11 9:31 AM
> To: r-help@r-project.org
> Subject: [R] Error in ANOVA for model comparison
>
> Hello
>
> I am trying to compare two models using anova(), however I get a message
> error (see below).
> In the net I only found some information on certain library(car) for
> which one should use anova with A capital letter (Anova instead of
> anova), but I could not find car library as it says it does not exist.
>
>
> > Model <- lm(interceptG ~ SW + TSC + FSC + PF + SlopeG + K,
> data=AllTrait)
> > Model1 <- lm(interceptG ~ SW + TSC + FSC + PF + SlopeG + PHt,
> data=AllTrait)
>
> Error in anova.lmlist(object, ...) :
>   models were not all fitted to the same size of dataset
>
> I have NA in the datafile, should that be the problem?
>
> Kind regards and thanks in advance
> Rosario
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



------------------------------

Message: 34
Date: Fri, 21 Jan 2011 07:07:36 -0800 (PST)
From: pete <pieroleone@hotmail.it>
To: r-help@r-project.org
Subject: [R] clustering fuzzy
Message-ID: <1295622456781-3229853.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


hello,
i'm pete ,how can i order rows of matrix by max to min value?
I have a matrix of membership degrees, with 82 (i) rows and K coloumns, K
are clusters.
I need first and second largest elements of the i-th row.

for example
1  0.66 0.04 0.01 0.30
2  0.02 0.89 0.09 0.00
3  0.06 0.92 0.01 0.01
4  0.07 0.71 0.21 0.01
5  0.10 0.85 0.04 0.01
6  0.91 0.04 0.02 0.02
7  0.00 0.01 0.98 0.00
8  0.02 0.05 0.92 0.01
9  0.05 0.54 0.40 0.01
10 0.02 0.06 0.92 0.00
11 0.05 0.55 0.39 0.01
12 0.77 0.02 0.01 0.20
13 0.95 0.01 0.00 0.04
14 0.43 0.33 0.18 0.06
15 0.79 0.10 0.08 0.03
18 0.02 0.04 0.94 0.00
20 0.09 0.15 0.76 0.01
21 0.80 0.10 0.07 0.03
22 0.06 0.15 0.79 0.01
23 0.05 0.01 0.00 0.94
24 0.83 0.02 0.01 0.15
25 0.87 0.05 0.03 0.04
27 0.76 0.10 0.11 0.03
28 0.17 0.68 0.10 0.05
29 0.10 0.01 0.00 0.90
30 0.09 0.29 0.60 0.01
31 0.05 0.01 0.00 0.94
32 0.53 0.04 0.01 0.43
33 0.85 0.04 0.02 0.09
34 0.82 0.06 0.02 0.10
35 0.76 0.07 0.02 0.14
37 0.36 0.31 0.30 0.02
38 0.01 0.02 0.97 0.00
39 0.12 0.04 0.02 0.82
40 0.02 0.00 0.00 0.97
41 0.57 0.15 0.02 0.25
42 0.14 0.03 0.02 0.82
43 0.89 0.06 0.01 0.03
44 0.02 0.00 0.00 0.98
45 0.61 0.02 0.01 0.36
46 0.03 0.00 0.00 0.97
47 0.88 0.07 0.02 0.03
48 0.06 0.60 0.32 0.02
49 0.01 0.98 0.01 0.00
50 0.06 0.88 0.05 0.01
51 0.01 0.05 0.93 0.00
52 0.02 0.08 0.90 0.00
53 0.11 0.01 0.01 0.87
54 0.27 0.01 0.00 0.72
55 0.94 0.03 0.01 0.02
58 0.45 0.41 0.05 0.09
59 0.12 0.61 0.22 0.05
60 0.26 0.07 0.02 0.64
61 0.17 0.19 0.62 0.02
62 0.08 0.00 0.00 0.92
63 0.02 0.94 0.03 0.00
64 0.08 0.01 0.00 0.91
65 0.98 0.01 0.00 0.01
67 0.22 0.69 0.08 0.01
68 0.96 0.02 0.00 0.02
69 0.96 0.02 0.01 0.01
71 0.00 0.01 0.98 0.00
72 0.56 0.05 0.01 0.37
73 0.10 0.01 0.01 0.88
74 0.91 0.01 0.00 0.08
75 0.36 0.38 0.21 0.05
76 0.15 0.40 0.44 0.01
77 0.02 0.06 0.91 0.00
78 0.48 0.43 0.03 0.06
79 0.51 0.02 0.01 0.45
80 0.04 0.01 0.00 0.95
81 0.47 0.03 0.01 0.49
82 0.98 0.01 0.00 0.01
83 0.05 0.01 0.01 0.93
84 0.03 0.00 0.00 0.96
85 0.76 0.07 0.01 0.15
86 0.95 0.03 0.01 0.01
88 0.03 0.00 0.00 0.96
90 0.79 0.13 0.02 0.06
91 0.37 0.50 0.05 0.09
92 0.86 0.10 0.02 0.02
93 0.13 0.82 0.03 0.01


 A[1,][order(A[1,],decreasing=TRUE)]
[1] 0.66 0.30 0.04 0.01

I want this for every row
thank you
--
View this message in context:
http://r.789695.n4.nabble.com/clustering-fuzzy-tp3229853p3229853.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 35
Date: Fri, 21 Jan 2011 14:16:47 -0200
From: Henrique Dallazuanna <wwwhsd@gmail.com>
To: Den <d.kazakiewicz@gmail.com>
Cc: R-help <r-help@r-project.org>
Subject: Re: [R] complex transformation of data
Message-ID:
       <AANLkTi=XKn0tXyszgPbown1RyjjD70nfL_j3d4VVLErN@mail.gmail.com>
Content-Type: text/plain

Try this:

aggregate(.~ id, lapply(test, as.character), FUN = paste, collapse = "")

On Fri, Jan 21, 2011 at 10:25 AM, Den <d.kazakiewicz@gmail.com> wrote:

> Dear [R] people
> Could you please help with following data transformation.
> Any suggestions, hints, references and even guessing on performing any
> of the following steps are highly appreciated. Those transformations are
> crucial for my work.
>
> (n_, _n, j_, k_ signify numbers)
>
> SOURCE DATA:
> id      cycle1  cycle2  cycle3  …       cycle_n
> 1       c       c       c               c
> 1       m       m       m               m
> 1       f       f       f               f
> 2       m       m       m               NA
> 2       f       f       f               NA
> 2       c       c       c               NA
> 3       a       a       NA              NA
> 3       c       c       c               NA
> 3       f       f       f               NA
> 3       NA      NA      m               NA
> ...........................................
>
>
>
> RESULT DATA1:
> id      cyc1    cyc2    cyc3    …       cyc_n
> 1       cfm     cfm     cfm             cfm
> 2       cfm     cfm     cfm             NA
> 3       acf     acf     cfm             NA
> ...........................................
>
>
> RESULT DATA2:
> id      treatment
> 1       n_cfm
> 2       j_cfm
> 3       2acf->k_cfm
> ...................
>
>
> RESULT DATA3:
> id      regimen numOfCycles
> 1       cfm     n_
> 2       cfm     j_
> 3       asf->cfm        {2+k_}
> .............................
>
>
>
> Thank you
> Denis
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

       [[alternative HTML version deleted]]



------------------------------

Message: 36
Date: Fri, 21 Jan 2011 11:33:15 -0500
From: jim holtman <jholtman@gmail.com>
To: pete <pieroleone@hotmail.it>
Cc: r-help@r-project.org
Subject: Re: [R] clustering fuzzy
Message-ID:
       <AANLkTimB1G9K8TjhVwH__mp6iQHavKiQAxw_9tYyLsCA@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

use 'apply':

> head(x.m)
      V2   V3   V4   V5
[1,] 0.66 0.04 0.01 0.30
[2,] 0.02 0.89 0.09 0.00
[3,] 0.06 0.92 0.01 0.01
[4,] 0.07 0.71 0.21 0.01
[5,] 0.10 0.85 0.04 0.01
[6,] 0.91 0.04 0.02 0.02
> x.m.sort <- apply(x.m, 1, sort, decreasing = TRUE)
> head(t(x.m.sort))
    [,1] [,2] [,3] [,4]
[1,] 0.66 0.30 0.04 0.01
[2,] 0.89 0.09 0.02 0.00
[3,] 0.92 0.06 0.01 0.01
[4,] 0.71 0.21 0.07 0.01
[5,] 0.85 0.10 0.04 0.01
[6,] 0.91 0.04 0.02 0.02
>


On Fri, Jan 21, 2011 at 10:07 AM, pete <pieroleone@hotmail.it> wrote:
>
> hello,
> i'm pete ,how can i order rows of matrix by max to min value?
> I have a matrix of membership degrees, with 82 (i) rows and K coloumns, K
> are clusters.
> I need first and second largest elements of the i-th row.
>
> for example
> 1 ?0.66 0.04 0.01 0.30
> 2 ?0.02 0.89 0.09 0.00
> 3 ?0.06 0.92 0.01 0.01
> 4 ?0.07 0.71 0.21 0.01
> 5 ?0.10 0.85 0.04 0.01
> 6 ?0.91 0.04 0.02 0.02
> 7 ?0.00 0.01 0.98 0.00
> 8 ?0.02 0.05 0.92 0.01
> 9 ?0.05 0.54 0.40 0.01
> 10 0.02 0.06 0.92 0.00
> 11 0.05 0.55 0.39 0.01
> 12 0.77 0.02 0.01 0.20
> 13 0.95 0.01 0.00 0.04
> 14 0.43 0.33 0.18 0.06
> 15 0.79 0.10 0.08 0.03
> 18 0.02 0.04 0.94 0.00
> 20 0.09 0.15 0.76 0.01
> 21 0.80 0.10 0.07 0.03
> 22 0.06 0.15 0.79 0.01
> 23 0.05 0.01 0.00 0.94
> 24 0.83 0.02 0.01 0.15
> 25 0.87 0.05 0.03 0.04
> 27 0.76 0.10 0.11 0.03
> 28 0.17 0.68 0.10 0.05
> 29 0.10 0.01 0.00 0.90
> 30 0.09 0.29 0.60 0.01
> 31 0.05 0.01 0.00 0.94
> 32 0.53 0.04 0.01 0.43
> 33 0.85 0.04 0.02 0.09
> 34 0.82 0.06 0.02 0.10
> 35 0.76 0.07 0.02 0.14
> 37 0.36 0.31 0.30 0.02
> 38 0.01 0.02 0.97 0.00
> 39 0.12 0.04 0.02 0.82
> 40 0.02 0.00 0.00 0.97
> 41 0.57 0.15 0.02 0.25
> 42 0.14 0.03 0.02 0.82
> 43 0.89 0.06 0.01 0.03
> 44 0.02 0.00 0.00 0.98
> 45 0.61 0.02 0.01 0.36
> 46 0.03 0.00 0.00 0.97
> 47 0.88 0.07 0.02 0.03
> 48 0.06 0.60 0.32 0.02
> 49 0.01 0.98 0.01 0.00
> 50 0.06 0.88 0.05 0.01
> 51 0.01 0.05 0.93 0.00
> 52 0.02 0.08 0.90 0.00
> 53 0.11 0.01 0.01 0.87
> 54 0.27 0.01 0.00 0.72
> 55 0.94 0.03 0.01 0.02
> 58 0.45 0.41 0.05 0.09
> 59 0.12 0.61 0.22 0.05
> 60 0.26 0.07 0.02 0.64
> 61 0.17 0.19 0.62 0.02
> 62 0.08 0.00 0.00 0.92
> 63 0.02 0.94 0.03 0.00
> 64 0.08 0.01 0.00 0.91
> 65 0.98 0.01 0.00 0.01
> 67 0.22 0.69 0.08 0.01
> 68 0.96 0.02 0.00 0.02
> 69 0.96 0.02 0.01 0.01
> 71 0.00 0.01 0.98 0.00
> 72 0.56 0.05 0.01 0.37
> 73 0.10 0.01 0.01 0.88
> 74 0.91 0.01 0.00 0.08
> 75 0.36 0.38 0.21 0.05
> 76 0.15 0.40 0.44 0.01
> 77 0.02 0.06 0.91 0.00
> 78 0.48 0.43 0.03 0.06
> 79 0.51 0.02 0.01 0.45
> 80 0.04 0.01 0.00 0.95
> 81 0.47 0.03 0.01 0.49
> 82 0.98 0.01 0.00 0.01
> 83 0.05 0.01 0.01 0.93
> 84 0.03 0.00 0.00 0.96
> 85 0.76 0.07 0.01 0.15
> 86 0.95 0.03 0.01 0.01
> 88 0.03 0.00 0.00 0.96
> 90 0.79 0.13 0.02 0.06
> 91 0.37 0.50 0.05 0.09
> 92 0.86 0.10 0.02 0.02
> 93 0.13 0.82 0.03 0.01
>
>
> ?A[1,][order(A[1,],decreasing=TRUE)]
> [1] 0.66 0.30 0.04 0.01
>
> I want this for every row
> thank you
> --
> View this message in context:
http://r.789695.n4.nabble.com/clustering-fuzzy-tp3229853p3229853.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?



------------------------------

Message: 37
Date: Fri, 21 Jan 2011 09:34:40 -0800
From: Hongwei Dong <pdxdong@gmail.com>
To: r-help@r-project.org
Subject: [R] Maxiter specification in R
Message-ID:
       <AANLkTin8WeDn2dX+UiQRFLPjv_+4HNkMp2__Ew3MLnyQ@mail.gmail.com<AANLkTin8WeDn2dX%2BUiQRFLPjv_%2B4HNkMp2__Ew3MLnyQ@mail.gmail.com>
>
Content-Type: text/plain

Dear R users,

I'm having a problem with maxiter specification in VGLM function. I tried to
increase the number of iteration to 100, but it still stopped at 30, which
is the default. Here is my script:

FIT <- vglm(SFH_PCT ~ RD_DEN + CAR_HH + TRS + RES_L, tobit(Lower=0), maxiter
= 100)

Thanks

Gary

       [[alternative HTML version deleted]]



------------------------------

Message: 38
Date: Fri, 21 Jan 2011 12:49:59 -0500
From: David Winsemius <dwinsemius@comcast.net>
To: Hongwei Dong <pdxdong@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Maxiter specification in R
Message-ID: <92440801-393A-4E6A-A573-75007CCC4413@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Jan 21, 2011, at 12:34 PM, Hongwei Dong wrote:

> Dear R users,
>
> I'm having a problem with maxiter specification in VGLM function. I
> tried to
> increase the number of iteration to 100, but it still stopped at 30,
> which
> is the default. Here is my script:
>
> FIT <- vglm(SFH_PCT ~ RD_DEN + CAR_HH + TRS + RES_L, tobit(Lower=0),
> maxiter
> = 100)

?vglm.control

>
--

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 39
Date: Fri, 21 Jan 2011 11:57:36 -0600
From: Terry Therneau <therneau@mayo.edu>
To: Hongwei Dong <pdxdong@gmail.com>
Cc: "r-help@lists.R-project.org" <r-help@r-project.org>
Subject: Re: [R] number of iterations in a Tobit model
Message-ID: <1295632656.840.12.camel@punchbuggy>
Content-Type: text/plain

-- begin inclusion ---
I'm running a Tobit model but convergence can not be reached within 30
iterations. Is there anyway I can change the max number of iterations?
Thanks.
--- end inclusion ---

"Tobit" is simply a linear model with censored data.  You don't say how
you are fitting this, but I'll assume you are using survreg
       fit <- survreg(Surv(time, status) ~ x1 + x2, dist='gaussian',..)
with appropriate additional arguments to the Surv function if the data
is left or interval censored.

 If survreg doesn't converge in 30 iterations it likely won't converge
in 100 or more. The Newton-Raphson algoritm has gotton lost.  Data sets
with a very large fraction of censored observations can be numerically
challenging.  help(survreg.control) will tell you all the necessary
details however.
 Over the years I have accumulated a few data sets that were very
difficult maximizations for survreg, and led to further tuning of the
underlying algorithm.  Yours would be the first new one in a while; if
you are willing to share it that would help me track down the issue.
You likely will need to use specific starting estimates.

 If you are not using survreg, try it.  Perhaps it is already robust
enough for your data.

Terry Therneau



------------------------------

Message: 40
Date: Fri, 21 Jan 2011 13:12:01 -0500
From: "Liaw, Andy" <andy_liaw@merck.com>
To: "Czerminski, Ryszard" <Ryszard.Czerminski@astrazeneca.com>,
       <r-help@stat.math.ethz.ch>
Subject: Re: [R] randomForest: too many elements specified?
Message-ID:
       <B10BAA7D28D88B45AF82813C4A6FFA93F35A1C@usctmx1157.merck.com>
Content-Type: text/plain; charset="us-ascii"

I grep for "n, n)" in all the R code of the package (current version),
and the only place that happens is in creating proximity.  Can you do a
traceback() and see where it happens?

You should seriously consider upgrading R and the packages...

Andy

> -----Original Message-----
> From: r-help-bounces@r-project.org
> [mailto:r-help-bounces@r-project.org] On Behalf Of Czerminski, Ryszard
> Sent: Thursday, January 20, 2011 1:08 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] randomForest: too many elements specified?
>
> I getting "Error in matrix(0, n, n) : too many elements specified"
> while building randomForest model, which looks like memory allocation
> error.
> Software versions are: randomForest 4.5-25, R version 2.7.1
>
> Dataset is big (~90K rows, ~200 columns), but this is on a
> big machine (
> ~120G RAM)
> and I call randomForest like this: randomForest(x,y)
> i.e. in supervised mode and not requesting proximity matrix, therefore
> answer from Andy Liaw to an email reporting the same problems in 2005
> (see below)
> is probably not directly applicable, still it looks like it is too big
> data set for this dataset/machine combination.
>
> How does memory usage in randomForest scale with dataset size?
> Is there a way to build global rf model with dataset of this size?
>
> Best regards,
> Ryszard
>
> Ryszard Czerminski
> AstraZeneca Pharmaceuticals LP
> 35 Gatehouse Drive
> Waltham, MA 02451
> USA
> 781-839-4304
> ryszard.czerminski@astrazeneca.com
>
> RE: [R] randomForest: too many element specified?
> Liaw, Andy
> Mon, 17 Jan 2005 05:56:28 -0800
> > From: luk
> >
> > When I run randonForest with a 169453x5 matrix, I got the
> > following message.
> >
> > Error in matrix(0, n, n) : matrix: too many elements specified
> >
> > Can you please advise me how to solve this problem?
> >
> > Thanks,
> >
> > Lu
>
> 1.  When asking new questions, please don't reply to other posts.
>
> 2.  When asking questions like these, please do show the commands you
> used.
>
> My guess is that you asked for the proximity matrix, or is running
> unsupervised randomForest (by not providing a response vector).  This
> will
> requires a couple of n by n matrices to be created (on top of other
> things),
> n being 169453 in this case.  To store a 169453 x 169453 matrix in
> double
> precision, you need 169453^2 * 8 bytes, or or nearly 214 GB of memory.
> Even
> if you have that kind of hardware, I doubt you'll be able to make much
> sense
> out of the result.
>
> Andy
>
>
>
> --------------------------------------------------------------
> ------------
> Confidentiality Notice: This message is private and may
> ...{{dropped:11}}
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
Notice:  This e-mail message, together with any attachme...{{dropped:11}}



------------------------------

Message: 41
Date: Fri, 21 Jan 2011 12:24:55 -0600
From: Douglas Bates <bates@stat.wisc.edu>
To: kamel gaanoun <kamel.gaanoun@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] nlminb doesn't converge and produce a warning
Message-ID:
       <AANLkTim+jfw35CxwxBoKOhtz45Hk7t7rSt5PZxsXeNc6@mail.gmail.com<AANLkTim%2Bjfw35CxwxBoKOhtz45Hk7t7rSt5PZxsXeNc6@mail.gmail.com>
>
Content-Type: text/plain; charset=ISO-8859-1

On Fri, Jan 21, 2011 at 3:51 AM, kamel gaanoun <kamel.gaanoun@gmail.com>
wrote:
> Hi Everybody,
>
> My problem is that nlminb doesn't converge, in minimising a logLikelihood
> function, with 31*6 parameters(2 weibull parameters+29 regressors repeated
6
> times).

Hmm, the length of the parameter vector shown below is 189, which is
neither 31*6 nor 2 + 29*6.

I suppose it is possible to do nonlinear optimization with box
constraints on such a large number of parameters but you should expect
it to take a long time and perhaps a lot of memory.  Even if the
optimizer converges, it would be optimistic to expect that the
parameter value returned is necessarily the global optimum.  I would
recommend trying to simplify the optimization problem.  A method like
this is just using the computer as a blunt instrument with which to
bludgeon the problem to death (sometimes called the "SAS approach").

>
>
> I use nlminb like this :
> res1<-nlminb(vect, V, lower=c(rep(0.01, 12), rep(0.01, 3), rep(-Inf,
n-15)),
> upper=c(rep(Inf, 12), rep(0.99, 3), rep(Inf, n-15)), control =
> list(maxit=1000) )
>
> and that's the result :
>
> Message d'avis :
> In nlminb(vect, V, lower = c(rep(0.01, 12), rep(0.01, 3), rep(-Inf, ?:
> ?unrecognized control element(s) named `maxit' ignored
>> res1
> $par
> ?[1] ? 2.48843979 ? 4.75209125 ? 2.57199837 ?16.80712783 ? 3.15211075
> 16.86606178 ?58.61925499 ?37.85793462 ?48.78215699
> ?[10] 151.64638501 ?43.60420299 ?15.14639541 ? 0.58754382 ? 0.76180935
> 0.66191763 ?-0.26802757 ?-0.96378197 ?-0.68369525
> ?[19] ? 0.37813096 ? 0.89778593 -10.26471908 ?-0.87265813 ? 6.43973968
> -1.74417166 ?12.00193419 ? 0.60638326 ?-1.66675589
> ?[28] ? 1.29312079 ? 1.39846863 ?-0.48449361 ?20.14470193 ?-0.50729841
> -2.15177967 ?-0.78155345 ? 0.41857810 ?-0.40863744
> ?[37] -17.18489562 ?-1.69140562 ? 1.45236861 ?-0.23738183 ? 5.47688642
> -0.71546576 ? 9.95015047 ?-2.16096138 ?-0.74503151
> ?[46] ?-0.66258461 ? 5.38871217 ? 2.53147752 -12.58827379 ?-0.45669589
> -0.37285088 ? 2.15116198 ?-2.50414066 ?-0.99752892
> ?[55] ? 4.83972450 ?-1.16496925 ?-3.53429528 ? 0.56083677 ?-9.87490932
> -1.75153657 ? 9.87912224 ?-0.75783517 ?-9.95423392
> ?[64] ?-0.07530469 ?-0.73466191 ?-0.27397382 ?15.15891548 ?-0.02489436
> 12.91493065 ?-4.65335356 ? 0.03524561 ? 0.00000000
> ?[73] ?-9.06720312 ?-0.25413758 ?-0.18578765 ? 0.53283198 ?-4.02688497
> -0.50581412 ?-0.31544940 ? 0.57450848 ? 6.15206152
> ?[82] ? 0.08178377 ? 0.82978606 ? 0.39337352 ?-3.65304712 ?-0.06833839
> 3.87790848 ?-1.08017043 ? 3.62779184 ?-0.14700541
> ?[91] -13.95610827 ?-1.50385432 ? 8.05851743 ?-1.24250013 ?-0.01249817
> 0.38085483 ?-4.97064573 ?-0.98852401 ?-3.00305183
> [100] ? 0.35053875 ?-4.26833889 ?-0.12463188 ?16.05828402 ? 0.41736764
> -0.94678922 ?-0.75813452 ? 2.15378348 ? 0.39586048
> [109] ? 1.41359441 ? 0.81603207 ?-4.43963958 ?-0.79438435 ? 0.49530882
> 0.11197484 ?-8.43196798 ? 1.00456535 -22.04423030
> [118] ?-0.11532887 ? 2.58085765 ? 1.41912515 ?-0.78120889 ?-1.23850824
> 12.39079062 ? 0.23567444 ? 1.39557879 ?-2.22993802
> [127] -12.58827379 ?-0.45669589 ?-0.37285088 ?-0.73563805 ? 3.40201735
> 0.58550247 ?-3.62769828 ? 0.21657740 ?-7.37785506
> [136] ?-0.68218180 ? 6.41876225 ? 0.38708385 ?-0.33009429 ?-0.25230736
> 3.53672719 ? 1.53676202 ? 3.65074513 ? 0.42623602
> [145] ?-7.26982010 ? 0.70597611 -23.15198788 ?-0.36822845 ?-2.29863267
> 0.70223129 -14.45665129 ?-0.54094864 ?-2.17858443
> [154] ?-0.56501734 ? 2.50032796 ?-0.45677181 ?12.04113439 ?-1.42294094
> -16.16874444 ?-0.49101846 ?-6.29724769 ?-1.38333722
> [163] -14.16552579 ? 1.57502968 ? 5.04329383 ? 0.24857745 ?-1.69885428
> -0.46757266 ? 4.41795651 ?-2.41006349 ? 4.61648610
> [172] ? 0.42235314 ?-3.22153895 ?-0.15443857 ? 1.07661101 ?-0.63653449
> -2.74034265 ? 0.20898466 ? 1.37927183 ? 0.26722477
> [181] -15.09685067 ? 0.87160467 -24.79722150 ? 1.48810684 ? 1.70068893
> -0.22538026 ? 7.63908028 ? 1.60431981 ?-7.52661064
>
> $objective
> [1] 1514.691
>
> $convergence
> [1] 1
>
> $message
> [1] "iteration limit reached without convergence (9)"
>
> $iterations
> [1] 150
>
> $evaluations
> function gradient
> ? ? 176 ? ?44935
>
> I tried many times to take the res1$par as initial values and retry againe
> but still doesn't converge.
>
>
> Any help will save me Thanks
>
> --
> Kamel Gaanoun
> (+33) (0)6.76.04.65.77
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



------------------------------

Message: 42
Date: Fri, 21 Jan 2011 13:26:52 -0500
From: "Ravi Varadhan" <rvaradhan@jhmi.edu>
To: "'Karl Ove Hufthammer'" <karl@huftis.org>,
       <r-help@stat.math.ethz.ch>
Subject: Re: [R] nlminb doesn't converge and produce a warning
Message-ID: <001801cbb998$c646b000$52d41000$@edu>
Content-Type: text/plain;       charset="utf-8"

Hi,

It is indeed annoying that each optimization code has different names for
the parameters that control the behavior of the algorithms.  This is one of
the reasons that we have developed "optimx" - to unify the calling
convention for the various algorithms.  You can call the optimization
algorithm of your choice without having to worry about the names of the
control parameters.

Ravi.

-------------------------------------------------------
Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology School of Medicine Johns
Hopkins University

Ph. (410) 502-2619
email: rvaradhan@jhmi.edu

-----Original Message-----
From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org] On
Behalf Of Karl Ove Hufthammer
Sent: Friday, January 21, 2011 6:48 AM
To: r-help@stat.math.ethz.ch
Subject: Re: [R] nlminb doesn't converge and produce a warning

kamel gaanoun wrote:

> I use nlminb like this :
> res1<-nlminb(vect, V, lower=c(rep(0.01, 12), rep(0.01, 3), rep(-Inf,
> n-15)), upper=c(rep(Inf, 12), rep(0.99, 3), rep(Inf, n-15)), control =
> list(maxit=1000) )
>
> and that's the result :
>
> Message d'avis :
> In nlminb(vect, V, lower = c(rep(0.01, 12), rep(0.01, 3), rep(-Inf,  :
> unrecognized control element(s) named `maxit' ignored

Just increase the maximum number of iterations. Which you tried to do, but
didn?t succeed in, as the above warnings shows. The argument is called
?iter.max?, not ?max.iter?.

--
Karl Ove Hufthammer

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



------------------------------

Message: 43
Date: Fri, 21 Jan 2011 13:30:53 -0500
From: Duncan Murdoch <murdoch.duncan@gmail.com>
To: "D Kelly O'Day" <koday@processtrends.com>
Cc: r-help@r-project.org
Subject: Re: [R] Unexpected Gap in simple line plot
Message-ID: <4D39D0DD.6070805@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 20/01/2011 9:33 PM, D Kelly O'Day wrote:
> Bill&  Duncan
>
> Thanks for your quick reply. I would still be looking for days.
>
> Now I have to figure out how the bad data got into cts since I generate
this
> file each month.

When I read that .csv file in OpenOffice, the lines with the NAs arise
because the line before has an extra column.  That might be a hint as to
what's going wrong in the generation...

Duncan Murdoch



------------------------------

Message: 44
Date: Fri, 21 Jan 2011 19:41:50 +0100
From: JiHO <jo.lists@gmail.com>
To: R Help <r-help@stat.math.ethz.ch>
Subject: [R] Marginality rule between powers and interaction terms in
       lm()
Message-ID:
       <AANLkTi=kpqF6CqnXx=QFyYmToLuneaHVZhxrgPdJNRJ-@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Dear all,

I have a model with simple terms, quadratic effects, and interactions.
I am wondering what to do when a variable is involved in a significant
interaction and in a non-significant quadratic effect. Here is an
example

       d = data.frame(a=runif(20), b=runif(20))

       d$y = d$a + d$b^2

So I create both an simple effect of a and a quadratic effect of b.

       m = lm(y ~ a + b + I(a^2) + I(b^2) + a:b, data=d)
       drop1(m)
       ...
              Df Sum of Sq      RSS      AIC
       <none>              0.000000 -1487.56
       I(a^2)  1  0.000000 0.000000 -1482.04
       I(b^2)  1  0.098444 0.098444   -96.28
       a:b     1  0.000000 0.000000 -1488.37

Here R cleverly shows that I can drop a:b or any quadratic term
(suggesting that they have equal marginality?) but not simple terms
since they are marginal to the quadratic or the interaction terms. At
this point the interaction is not significant so the situation is
simple: drop a:b, then drop a^2 and then stop.

Now let's add an interaction

       d[d$b > 0.5, "y"] = d[d$b > 0.5, "y"] + 0.01*d[d$b > 0.5, "a"]

       m = lm(y ~ a + b + I(a^2) + I(b^2) + a:b, data=d)
       summary(m)
       ...
       (Intercept) -3.275e-04  1.585e-03  -0.207  0.83932
       a            9.988e-01  5.839e-03 171.070  < 2e-16 ***
       b           -1.613e-04  5.492e-03  -0.029  0.97698
       I(a^2)      -6.515e-05  5.159e-03  -0.013  0.99010
       I(b^2)       1.001e+00  4.892e-03 204.593  < 2e-16 ***
       a:b          1.191e-02  3.221e-03   3.698  0.00238 **

Now the interaction *is* significant, but a^2 still isn't. drop1()
still suggests that I can remove either the interaction or the
quadratic terms:

       drop1(m)
       ...
              Df Sum of Sq      RSS      AIC
       <none>              0.000033 -254.306
       I(a^2)  1  0.000000 0.000033 -256.306
       I(b^2)  1  0.098611 0.098644  -96.239
       a:b     1  0.000032 0.000065 -242.674

However, this: http://www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf
suggests that marginality rules between powers of variables might not
be implemented (although they might have been since 2000).

My question is: I am "allowed", according to marginality rules, to remove
a^2?

I have found plenty of information on how the coefficients
corresponding to single terms change meaning when a quadratic term or
an interation is involved, and why they should not be removed in most
circumstances. I haven't found anything related to quadratic vs.
interactions.

Thanks in advance for your help. Sincerely,

JiHO
---
http://maururu.net



------------------------------

Message: 45
Date: Fri, 21 Jan 2011 13:47:49 -0500
From: Xebar Saram <zeltakc@gmail.com>
To: r-help@stat.math.ethz.ch
Subject: [R] extracting random intercept
Message-ID:
       <AANLkTinn8jvWmEg2kpL+WW-EKOU7Cd8DtFAr8BJirGo0@mail.gmail.com<AANLkTinn8jvWmEg2kpL%2BWW-EKOU7Cd8DtFAr8BJirGo0@mail.gmail.com>
>
Content-Type: text/plain

Hi all

I am using this model for a time series analysis :

lung_new <- (glmmPQL(LUNG ~ 1, random = ~ 1 | GUID, family = poisson, data =
ts0004lag)

Im interested in extracting just the random intercept

can anyone point me in the right direction

thx

zeltak

       [[alternative HTML version deleted]]



------------------------------

Message: 46
Date: Fri, 21 Jan 2011 13:51:00 -0500
From: Xebar Saram <zeltakc@gmail.com>
To: r-help@stat.math.ethz.ch
Subject: [R] Extracting random intercept
Message-ID:
       <AANLkTi=-Q6wuH3iUKZZDL4TDDAo5y7K6YZ-T-dv4AA7E@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi all
I am using this model for a time series analysis :
lung_new <- (glmmPQL(LUNG ~ 1, random = ~ 1 | GUID, family = poisson,
data = ts0004lag)
Im?interested?in extracting just the random intercept
can anyone point me in the right direction
thx
zeltak



------------------------------

Message: 47
Date: Fri, 21 Jan 2011 11:29:56 -0800
From: "MacQueen, Don" <macqueen1@llnl.gov>
To: John Helly <hellyj@ucsd.edu>, "r-help@r-project.org"
       <r-help@r-project.org>
Subject: Re: [R] Inconsisten graphics i/o when using Rscript versus
       GUI
Message-ID: <C95F1EB4.6B3DB%macqueen1@llnl.gov<C95F1EB4.6B3DB%25macqueen1@llnl.gov>
>
Content-Type: text/plain

John,

The first thing I would do is create a simpler example, i.e., to help
isolate the issue. Here’s a simple example:

The contents of a file are:
--------------------------------------------
#! /usr/bin/Rscript

pdf('test1.pdf')
plot(1:10)
dev.off()

pdf('test2.pdf')
plot(10:1)
dev.off()
----------------------------------------------

With this file, I get both pdf files either way.

Since you’re using plotting functions from ggplot2, you may need to wrap
print() around the qplot() call in the second one. That is,

 print( qplot(fitted(profiles.spl), residuals(profiles.spl)) )

The ‘null device’ message is what dev.off() returns, as in this example:

> x11()
> dev.off()
null device
         1

So it’s not relevant. However, with my simple example above, I get the ‘null
device’ message twice when I run it as an Rscript.

What’s the first line of your file look like? Try including the     --
restore     option, if you have not already:

#! /usr/bin/Rscript —restore

Your .RData file is not automatically loaded with Rscript, and the plot that
isn’t happening may depend on some object that is loaded from .RData.
Although, in that case, I would expect an error message.

-Don


On 1/20/11 6:53 PM, "John Helly" <hellyj@ucsd.edu> wrote:

Hi.

I'm running R OS X GUI 1.35-dev Leopard build 64-bit.  When I run the
following code (snippet from a larger code) from the GUI I obtain 2 separate
*.pdf files as you would expect from the high-lighted code.  However, when I
run from Rscript (command-line), I only get the first one.  No errors appear
in the console log however I do get a 'null device' message that I don't
understand.  It's probably related but I have no clue how to debug this.
 Perhaps the second output file is not getting initialized?  I've tried a
few variations to see if I can unearth the cause but no joy so far.  Any
suggestions would be appreciated.

Thanks.
...

profiles.spl <- smooth.spline(x, y)
(profiles.spl)
x_pred = seq(1,as.integer(max(x)))
B = data.frame(predict(profiles.spl,x_pred))
pdf(file=paste("/Volumes/SLR_Data_001/USN_SERDP_SLR/data/level1/beach_profiles_Flick/",Filename,".pdf",sep=""))
caption = paste(aLocation," (", aYear,".",aMonth,".",aDay,")",sep="")
credits = paste("splineWriter.R / hellyj@ucsd.edu / 20110120")
xrng = range(x)
yrng = range(y)
pred = qplot(x,y, data=B, xlab="Distance (m)", ylab = "Elevation (m)",
xlim=c(0,1000), ylim=c(-12,4))
pred + geom_text(aes(700,2,label=caption)) +
geom_text(aes(180,-12,label=credits),size=2.7)
dev.off()
## Residual (Tukey Anscombe) plot:
pdf(file=paste("/Volumes/SLR_Data_001/USN_SERDP_SLR/data/level1/beach_profiles_Flick/",Filename,"TA.pdf",sep=""))
qplot(fitted(profiles.spl), residuals(profiles.spl))
dev.off()

...

--------------
John Helly, University of California, San Diego / San Diego Supercomputer
Center / Scripps Institution of Oceanography / stonesteps (Skype) /
stonesteps7 (iChat) / http://www.sdsc.edu/~hellyj<http://www.sdsc.edu/%7Ehellyj>
 [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
925 423-1062

       [[alternative HTML version deleted]]



------------------------------

Message: 48
Date: Fri, 21 Jan 2011 17:56:52 -0200
From: Henrique Dallazuanna <wwwhsd@gmail.com>
To: Den <d.kazakiewicz@gmail.com>
Cc: R-help <r-help@r-project.org>
Subject: Re: [R] complex transformation of data
Message-ID:
       <AANLkTimDWVc=NgAkvE6uv=+YH9Eg8nZjX0t3YHJ--SnQ@mail.gmail.com>
Content-Type: text/plain

Try this:

aggregate(.~ id, lapply(replace(df, is.na(df), ''), as.character), FUN =
paste, collapse = "", na.action = na.pass)

On Fri, Jan 21, 2011 at 5:45 PM, Den <d.kazakiewicz@gmail.com> wrote:

> Dear Henrique
> Thank you again for helping me
> Unfortunately, your code seems not to be working
>
> > aggregate(.~ id, lapply(df, as.character), FUN = paste, collapse = "")
>  id cycle1 cycle2 cycle3
> 1  1    cmf    cmf    cmf
> 2  2    mfc    mfc    mfc
> 3  3     cf     cf     cf
>
> (letter 'a' missing in df[3,c("cycle1",cycle2")]
>
> You suggested very interesting approach, however. Those '.~ id' and
> 'as.character' gave me hope for success.
> With very best regards
> Denis
>
>
> Ð£ ÐŸÑ Ñ‚, 21/01/2011 Ñƒ 14:16 -0200, Henrique Dallazuanna Ð¿Ñ–ÑˆÐ°:
> > Try this:
> >
> > aggregate(.~ id, lapply(test, as.character), FUN = paste, collapse =
> > "")
> >
> > On Fri, Jan 21, 2011 at 10:25 AM, Den <d.kazakiewicz@gmail.com> wrote:
> >         Dear [R] people
> >         Could you please help with following data transformation.
> >         Any suggestions, hints, references and even guessing on
> >         performing any
> >         of the following steps are highly appreciated. Those
> >         transformations are
> >         crucial for my work.
> >
> >         (n_, _n, j_, k_ signify numbers)
> >
> >         SOURCE DATA:
> >         id      cycle1  cycle2  cycle3  â€¦       cycle_n
> >         1       c       c       c               c
> >         1       m       m       m               m
> >         1       f       f       f               f
> >         2       m       m       m               NA
> >         2       f       f       f               NA
> >         2       c       c       c               NA
> >         3       a       a       NA              NA
> >         3       c       c       c               NA
> >         3       f       f       f               NA
> >         3       NA      NA      m               NA
> >         ...........................................
> >
> >
> >
> >         RESULT DATA1:
> >         id      cyc1    cyc2    cyc3    â€¦       cyc_n
> >         1       cfm     cfm     cfm             cfm
> >         2       cfm     cfm     cfm             NA
> >         3       acf     acf     cfm             NA
> >         ...........................................
> >
> >
> >         RESULT DATA2:
> >         id      treatment
> >         1       n_cfm
> >         2       j_cfm
> >         3       2acf->k_cfm
> >         ...................
> >
> >
> >         RESULT DATA3:
> >         id      regimen numOfCycles
> >         1       cfm     n_
> >         2       cfm     j_
> >         3       asf->cfm        {2+k_}
> >         .............................
> >
> >
> >
> >         Thank you
> >         Denis
> >
> >         ______________________________________________
> >         R-help@r-project.org mailing list
> >         https://stat.ethz.ch/mailman/listinfo/r-help
> >         PLEASE do read the posting guide
> >         http://www.R-project.org/posting-guide.html
> >         and provide commented, minimal, self-contained, reproducible
> >         code.
> >
> >
> >
> > --
> > Henrique Dallazuanna
> > Curitiba-ParanÃ¡-Brasil
> > 25Â° 25' 40" S 49Â° 16' 22" O
>
>
>


--
Henrique Dallazuanna
Curitiba-ParanÃ¡-Brasil
25Â° 25' 40" S 49Â° 16' 22" O

       [[alternative HTML version deleted]]



------------------------------

Message: 49
Date: Fri, 21 Jan 2011 18:00:42 -0200
From: Henrique Dallazuanna <wwwhsd@gmail.com>
To: Den <d.kazakiewicz@gmail.com>
Cc: R-help <r-help@r-project.org>
Subject: Re: [R] complex transformation of data
Message-ID:
       <AANLkTi=As7DvJ=fLKyJd8roiy8Sz-7GZN3sjB2CAf1WZ@mail.gmail.com>
Content-Type: text/plain

correction:
aggregate(.~ id, lapply(df, as.character), FUN = paste, collapse = "",
na.action = na.pass)

On Fri, Jan 21, 2011 at 5:56 PM, Henrique Dallazuanna <wwwhsd@gmail.com
>wrote:

> Try this:
>
> aggregate(.~ id, lapply(replace(df, is.na(df), ''), as.character), FUN =
> paste, collapse = "", na.action = na.pass)
>
>
> On Fri, Jan 21, 2011 at 5:45 PM, Den <d.kazakiewicz@gmail.com> wrote:
>
>> Dear Henrique
>> Thank you again for helping me
>> Unfortunately, your code seems not to be working
>>
>> > aggregate(.~ id, lapply(df, as.character), FUN = paste, collapse = "")
>>  id cycle1 cycle2 cycle3
>> 1  1    cmf    cmf    cmf
>> 2  2    mfc    mfc    mfc
>> 3  3     cf     cf     cf
>>
>> (letter 'a' missing in df[3,c("cycle1",cycle2")]
>>
>> You suggested very interesting approach, however. Those '.~ id' and
>> 'as.character' gave me hope for success.
>> With very best regards
>> Denis
>>
>>
>> Ð£ ÐŸÑ Ñ‚, 21/01/2011 Ñƒ 14:16 -0200, Henrique Dallazuanna Ð¿Ñ–ÑˆÐ°:
>> > Try this:
>> >
>> > aggregate(.~ id, lapply(test, as.character), FUN = paste, collapse =
>> > "")
>> >
>> > On Fri, Jan 21, 2011 at 10:25 AM, Den <d.kazakiewicz@gmail.com> wrote:
>> >         Dear [R] people
>> >         Could you please help with following data transformation.
>> >         Any suggestions, hints, references and even guessing on
>> >         performing any
>> >         of the following steps are highly appreciated. Those
>> >         transformations are
>> >         crucial for my work.
>> >
>> >         (n_, _n, j_, k_ signify numbers)
>> >
>> >         SOURCE DATA:
>> >         id      cycle1  cycle2  cycle3  â€¦       cycle_n
>> >         1       c       c       c               c
>> >         1       m       m       m               m
>> >         1       f       f       f               f
>> >         2       m       m       m               NA
>> >         2       f       f       f               NA
>> >         2       c       c       c               NA
>> >         3       a       a       NA              NA
>> >         3       c       c       c               NA
>> >         3       f       f       f               NA
>> >         3       NA      NA      m               NA
>> >         ...........................................
>> >
>> >
>> >
>> >         RESULT DATA1:
>> >         id      cyc1    cyc2    cyc3    â€¦       cyc_n
>> >         1       cfm     cfm     cfm             cfm
>> >         2       cfm     cfm     cfm             NA
>> >         3       acf     acf     cfm             NA
>> >         ...........................................
>> >
>> >
>> >         RESULT DATA2:
>> >         id      treatment
>> >         1       n_cfm
>> >         2       j_cfm
>> >         3       2acf->k_cfm
>> >         ...................
>> >
>> >
>> >         RESULT DATA3:
>> >         id      regimen numOfCycles
>> >         1       cfm     n_
>> >         2       cfm     j_
>> >         3       asf->cfm        {2+k_}
>> >         .............................
>> >
>> >
>> >
>> >         Thank you
>> >         Denis
>> >
>> >         ______________________________________________
>> >         R-help@r-project.org mailing list
>> >         https://stat.ethz.ch/mailman/listinfo/r-help
>> >         PLEASE do read the posting guide
>> >         http://www.R-project.org/posting-guide.html
>> >         and provide commented, minimal, self-contained, reproducible
>> >         code.
>> >
>> >
>> >
>> > --
>> > Henrique Dallazuanna
>> > Curitiba-ParanÃ¡-Brasil
>> > 25Â° 25' 40" S 49Â° 16' 22" O
>>
>>
>>
>
>
> --
> Henrique Dallazuanna
> Curitiba-ParanÃ¡-Brasil
> 25Â° 25' 40" S 49Â° 16' 22" O
>



--
Henrique Dallazuanna
Curitiba-ParanÃ¡-Brasil
25Â° 25' 40" S 49Â° 16' 22" O

       [[alternative HTML version deleted]]



------------------------------

Message: 50
Date: Fri, 21 Jan 2011 19:59:38 +0000
From: Akash <akki.coool2@gmail.com>
To: r-help@r-project.org
Subject: [R] Information
Message-ID:
       <AANLkTi=z9h3iHxTZPWRW66sJhi0L8x6mkQ78RsQ8SrDv@mail.gmail.com>
Content-Type: text/plain

Hello

I am student of Bioinformatics and I am doin somework in R in which some
problem occurs. So Please help me to solve these problems.
I have two problems:

1. How to generate a graph in which there are 8 rows and 20 columns are
present?
2. And how to put some title in the end of the graph i.e for example after
generating the rows if I want to give the name in the end of those rows like
1,2,3...8.. how can I do this thing?

Right now I am using this code.

graph<- function(X)
{
for(j in 1:8)
 {
 for(k in 1:20)
   {
   xx<-((j-1)*10)
   rect(xx,y(j,k-1,X),(xx)+10,y(j,k,X), col=colmap[k])
   if ( X[k,j] != 0)
     {
      text( (xx+5),(y(j,k-1,X) + round(X[k,j])/2), a[k])
     }
    }
 }
}

plot(c(0,10*8),c(0,abc), col="white")

where "a" is sumthing which I have to put inside of those rows and columns


Looking for your positive reply.

Thanking You

With Regards
Akash

       [[alternative HTML version deleted]]



------------------------------

Message: 51
Date: Fri, 21 Jan 2011 21:45:27 +0200
From: Den <d.kazakiewicz@gmail.com>
To: Henrique Dallazuanna <wwwhsd@gmail.com>
Cc: R-help <r-help@r-project.org>
Subject: Re: [R] complex transformation of data
Message-ID: <1295639127.7130.27.camel@den2042-desktop>
Content-Type: text/plain; charset="UTF-8"

Dear Henrique
Thank you again for helping me
Unfortunately, your code seems not to be working

> aggregate(.~ id, lapply(df, as.character), FUN = paste, collapse = "")
 id cycle1 cycle2 cycle3
1  1    cmf    cmf    cmf
2  2    mfc    mfc    mfc
3  3     cf     cf     cf

(letter 'a' missing in df[3,c("cycle1",cycle2")]

You suggested very interesting approach, however. Those '.~ id' and
'as.character' gave me hope for success.
With very best regards
Denis


? ???, 21/01/2011 ? 14:16 -0200, Henrique Dallazuanna ????:
> Try this:
>
> aggregate(.~ id, lapply(test, as.character), FUN = paste, collapse =
> "")
>
> On Fri, Jan 21, 2011 at 10:25 AM, Den <d.kazakiewicz@gmail.com> wrote:
>         Dear [R] people
>         Could you please help with following data transformation.
>         Any suggestions, hints, references and even guessing on
>         performing any
>         of the following steps are highly appreciated. Those
>         transformations are
>         crucial for my work.
>
>         (n_, _n, j_, k_ signify numbers)
>
>         SOURCE DATA:
>         id      cycle1  cycle2  cycle3  ?       cycle_n
>         1       c       c       c               c
>         1       m       m       m               m
>         1       f       f       f               f
>         2       m       m       m               NA
>         2       f       f       f               NA
>         2       c       c       c               NA
>         3       a       a       NA              NA
>         3       c       c       c               NA
>         3       f       f       f               NA
>         3       NA      NA      m               NA
>         ...........................................
>
>
>
>         RESULT DATA1:
>         id      cyc1    cyc2    cyc3    ?       cyc_n
>         1       cfm     cfm     cfm             cfm
>         2       cfm     cfm     cfm             NA
>         3       acf     acf     cfm             NA
>         ...........................................
>
>
>         RESULT DATA2:
>         id      treatment
>         1       n_cfm
>         2       j_cfm
>         3       2acf->k_cfm
>         ...................
>
>
>         RESULT DATA3:
>         id      regimen numOfCycles
>         1       cfm     n_
>         2       cfm     j_
>         3       asf->cfm        {2+k_}
>         .............................
>
>
>
>         Thank you
>         Denis
>
>         ______________________________________________
>         R-help@r-project.org mailing list
>         https://stat.ethz.ch/mailman/listinfo/r-help
>         PLEASE do read the posting guide
>         http://www.R-project.org/posting-guide.html
>         and provide commented, minimal, self-contained, reproducible
>         code.
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paran?-Brasil
> 25? 25' 40" S 49? 16' 22" O



------------------------------

Message: 52
Date: Fri, 21 Jan 2011 07:51:47 -0800 (PST)
From: dpender <d.pender.1@research.gla.ac.uk>
To: r-help@r-project.org
Subject: [R] Storm Clustering using clusters in evd
Message-ID: <1295625107742-3229951.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hi,

I am using the clusters function in the evd package in order to determine
storm events from a wave time series.

So far I have the code working as I want it for wave height on its own but I
would now like to include the period as well.  The input data is in the form
of:

H t
H t
H t

so every height measurement has a corresponding period.

The storms are defined when the wave height exceeds a certain value and what
I am looking to do is to retain the corresponding periods relating to the
wave heights in the cluster.  This would essentially result in a cluster
with 2 variables.

Does any one have any ideas?

Thanks in advance,

Doug
--
View this message in context:
http://r.789695.n4.nabble.com/Storm-Clustering-using-clusters-in-evd-tp3229951p3229951.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 53
Date: Fri, 21 Jan 2011 11:33:21 -0500
From: Francesco Petrogalli <francesco.petrogalli@gmail.com>
To: r-help@r-project.org
Subject: [R] confidence interval
Message-ID:
       <AANLkTik=oCjA-Pv6f4L-jD76TkZGk6m+nV83Ozjiv57p@mail.gmail.com<oCjA-Pv6f4L-jD76TkZGk6m%2BnV83Ozjiv57p@mail.gmail.com>
>
Content-Type: text/plain; charset=ISO-8859-1

Hi,
I have a circular shaped set of point on the plane (X,Y) centered in
zero. The distribution is more dense close to zero and less dense far
from zero.

I need to find the radius of a circle centered in zero that contains
65% of the points in the sample. Is there any R directive that can do
this?

I wanna start with 2D set of points, but the real case scenario is
with a 5D set of points.

Thanks,

Francesco



------------------------------

Message: 54
Date: Fri, 21 Jan 2011 14:38:42 -0500
From: Francesco Petrogalli <francesco.petrogalli@gmail.com>
To: r-help@r-project.org
Subject: [R] ordering a vector
Message-ID:
       <AANLkTi=VD3G1DxnnVpk4c3nUjQy+KndHDNdcqHi_=wVH@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi,
is there a R function that order a matrix according to some criteria
based on the rows(or cols) of that matrix?

For example, let's say that my matrix S is composed by n rows S_1,
S_2,.., S_n and that I compute some real value g_i=g(S_i) for each
row.
Then I want to order this set of g_i (from smaller to bigger) and
order the correspondent row to the new position.

Is it possible (apart from looping on the index) to do this with some
predefined R function?

Thanks,

Francesco



------------------------------

Message: 55
Date: Fri, 21 Jan 2011 09:26:48 -0800 (PST)
From: poppinkid <jtlu@bcm.edu>
To: r-help@r-project.org
Subject: [R] How to find data that includes certain values
Message-ID: <1295630808683-3230161.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


I am trying to return an index for a data set by searching using filenames.

The name may be ANG_AUT.N.0734C70411A-1_1sA_0734C70411A.fasta, but i'd just
like to search it using the term "0734C70411"  as the file may be
0734C70411A or 0734C70411C or 0734C70411D

Any way to do this other than doing something like this.  where 0734C70411A
is part of matrix list[,8]

samp=paste("ANG_AUT.N.",list[i,8],"-1_1sA_",list[i,8],".fasta",sep="")
data[which(data[,2]==samp),]

This is similar to the =~/ / function in perl.


Thanks
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-find-data-that-includes-certain-values-tp3230161p3230161.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 56
Date: Fri, 21 Jan 2011 18:10:21 +0000 (UTC)
From: jverzani <jverzani@gmail.com>
To: r-help@stat.math.ethz.ch
Subject: Re: [R] User input in R program
Message-ID: <loom.20110121T190819-808@post.gmane.org>
Content-Type: text/plain; charset=us-ascii

christiaan pauw <cjpauw <at> gmail.com> writes:

>
> HI Everybody
>
> Does anyone know of documentation about different ways of obtaining user
> input in R. I have used readline() but I wondered is there are
sophisticated
> packages that does things like validate answers or generate selection
> lists.

You might consider the gWidgets package. Like rpanel, there are many
functions
that make this kind of thing quite easy to implement.



------------------------------

Message: 57
Date: Fri, 21 Jan 2011 11:42:35 -0500
From: Michael Costello <michaelavcostello@gmail.com>
To: r-help@r-project.org
Subject: [R] Looping with incremented object name and increment
       function
Message-ID:
       <AANLkTinZ2DG+ox7++JrQOMruJ639Ofbe=YymPK5aAcJb@mail.gmail.com>
Content-Type: text/plain

Folks,

I am trying to get a loop to run which increments the object name as part of
the loop.  Here "fit1" "fit2" "fit3" and "fit4" are linear regression models
that I have created.

> for (ii in c(1:4)){
+ SSE[ii]=rbind(anova(fit[ii])$"Sum Sq")
+ dfe[ii]=rbind(summary(fit[ii])$df)
+ }
Error in anova(fit[ii]) : object 'fit' not found

Why isn't it looking for object 'fit1' instead of 'fit'?

The idea is that it would store in SSE1 the Sum Sq of the model fit1, and so
on for the other 3 models.  Is there a way to do this in R?  I can do it in
Stata, but am only somewhat knowledgeable in R.

-Michael

       [[alternative HTML version deleted]]



------------------------------

Message: 58
Date: Fri, 21 Jan 2011 10:00:23 -0800 (PST)
From: pete <pieroleone@hotmail.it>
To: r-help@r-project.org
Subject: Re: [R] clustering fuzzy
Message-ID: <1295632823736-3230228.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


thank you ,you have been very kind
--
View this message in context:
http://r.789695.n4.nabble.com/clustering-fuzzy-tp3229853p3230228.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 59
Date: Fri, 21 Jan 2011 15:37:12 -0500
From: jim holtman <jholtman@gmail.com>
To: poppinkid <jtlu@bcm.edu>
Cc: r-help@r-project.org
Subject: Re: [R] How to find data that includes certain values
Message-ID:
       <AANLkTinPeMa9arWQRd9y4bbjEjXzBwhUW-C_zdwR2N7R@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

There are several pattern matching functions that will solve your problem:

grep regexpr

do RSiteSearch("pattern match")

On Fri, Jan 21, 2011 at 12:26 PM, poppinkid <jtlu@bcm.edu> wrote:
>
> I am trying to return an index for a data set by searching using
filenames.
>
> The name may be ANG_AUT.N.0734C70411A-1_1sA_0734C70411A.fasta, but i'd
just
> like to search it using the term "0734C70411" ?as the file may be
> 0734C70411A or 0734C70411C or 0734C70411D
>
> Any way to do this other than doing something like this. ?where
0734C70411A
> is part of matrix list[,8]
>
> samp=paste("ANG_AUT.N.",list[i,8],"-1_1sA_",list[i,8],".fasta",sep="")
> data[which(data[,2]==samp),]
>
> This is similar to the =~/ / function in perl.
>
>
> Thanks
> --
> View this message in context:
http://r.789695.n4.nabble.com/How-to-find-data-that-includes-certain-values-tp3230161p3230161.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?



------------------------------

Message: 60
Date: Fri, 21 Jan 2011 18:37:36 -0200
From: Henrique Dallazuanna <wwwhsd@gmail.com>
To: Den <d.kazakiewicz@gmail.com>
Cc: R-help <r-help@r-project.org>
Subject: Re: [R] complex transformation of data
Message-ID:
       <AANLkTinPrvWYqsWjcMsjMfygWF0jxzxpQn4YpOr8SuNe@mail.gmail.com>
Content-Type: text/plain

Just change the FUN function:

aggregate(.~ id, lapply(df, as.character), FUN = function(x)paste(sort(x),
collapse = ''), na.action = na.pass)

On Fri, Jan 21, 2011 at 6:27 PM, Den <d.kazakiewicz@gmail.com> wrote:

>
> Thank you for your efforts.
> Although it is still not working, it feels like getting closer and
> closer.
>
> id cycle1 cycle2 cycle3
> 1  1    cmf    cmf    cmf
> 2  2    mfc    mfc    mfc
> 3  3  acfNA  acfNA  NAcfm
>
> I really appreciate transformation from subsets ("c","m","f") to "cmf".
> That was critical for me.
> Hopefully, I'll figure  out the rest later with ddply from plyr package.
> At least this is my idea for now.
>
>
>
> Ð£ ÐŸÑ Ñ‚, 21/01/2011 Ñƒ 18:00 -0200, Henrique Dallazuanna Ð¿Ñ–ÑˆÐ°:
> > correction:
> > aggregate(.~ id, lapply(df, as.character), FUN = paste, collapse = "",
> > na.action = na.pass)
> >
> > On Fri, Jan 21, 2011 at 5:56 PM, Henrique Dallazuanna
> > <wwwhsd@gmail.com> wrote:
> >         Try this:
> >
> >         aggregate(.~ id, lapply(replace(df, is.na(df), ''),
> >         as.character), FUN = paste, collapse = "", na.action =
> >         na.pass)
> >
> >
> >
> >         On Fri, Jan 21, 2011 at 5:45 PM, Den <d.kazakiewicz@gmail.com>
> >         wrote:
> >                 Dear Henrique
> >                 Thank you again for helping me
> >                 Unfortunately, your code seems not to be working
> >
> >                 > aggregate(.~ id, lapply(df, as.character), FUN =
> >                 paste, collapse = "")
> >                  id cycle1 cycle2 cycle3
> >                 1  1    cmf    cmf    cmf
> >                 2  2    mfc    mfc    mfc
> >                 3  3     cf     cf     cf
> >
> >                 (letter 'a' missing in df[3,c("cycle1",cycle2")]
> >
> >                 You suggested very interesting approach, however.
> >                 Those '.~ id' and
> >                 'as.character' gave me hope for success.
> >                 With very best regards
> >                 Denis
> >
> >
> >                 Ð£ ÐŸÑ Ñ‚, 21/01/2011 Ñƒ 14:16 -0200, Henrique
Dallazuanna
> >                 Ð¿Ñ–ÑˆÐ°:
> >
> >                 > Try this:
> >                 >
> >                 > aggregate(.~ id, lapply(test, as.character), FUN =
> >                 paste, collapse =
> >                 > "")
> >                 >
> >                 > On Fri, Jan 21, 2011 at 10:25 AM, Den
> >                 <d.kazakiewicz@gmail.com> wrote:
> >                 >         Dear [R] people
> >                 >         Could you please help with following data
> >                 transformation.
> >                 >         Any suggestions, hints, references and even
> >                 guessing on
> >                 >         performing any
> >                 >         of the following steps are highly
> >                 appreciated. Those
> >                 >         transformations are
> >                 >         crucial for my work.
> >                 >
> >                 >         (n_, _n, j_, k_ signify numbers)
> >                 >
> >                 >         SOURCE DATA:
> >                 >         id      cycle1  cycle2  cycle3  â€¦
> >                 cycle_n
> >                 >         1       c       c       c               c
> >                 >         1       m       m       m               m
> >                 >         1       f       f       f               f
> >                 >         2       m       m       m               NA
> >                 >         2       f       f       f               NA
> >                 >         2       c       c       c               NA
> >                 >         3       a       a       NA              NA
> >                 >         3       c       c       c               NA
> >                 >         3       f       f       f               NA
> >                 >         3       NA      NA      m               NA
> >                 >         ...........................................
> >                 >
> >                 >
> >                 >
> >                 >         RESULT DATA1:
> >                 >         id      cyc1    cyc2    cyc3    â€¦
> >                 cyc_n
> >                 >         1       cfm     cfm     cfm             cfm
> >                 >         2       cfm     cfm     cfm             NA
> >                 >         3       acf     acf     cfm             NA
> >                 >         ...........................................
> >                 >
> >                 >
> >                 >         RESULT DATA2:
> >                 >         id      treatment
> >                 >         1       n_cfm
> >                 >         2       j_cfm
> >                 >         3       2acf->k_cfm
> >                 >         ...................
> >                 >
> >                 >
> >                 >         RESULT DATA3:
> >                 >         id      regimen numOfCycles
> >                 >         1       cfm     n_
> >                 >         2       cfm     j_
> >                 >         3       asf->cfm        {2+k_}
> >                 >         .............................
> >                 >
> >                 >
> >                 >
> >                 >         Thank you
> >                 >         Denis
> >                 >
> >                 >
> >                 ______________________________________________
> >                 >         R-help@r-project.org mailing list
> >                 >         https://stat.ethz.ch/mailman/listinfo/r-help
> >                 >         PLEASE do read the posting guide
> >                 >         http://www.R-project.org/posting-guide.html
> >                 >         and provide commented, minimal,
> >                 self-contained, reproducible
> >                 >         code.
> >                 >
> >                 >
> >                 >
> >                 > --
> >                 > Henrique Dallazuanna
> >                 > Curitiba-ParanÃ¡-Brasil
> >                 > 25Â° 25' 40" S 49Â° 16' 22" O
> >
> >
> >
> >
> >
> >
> >         --
> >         Henrique Dallazuanna
> >         Curitiba-ParanÃ¡-Brasil
> >         25Â° 25' 40" S 49Â° 16' 22" O
> >
> >
> >
> >
> > --
> > Henrique Dallazuanna
> > Curitiba-ParanÃ¡-Brasil
> > 25Â° 25' 40" S 49Â° 16' 22" O
>
>
>


--
Henrique Dallazuanna
Curitiba-ParanÃ¡-Brasil
25Â° 25' 40" S 49Â° 16' 22" O

       [[alternative HTML version deleted]]



------------------------------

Message: 61
Date: Fri, 21 Jan 2011 18:38:12 -0200
From: Henrique Dallazuanna <wwwhsd@gmail.com>
To: poppinkid <jtlu@bcm.edu>
Cc: r-help@r-project.org
Subject: Re: [R] How to find data that includes certain values
Message-ID:
       <AANLkTikpndC3h0itqJND4uc8s_xK8Y17VRbKUhXg-3w2@mail.gmail.com>
Content-Type: text/plain

Take a look on grep function.

On Fri, Jan 21, 2011 at 3:26 PM, poppinkid <jtlu@bcm.edu> wrote:

>
> I am trying to return an index for a data set by searching using
filenames.
>
> The name may be ANG_AUT.N.0734C70411A-1_1sA_0734C70411A.fasta, but i'd
just
> like to search it using the term "0734C70411"  as the file may be
> 0734C70411A or 0734C70411C or 0734C70411D
>
> Any way to do this other than doing something like this.  where
0734C70411A
> is part of matrix list[,8]
>
> samp=paste("ANG_AUT.N.",list[i,8],"-1_1sA_",list[i,8],".fasta",sep="")
> data[which(data[,2]==samp),]
>
> This is similar to the =~/ / function in perl.
>
>
> Thanks
> --
> View this message in context:
>
http://r.789695.n4.nabble.com/How-to-find-data-that-includes-certain-values-tp3230161p3230161.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

       [[alternative HTML version deleted]]



------------------------------

Message: 62
Date: Fri, 21 Jan 2011 15:39:50 -0500
From: jim holtman <jholtman@gmail.com>
To: Francesco Petrogalli <francesco.petrogalli@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] ordering a vector
Message-ID:
       <AANLkTi=bWMJjnCoqpQYBEGTHZ_Sa1rk8SC2Pmks7JS3q@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

look at 'order'

yourMatrix[order(yourMatrix[, 'yourCol']), ]

On Fri, Jan 21, 2011 at 2:38 PM, Francesco Petrogalli
<francesco.petrogalli@gmail.com> wrote:
> Hi,
> is there a R function that order a matrix according to some criteria
> based on the rows(or cols) of that matrix?
>
> For example, let's say that my matrix S is composed by n rows S_1,
> S_2,.., S_n and that I compute some real value g_i=g(S_i) for each
> row.
> Then I want to order this set of g_i (from smaller to bigger) and
> order the correspondent row to the new position.
>
> Is it possible (apart from looping on the index) to do this with some
> predefined R function?
>
> Thanks,
>
> Francesco
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?



------------------------------

Message: 63
Date: Fri, 21 Jan 2011 12:42:06 -0800
From: Peter Langfelder <peter.langfelder@gmail.com>
To: Francesco Petrogalli <francesco.petrogalli@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] ordering a vector
Message-ID:
       <AANLkTikifs+5YxOpYeoajMKKU9SrwP8Pv=TtgedkHCgn@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

I think you want the following, assuming you defined your function g():

gValues = apply(S, 1, g);

Sordered = S[order(gValues), ]

Peter

On Fri, Jan 21, 2011 at 11:38 AM, Francesco Petrogalli
<francesco.petrogalli@gmail.com> wrote:
> Hi,
> is there a R function that order a matrix according to some criteria
> based on the rows(or cols) of that matrix?
>
> For example, let's say that my matrix S is composed by n rows S_1,
> S_2,.., S_n and that I compute some real value g_i=g(S_i) for each
> row.
> Then I want to order this set of g_i (from smaller to bigger) and
> order the correspondent row to the new position.
>
> Is it possible (apart from looping on the index) to do this with some
> predefined R function?
>
> Thanks,
>
> Francesco
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



------------------------------

Message: 64
Date: Fri, 21 Jan 2011 16:03:31 -0500
From: David Winsemius <dwinsemius@comcast.net>
To: "Brahmachary, Manisha" <manisha.brahmachary@mssm.edu>
Cc: R-help@r-project.org
Subject: Re: [R] Pearson correlation with randomization
Message-ID: <5D127B16-6668-4132-BB15-DC5E96FEC629@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Jan 21, 2011, at 3:29 PM, Brahmachary, Manisha wrote:

> Hi David,
>
> Thanks a lot for you inputs. I have modified my code accordingly.
> There
> is one more place that I need some help.
> This is my code:
>
> =
> =
> ======================================================================
> ======
>
> X<- read.table("X.txt",as.is=T,header=T,row.names=1)
> Y<- read.table("Y.txt",as.is=T,header=T,row.names=1)
>
> X.mat<- as.matrix(X)
> Y.mat<- as.matrix(Y)
>
> # calculating the true correlation values from my original dataset
> True.Corrs<- matrix()
> for (k in 1:nrow(SNP.mat)){
> True.Corrs[k]<- cor.test(X.mat[k,],Y.mat[k,],alternative
> =c("greater"),method= c("pearson"))$p.value
> }
>
> # Creating the random distribution of Correlation p-values
> X.rand <- list()
> Y.rand<- list()
>
> X.rand<-replicate(1000,(X[sample(1:ncol(Y))]),simplify=FALSE)  #
> Randomizing the column values for each row
> Y.rand<-replicate(1000,Y,simplify=FALSE) # Creating an equivalent list
> of the Y matrix (non-randomised), to be able to do a pair-wise
> cor.test
>
> Corrs.rand<- list()
> tmp<- list()
> for (i in 1:2){
> for (j in 1:3){
> # How to store a multiple values per element of list?
> tmp[[j]] <- cor.test(t(X.rand[[i]][j,]),t(Y.rand[[i]][j,]),alternative
> =c("greater"),method= c("pearson"))$p.value
> Corrs.rand[[i]] <- rbind(Corrs.rand[[j]],tmp[[j]])
> }
> }
>
> =
> =
> ======================================================================
>
> At this step:
>
> for (i in 1:length(X.rand)){
> for (j in 1:nrow(X.rand[[1]]){
> # How to store a multiple values per element of list?
> tmp[[j]] <- cor.test(t(X.rand[[i]][j,]),t(Y.rand[[i]][j,]),alternative
> =c("greater"),method= c("pearson"))$p.value
> Corrs.rand[[i]] <- rbind(Corrs.rand[[j]],tmp[[j]])
> }
> }
>
> I am not sure how I can store multiple values per element.

The usual way would be to pre-allocate a matrix or a data.frame and
then use "[<-" to assign either a  whole row at a time or assign
individual elements one by one. rbind in a loop is definitely going to
slow you down.

I haven't followed through the individual steps of all the for-loops.
I guess I have lost the ability to think that way after learning to
use the matrix and indexing features of R, alas. If Corrs.rand is a
1000 x 12  data.frame (which is just a special square list) then you
can assign the i-th row with:

Corrs.rand[i, ] <- <some-12-element-object>

Or you can assign the i,j-th element with:

Corrs.rand[i,j ] <- <vector-of-length-1>

The same syntax works for matrices.
--
David.

> For eg. I
> want a list of length 1000 (which is the number of random
> permutations I
> have generated for my dataset) and in each element of the list I
> need to
> store 12 p.values where 12 corresponds to the number of rows I have in
> my randomized dataset. Eg.
>
> [[1]]
> 0.23
> 0.05
> 0.78
> 0.78
> 0.87
> 0.11
> 0.003
> 0.9
> 0.76
> 0.11
> 0.23
> 0.56
> [[2]]
> 0.08
> 0.67
> 0.45
> 0.23
> 0.35
> 0.85
> 0.99
> 0.78
> 0.66
> 0.45
> 0.06
> 0.1
> [[3]]
> So on...
>
> I maybe going about this in a complicated way and there may be other
> ways of storing the p.values for each of my randomized dataset. So if
> anybody has ideas please oblige me.
> ======================================================
> X dataset:(sample)
> #Probes       X10851  X12144  X12155  X11882  X10860  X12762  X12239
 X12154
> 1     1       1       0       0       1       0       2       0
> 2     0       0       0       0       0       0       0       0
> 3     2       2       2       2       1       2       1       2
> 4     0       0       0       0       0       0       0       0
> 5     2       2       2       2       2       2       2       2
> 6     0       1       0       0       1       1       1       1
> 7     2       2       NaN     2       2       2       2       2
> 8     2       2       2       2       2       2       2       2
> 9     0       1       0       1       1       NaN     1       2
> 10    2       2       2       2       2       2       2       2
> 11    2       0       0       0       0       0       0       0
> 12    0       1       0       1       1       0       1       1
>
>
> Y dataset:(sample)
>
> Probes        X10851  X12144  X12155  X11882  X10860  X12762  X12239
 X12154
> 1     793.0830793     788.1813828     867.8504057     729.8321265
> 816.8519963   805.2113707     774.5990003     854.6384306
> 2     12.8695023      4.312894024     10.69769375     5.872212512
> 13.79299806   9.394132659     6.297552848     9.307943304
> 3     699.7791876     826.997429      795.6409729     770.9376141
> 806.1241089   782.3970486     817.107482      859.7154906
> 4     892.8217221     869.0481458     806.3386667     812.0431017
> 873.5565439   794.4752191     813.9587056     814.8681274
> 5     892.8217221     869.0481458     806.3386667     812.0431017
> 873.5565439   794.4752191     813.9587056     814.8681274
> 6     839.7350251     943.4455677     950.7575323     859.0208018
> 894.246041    853.524053      941.4841508     913.0246205
> 7     653.1272418     751.5217836     750.1757745     737.382114
> 757.8486157   758.2407075     724.2185775     770.8669409
> 8     12.8695023      4.312894024     10.69769375     5.872212512
> 13.79299806   9.394132659     6.297552848     9.307943304
> 9     839.7350251     943.4455677     950.7575323     859.0208018
> 894.246041    853.524053      941.4841508     913.0246205
> 10    653.1272418     751.5217836     750.1757745     737.382114
> 757.8486157   758.2407075     724.2185775     770.8669409
> 11    653.1272418     751.5217836     750.1757745     737.382114
> 757.8486157   758.2407075     724.2185775     770.8669409
> 12    839.7350251     943.4455677     950.7575323     859.0208018
> 894.246041    853.524053      941.4841508     913.0246205
>
> Thanks again
>
> Manisha
>
>
>
>
> -----Original Message-----
> From: David Winsemius [mailto:dwinsemius@comcast.net]
> Sent: Tuesday, January 18, 2011 11:56 PM
> To: Brahmachary, Manisha
> Cc: R-help@r-project.org
> Subject: Re: [R] Pearson correlation with randomization
>
>
> On Jan 18, 2011, at 11:23 PM, Brahmachary, Manisha wrote:
>
>> Hello,
>>
>>
>>
>> I will be very obliged if someone can help me with this statistical R
>> problem:
>>
>> I am trying to do a Pearson correlation on my datasets X, Y with
>> randomization test. My X and Y datasets are pairs.
>>
>> 1.     I want to randomize (rearrange) only my X dataset per
>> row ,while
>> keeping the my Y dataset as it is.
>
> X <- X[sample(1:nrow(Y)), ]
>
>>
>> 2.     Then Calculate the correlation  for this pair, and compare it
>> to
>> your true value of correlation.
>>
>> 3.     Repeat 2 and 3 maybe a 100 times
>
> You may want to look at the replicate function.
>
>>
>> 4.     If your true p-value  is greater than 95% of the random
>> values,
>> then you can reject the null hypothesis at   p<0.05.
>
> You won't have a very stable estimate of the 95th order statistics
> with "maybe" 100 replications.
>
> --
> David.
>>
>>
>>
>> I am stuck at the randomization step. I need some help in
>> implementing
>> it the appropriate randomization step in my correlation.
>>
>> Below is my incomplete code. I will be very obliged if someone could
>> help:
>>
>>
>>
>> X <- read.table("X.txt",as.is=T,header=T,row.names=1)
>>
>> Y <- read.table("Y.txt",as.is=T,header=T,row.names=1)
>>
>>
>>
>> X.mat<- as.matrix(X)
>>
>> Y.mat<- as.matrix(Y)
>>
>>
>>
>> Corrs<- cor.test(X.mat[1,],Y.mat[1,],alternative
>> =c("greater"),method=
>> c("pearson"))
>>
>>
>>
>> Corrs.rand <- list()
>>
>>
>>
>> for (i in 1:length(X.mat)){
>>
>> for (j in 1:100){
>>
>>
>>
>> # This doesnot seem to wrok correctly. How do I run sample function
>> 100
>> times for the same row?
>>
>>
>>
>> SNP.rand<- sample(SNP.mat[i,],56, replace = FALSE, prob = NULL)
>>
>> Corrs.rand[[j]]<- cor.test(SNP.rand,CNV.mat[j,],alternative
>> =c("greater"),method= c("pearson"))
>>
>>
>>
>> # need to calculate how many times my pvalue from true p-value>
>> random
>> pvalue
>>
>> }
>>
>> }
>>
>>
>>
>> X dataset:
>>
>>
>>
>> #Probes
>>
>> X10851
>>
>> X12144
>>
>> X12155
>>
>> X11882
>>
>> X10860
>>
>> X12762
>>
>> X12239
>>
>> X12154
>>
>> 1
>>
>> 1
>>
>> 1
>>
>> 0
>>
>> 0
>>
>> 1
>>
>> 0
>>
>> 2
>>
>> 0
>>
>> 2
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 3
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 1
>>
>> 2
>>
>> 1
>>
>> 2
>>
>> 4
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 5
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 6
>>
>> 0
>>
>> 1
>>
>> 0
>>
>> 0
>>
>> 1
>>
>> 1
>>
>> 1
>>
>> 1
>>
>> 7
>>
>> 2
>>
>> 2
>>
>> NaN
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 8
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 9
>>
>> 0
>>
>> 1
>>
>> 0
>>
>> 1
>>
>> 1
>>
>> NaN
>>
>> 1
>>
>> 2
>>
>> 10
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 2
>>
>> 11
>>
>> 2
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 0
>>
>> 12
>>
>> 0
>>
>> 1
>>
>> 0
>>
>> 1
>>
>> 1
>>
>> 0
>>
>> 1
>>
>> 1
>>
>>
>>
>> Y dataset:
>>
>> Probes
>>
>> X10851
>>
>> X12144
>>
>> X12155
>>
>> X11882
>>
>> X10860
>>
>> X12762
>>
>> X12239
>>
>> X12154
>>
>> 1
>>
>> 793.0831
>>
>> 788.1814
>>
>> 867.8504
>>
>> 729.8321
>>
>> 816.852
>>
>> 805.2114
>>
>> 774.599
>>
>> 854.6384
>>
>> 2
>>
>> 12.8695
>>
>> 4.312894
>>
>> 10.69769
>>
>> 5.872213
>>
>> 13.793
>>
>> 9.394133
>>
>> 6.297553
>>
>> 9.307943
>>
>> 3
>>
>> 699.7792
>>
>> 826.9974
>>
>> 795.641
>>
>> 770.9376
>>
>> 806.1241
>>
>> 782.397
>>
>> 817.1075
>>
>> 859.7155
>>
>> 4
>>
>> 892.8217
>>
>> 869.0481
>>
>> 806.3387
>>
>> 812.0431
>>
>> 873.5565
>>
>> 794.4752
>>
>> 813.9587
>>
>> 814.8681
>>
>> 5
>>
>> 892.8217
>>
>> 869.0481
>>
>> 806.3387
>>
>> 812.0431
>>
>> 873.5565
>>
>> 794.4752
>>
>> 813.9587
>>
>> 814.8681
>>
>> 6
>>
>> 839.735
>>
>> 943.4456
>>
>> 950.7575
>>
>> 859.0208
>>
>> 894.246
>>
>> 853.5241
>>
>> 941.4842
>>
>> 913.0246
>>
>> 7
>>
>> 653.1272
>>
>> 751.5218
>>
>> 750.1758
>>
>> 737.3821
>>
>> 757.8486
>>
>> 758.2407
>>
>> 724.2186
>>
>> 770.8669
>>
>> 8
>>
>> 12.8695
>>
>> 4.312894
>>
>> 10.69769
>>
>> 5.872213
>>
>> 13.793
>>
>> 9.394133
>>
>> 6.297553
>>
>> 9.307943
>>
>> 9
>>
>> 839.735
>>
>> 943.4456
>>
>> 950.7575
>>
>> 859.0208
>>
>> 894.246
>>
>> 853.5241
>>
>> 941.4842
>>
>> 913.0246
>>
>> 10
>>
>> 653.1272
>>
>> 751.5218
>>
>> 750.1758
>>
>> 737.3821
>>
>> 757.8486
>>
>> 758.2407
>>
>> 724.2186
>>
>> 770.8669
>>
>> 11
>>
>> 653.1272
>>
>> 751.5218
>>
>> 750.1758
>>
>> 737.3821
>>
>> 757.8486
>>
>> 758.2407
>>
>> 724.2186
>>
>> 770.8669
>>
>> 12
>>
>> 839.735
>>
>> 943.4456
>>
>> 950.7575
>>
>> 859.0208
>>
>> 894.246
>>
>> 853.5241
>>
>> 941.4842
>>
>> 913.0246
>>
>>
>>
>>
>>
>>
>>
>> Thanks in advance
>>
>>
>>
>> Manisha
>>
>>
>>
>> Mount Sinai School of Medicine
>>
>> Icahn Medical Institute,
>>
>> 1425 Madison Avenue, Box 1498
>>
>> NY-10029, NEW-YORK, USA
>>
>>
>>
>>
>>      [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius, MD
> West Hartford, CT
>

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 65
Date: Fri, 21 Jan 2011 16:07:04 -0500
From: David Winsemius <dwinsemius@comcast.net>
To: Akash <akki.coool2@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Information
Message-ID: <227A9130-ACD3-446F-B6F8-F748E2FC4684@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Jan 21, 2011, at 2:59 PM, Akash wrote:

> Hello
>
> I am student of Bioinformatics and I am doin somework in R in which
> some
> problem occurs. So Please help me to solve these problems.
> I have two problems:
>
> 1. How to generate a graph in which there are 8 rows and 20 columns
> are
> present?
> 2. And how to put some title in the end of the graph i.e for example
> after
> generating the rows if I want to give the name in the end of those
> rows like
> 1,2,3...8.. how can I do this thing?

matplot will let you specify the plotting character with the pch
argument. Coloring is also available and legends are reasonably simple
as well.

?matplot
?legend

If you had presented data with the dput() function I would have
returned working code, But I have gotten tired of making up examples
when people don't post their own sample data.

--
David.
>
> Right now I am using this code.
>
> graph<- function(X)
> {
> for(j in 1:8)
>  {
>  for(k in 1:20)
>    {
>    xx<-((j-1)*10)
>    rect(xx,y(j,k-1,X),(xx)+10,y(j,k,X), col=colmap[k])
>    if ( X[k,j] != 0)
>      {
>       text( (xx+5),(y(j,k-1,X) + round(X[k,j])/2), a[k])
>      }
>     }
>  }
> }
>
> plot(c(0,10*8),c(0,abc), col="white")
>
> where "a" is sumthing which I have to put inside of those rows and
> columns
>
>
> Looking for your positive reply.
>
> Thanking You
>
> With Regards
> Akash
>
>       [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 66
Date: Fri, 21 Jan 2011 16:19:04 -0500
From: David Winsemius <dwinsemius@comcast.net>
To: Francesco Petrogalli <francesco.petrogalli@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] confidence interval
Message-ID: <3AB1FCBA-4E19-480E-BC6C-60D3096785B0@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Jan 21, 2011, at 11:33 AM, Francesco Petrogalli wrote:

> Hi,
> I have a circular shaped set of point on the plane (X,Y) centered in
> zero. The distribution is more dense close to zero and less dense far
> from zero.
>
> I need to find the radius of a circle centered in zero that contains
> 65% of the points in the sample. Is there any R directive that can do
> this?
>
> I wanna start with 2D set of points, but the real case scenario is
> with a 5D set of points.

Something along the lines of

dxy= with(dfm, sqrt(x^2 +y^2))
quantile(dxy, probs=0.65)

The generalization to 5 dimensions appears trivial. Even the
generalization to finding the radius around an arbitrary point seems
trivial assuming an L2 norm.

--
David Winsemius, MD
West Hartford, CT



------------------------------

Message: 67
Date: Fri, 21 Jan 2011 14:43:31 -0700
From: Greg Snow <Greg.Snow@imail.org>
To: Michael Costello <michaelavcostello@gmail.com>,
       "r-help@r-project.org"  <r-help@r-project.org>
Subject: Re: [R] Looping with incremented object name and increment
       function
Message-ID:
       <B37C0A15B8FB3C468B5BC7EBC7DA14CC6341402BBA@LP-EXMBVS10.CO.IHC.COM>
Content-Type: text/plain; charset="us-ascii"

This is FAQ 7.21.

The real gem in the answer there is at the end where it tells you that it is
easier to just use a list.  If your fit1, fit2, fit3, and fit4 were elements
in a list then you can just loop through the list elements, or even easier
use the lapply function to loop through the list elements for you.

The syntax fit[ii] means that you want the ii'th element of the vector named
"fit", the FAQ shows how to do what you want, but in the long run (and the
medium run, and even the short run) using a list instead of separate global
variables will make your life easier.

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Michael Costello
> Sent: Friday, January 21, 2011 9:43 AM
> To: r-help@r-project.org
> Subject: [R] Looping with incremented object name and increment
> function
>
> Folks,
>
> I am trying to get a loop to run which increments the object name as
> part of
> the loop.  Here "fit1" "fit2" "fit3" and "fit4" are linear regression
> models
> that I have created.
>
> > for (ii in c(1:4)){
> + SSE[ii]=rbind(anova(fit[ii])$"Sum Sq")
> + dfe[ii]=rbind(summary(fit[ii])$df)
> + }
> Error in anova(fit[ii]) : object 'fit' not found
>
> Why isn't it looking for object 'fit1' instead of 'fit'?
>
> The idea is that it would store in SSE1 the Sum Sq of the model fit1,
> and so
> on for the other 3 models.  Is there a way to do this in R?  I can do
> it in
> Stata, but am only somewhat knowledgeable in R.
>
> -Michael
>
>       [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



------------------------------

Message: 68
Date: Fri, 21 Jan 2011 22:27:57 +0200
From: Den <d.kazakiewicz@gmail.com>
To: Henrique Dallazuanna <wwwhsd@gmail.com>
Cc: R-help <r-help@r-project.org>
Subject: Re: [R] complex transformation of data
Message-ID: <1295641677.7130.43.camel@den2042-desktop>
Content-Type: text/plain; charset="UTF-8"


Thank you for your efforts.
Although it is still not working, it feels like getting closer and
closer.

id cycle1 cycle2 cycle3
1  1    cmf    cmf    cmf
2  2    mfc    mfc    mfc
3  3  acfNA  acfNA  NAcfm

I really appreciate transformation from subsets ("c","m","f") to "cmf".
That was critical for me.
Hopefully, I'll figure  out the rest later with ddply from plyr package.
At least this is my idea for now.



? ???, 21/01/2011 ? 18:00 -0200, Henrique Dallazuanna ????:
> correction:
> aggregate(.~ id, lapply(df, as.character), FUN = paste, collapse = "",
> na.action = na.pass)
>
> On Fri, Jan 21, 2011 at 5:56 PM, Henrique Dallazuanna
> <wwwhsd@gmail.com> wrote:
>         Try this:
>
>         aggregate(.~ id, lapply(replace(df, is.na(df), ''),
>         as.character), FUN = paste, collapse = "", na.action =
>         na.pass)
>
>
>
>         On Fri, Jan 21, 2011 at 5:45 PM, Den <d.kazakiewicz@gmail.com>
>         wrote:
>                 Dear Henrique
>                 Thank you again for helping me
>                 Unfortunately, your code seems not to be working
>
>                 > aggregate(.~ id, lapply(df, as.character), FUN =
>                 paste, collapse = "")
>                  id cycle1 cycle2 cycle3
>                 1  1    cmf    cmf    cmf
>                 2  2    mfc    mfc    mfc
>                 3  3     cf     cf     cf
>
>                 (letter 'a' missing in df[3,c("cycle1",cycle2")]
>
>                 You suggested very interesting approach, however.
>                 Those '.~ id' and
>                 'as.character' gave me hope for success.
>                 With very best regards
>                 Denis
>
>
>                 ? ???, 21/01/2011 ? 14:16 -0200, Henrique Dallazuanna
>                 ????:
>
>                 > Try this:
>                 >
>                 > aggregate(.~ id, lapply(test, as.character), FUN =
>                 paste, collapse =
>                 > "")
>                 >
>                 > On Fri, Jan 21, 2011 at 10:25 AM, Den
>                 <d.kazakiewicz@gmail.com> wrote:
>                 >         Dear [R] people
>                 >         Could you please help with following data
>                 transformation.
>                 >         Any suggestions, hints, references and even
>                 guessing on
>                 >         performing any
>                 >         of the following steps are highly
>                 appreciated. Those
>                 >         transformations are
>                 >         crucial for my work.
>                 >
>                 >         (n_, _n, j_, k_ signify numbers)
>                 >
>                 >         SOURCE DATA:
>                 >         id      cycle1  cycle2  cycle3  ?
>                 cycle_n
>                 >         1       c       c       c               c
>                 >         1       m       m       m               m
>                 >         1       f       f       f               f
>                 >         2       m       m       m               NA
>                 >         2       f       f       f               NA
>                 >         2       c       c       c               NA
>                 >         3       a       a       NA              NA
>                 >         3       c       c       c               NA
>                 >         3       f       f       f               NA
>                 >         3       NA      NA      m               NA
>                 >         ...........................................
>                 >
>                 >
>                 >
>                 >         RESULT DATA1:
>                 >         id      cyc1    cyc2    cyc3    ?
>                 cyc_n
>                 >         1       cfm     cfm     cfm             cfm
>                 >         2       cfm     cfm     cfm             NA
>                 >         3       acf     acf     cfm             NA
>                 >         ...........................................
>                 >
>                 >
>                 >         RESULT DATA2:
>                 >         id      treatment
>                 >         1       n_cfm
>                 >         2       j_cfm
>                 >         3       2acf->k_cfm
>                 >         ...................
>                 >
>                 >
>                 >         RESULT DATA3:
>                 >         id      regimen numOfCycles
>                 >         1       cfm     n_
>                 >         2       cfm     j_
>                 >         3       asf->cfm        {2+k_}
>                 >         .............................
>                 >
>                 >
>                 >
>                 >         Thank you
>                 >         Denis
>                 >
>                 >
>                 ______________________________________________
>                 >         R-help@r-project.org mailing list
>                 >         https://stat.ethz.ch/mailman/listinfo/r-help
>                 >         PLEASE do read the posting guide
>                 >         http://www.R-project.org/posting-guide.html
>                 >         and provide commented, minimal,
>                 self-contained, reproducible
>                 >         code.
>                 >
>                 >
>                 >
>                 > --
>                 > Henrique Dallazuanna
>                 > Curitiba-Paran?-Brasil
>                 > 25? 25' 40" S 49? 16' 22" O
>
>
>
>
>
>
>         --
>         Henrique Dallazuanna
>         Curitiba-Paran?-Brasil
>         25? 25' 40" S 49? 16' 22" O
>
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paran?-Brasil
> 25? 25' 40" S 49? 16' 22" O



------------------------------

Message: 69
Date: Fri, 21 Jan 2011 12:59:14 -0800 (PST)
From: eniven <eniven@gmail.com>
To: r-help@r-project.org
Subject: [R] Help with LMSreg
Message-ID: <1295643554542-3230611.post@n4.nabble.com>
Content-Type: text/plain


I'm doing regression with least median squares (LMS) using the lmsreg
command. I've got the coefficients (slope and intercept), but how do I get
the LMS correlation coefficient?

[[elided Yahoo spam]]
--
View this message in context:
http://r.789695.n4.nabble.com/Help-with-LMSreg-tp3230611p3230611.html
Sent from the R help mailing list archive at Nabble.com.

       [[alternative HTML version deleted]]



------------------------------

Message: 70
Date: Fri, 21 Jan 2011 21:51:33 +0100
From: Freddy Gamma <freddy.gamma@gmail.com>
To: r-help@r-project.org
Subject: [R] TRADUCING lmer() syntax into lme()
Message-ID:
       <AANLkTin8jC+9EbWhATJpch=QMJxa5X0508k6yOxkr-Mp@mail.gmail.com>
Content-Type: text/plain

---------- Forwarded message ----------
From: Freddy Gamma <freddy.gamma@gmail.com>
Date: 2011/1/21
Subject: TRADUCING lmer() syntax into lme()
To: r-sig-mixed-models@r-project.org


Dear Rsociety,

I'd like to kingly ask to anyone is willing to answer me how to implement a
NON NESTED random effects structure in lme()


In particular I've tried the following translation from lmer to lme, as
suggested from some web example




mod1<-lmer(y~x*z+(x*z|factorA1/factorB)+(x*z|factorA2/factorB))  # y,x,z
continuous

mod2<-lme(y~x*z, random= pdBlocked(list(pdIdent(~1|factorA1/factorB
),pdIdent(~1|factorA2/factorB))))


In detail check how I've tried to state in mod1 that Iwant to evaluate
randomness in the interaction x*z (i.e intercept, slope, interaction)
grouped by by a general nesting structure that sets factorA1 and factorA2 as
same level effects (hence non nested) and factorB as nested in both.

I also must express my momentaneous sheer ignorange on the pdMat objects,
thing that prabably is not helping me in the process



Kindly Regards


Federico Bonofiglio

       [[alternative HTML version deleted]]



------------------------------

Message: 71
Date: Fri, 21 Jan 2011 15:33:56 -0500
From: las65@buffalo.edu
To: <r-help@r-project.org>
Subject: [R] building package
Message-ID: <19068.1295642036@buffalo.edu>
Content-Type: text/plain; charset="utf-8"

I have built a package that I would like to submit to the CRAN. When I
perform a R CMD
check I get the following warning:
* checking Rd cross-references ... WARNING
Error in .find.package(package, lib.loc) :
 there is no package called 'foreign'
Calls: <Anonymous> -> lapply -> FUN -> .find.package
Execution halted

I believe this has to do with the fact I use mapply function utilizing
internal
functions I have within the package? Am I wrong in this assumption? How
would I remedy
this in order to get rid of the warning?

Any advice is appreciated.
Thank you
Lori



------------------------------

Message: 72
Date: Fri, 21 Jan 2011 15:29:54 -0500
From: "Brahmachary, Manisha" <manisha.brahmachary@mssm.edu>
To: "David Winsemius" <dwinsemius@comcast.net>
Cc: R-help@r-project.org
Subject: Re: [R] Pearson correlation with randomization
Message-ID:
       <018787A29AB84E449A098AB1DFC73E7E01EE59C0@EXCH-EVS2.ExchMail.mssm.edu
>
Content-Type: text/plain;       charset="us-ascii"

Hi David,

Thanks a lot for you inputs. I have modified my code accordingly. There
is one more place that I need some help.
This is my code:

========================================================================
======

X<- read.table("X.txt",as.is=T,header=T,row.names=1)
Y<- read.table("Y.txt",as.is=T,header=T,row.names=1)

X.mat<- as.matrix(X)
Y.mat<- as.matrix(Y)

# calculating the true correlation values from my original dataset
True.Corrs<- matrix()
for (k in 1:nrow(SNP.mat)){
True.Corrs[k]<- cor.test(X.mat[k,],Y.mat[k,],alternative
=c("greater"),method= c("pearson"))$p.value
}

# Creating the random distribution of Correlation p-values
X.rand <- list()
Y.rand<- list()

X.rand<-replicate(1000,(X[sample(1:ncol(Y))]),simplify=FALSE)  #
Randomizing the column values for each row
Y.rand<-replicate(1000,Y,simplify=FALSE) # Creating an equivalent list
of the Y matrix (non-randomised), to be able to do a pair-wise cor.test

Corrs.rand<- list()
tmp<- list()
for (i in 1:2){
for (j in 1:3){
# How to store a multiple values per element of list?
tmp[[j]] <- cor.test(t(X.rand[[i]][j,]),t(Y.rand[[i]][j,]),alternative
=c("greater"),method= c("pearson"))$p.value
Corrs.rand[[i]] <- rbind(Corrs.rand[[j]],tmp[[j]])
}
}

========================================================================

At this step:

for (i in 1:length(X.rand)){
for (j in 1:nrow(X.rand[[1]]){
# How to store a multiple values per element of list?
tmp[[j]] <- cor.test(t(X.rand[[i]][j,]),t(Y.rand[[i]][j,]),alternative
=c("greater"),method= c("pearson"))$p.value
Corrs.rand[[i]] <- rbind(Corrs.rand[[j]],tmp[[j]])
}
}

I am not sure how I can store multiple values per element. For eg. I
want a list of length 1000 (which is the number of random permutations I
have generated for my dataset) and in each element of the list I need to
store 12 p.values where 12 corresponds to the number of rows I have in
my randomized dataset. Eg.

[[1]]
0.23
0.05
0.78
0.78
0.87
0.11
0.003
0.9
0.76
0.11
0.23
0.56
[[2]]
0.08
0.67
0.45
0.23
0.35
0.85
0.99
0.78
0.66
0.45
0.06
0.1
[[3]]
So on...

I maybe going about this in a complicated way and there may be other
ways of storing the p.values for each of my randomized dataset. So if
anybody has ideas please oblige me.
======================================================
X dataset:(sample)
#Probes X10851  X12144  X12155  X11882  X10860  X12762  X12239  X12154
1       1       1       0       0       1       0       2       0
2       0       0       0       0       0       0       0       0
3       2       2       2       2       1       2       1       2
4       0       0       0       0       0       0       0       0
5       2       2       2       2       2       2       2       2
6       0       1       0       0       1       1       1       1
7       2       2       NaN     2       2       2       2       2
8       2       2       2       2       2       2       2       2
9       0       1       0       1       1       NaN     1       2
10      2       2       2       2       2       2       2       2
11      2       0       0       0       0       0       0       0
12      0       1       0       1       1       0       1       1


Y dataset:(sample)

Probes  X10851  X12144  X12155  X11882  X10860  X12762  X12239  X12154
1       793.0830793     788.1813828     867.8504057     729.8321265
816.8519963     805.2113707     774.5990003     854.6384306
2       12.8695023      4.312894024     10.69769375     5.872212512
13.79299806     9.394132659     6.297552848     9.307943304
3       699.7791876     826.997429      795.6409729     770.9376141
806.1241089     782.3970486     817.107482      859.7154906
4       892.8217221     869.0481458     806.3386667     812.0431017
873.5565439     794.4752191     813.9587056     814.8681274
5       892.8217221     869.0481458     806.3386667     812.0431017
873.5565439     794.4752191     813.9587056     814.8681274
6       839.7350251     943.4455677     950.7575323     859.0208018
894.246041      853.524053      941.4841508     913.0246205
7       653.1272418     751.5217836     750.1757745     737.382114
757.8486157     758.2407075     724.2185775     770.8669409
8       12.8695023      4.312894024     10.69769375     5.872212512
13.79299806     9.394132659     6.297552848     9.307943304
9       839.7350251     943.4455677     950.7575323     859.0208018
894.246041      853.524053      941.4841508     913.0246205
10      653.1272418     751.5217836     750.1757745     737.382114
757.8486157     758.2407075     724.2185775     770.8669409
11      653.1272418     751.5217836     750.1757745     737.382114
757.8486157     758.2407075     724.2185775     770.8669409
12      839.7350251     943.4455677     950.7575323     859.0208018
894.246041      853.524053      941.4841508     913.0246205

Thanks again

Manisha




-----Original Message-----
From: David Winsemius [mailto:dwinsemius@comcast.net]
Sent: Tuesday, January 18, 2011 11:56 PM
To: Brahmachary, Manisha
Cc: R-help@r-project.org
Subject: Re: [R] Pearson correlation with randomization


On Jan 18, 2011, at 11:23 PM, Brahmachary, Manisha wrote:

> Hello,
>
>
>
> I will be very obliged if someone can help me with this statistical R
> problem:
>
> I am trying to do a Pearson correlation on my datasets X, Y with
> randomization test. My X and Y datasets are pairs.
>
> 1.     I want to randomize (rearrange) only my X dataset per
> row ,while
> keeping the my Y dataset as it is.

X <- X[sample(1:nrow(Y)), ]

>
> 2.     Then Calculate the correlation  for this pair, and compare it
> to
> your true value of correlation.
>
> 3.     Repeat 2 and 3 maybe a 100 times

You may want to look at the replicate function.

>
> 4.     If your true p-value  is greater than 95% of the random values,
> then you can reject the null hypothesis at   p<0.05.

You won't have a very stable estimate of the 95th order statistics
with "maybe" 100 replications.

--
David.
>
>
>
> I am stuck at the randomization step. I need some help in implementing
> it the appropriate randomization step in my correlation.
>
> Below is my incomplete code. I will be very obliged if someone could
> help:
>
>
>
> X <- read.table("X.txt",as.is=T,header=T,row.names=1)
>
> Y <- read.table("Y.txt",as.is=T,header=T,row.names=1)
>
>
>
> X.mat<- as.matrix(X)
>
> Y.mat<- as.matrix(Y)
>
>
>
> Corrs<- cor.test(X.mat[1,],Y.mat[1,],alternative =c("greater"),method=
> c("pearson"))
>
>
>
> Corrs.rand <- list()
>
>
>
> for (i in 1:length(X.mat)){
>
> for (j in 1:100){
>
>
>
> # This doesnot seem to wrok correctly. How do I run sample function
> 100
> times for the same row?
>
>
>
> SNP.rand<- sample(SNP.mat[i,],56, replace = FALSE, prob = NULL)
>
> Corrs.rand[[j]]<- cor.test(SNP.rand,CNV.mat[j,],alternative
> =c("greater"),method= c("pearson"))
>
>
>
> # need to calculate how many times my pvalue from true p-value> random
> pvalue
>
> }
>
> }
>
>
>
> X dataset:
>
>
>
> #Probes
>
> X10851
>
> X12144
>
> X12155
>
> X11882
>
> X10860
>
> X12762
>
> X12239
>
> X12154
>
> 1
>
> 1
>
> 1
>
> 0
>
> 0
>
> 1
>
> 0
>
> 2
>
> 0
>
> 2
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 3
>
> 2
>
> 2
>
> 2
>
> 2
>
> 1
>
> 2
>
> 1
>
> 2
>
> 4
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 5
>
> 2
>
> 2
>
> 2
>
> 2
>
> 2
>
> 2
>
> 2
>
> 2
>
> 6
>
> 0
>
> 1
>
> 0
>
> 0
>
> 1
>
> 1
>
> 1
>
> 1
>
> 7
>
> 2
>
> 2
>
> NaN
>
> 2
>
> 2
>
> 2
>
> 2
>
> 2
>
> 8
>
> 2
>
> 2
>
> 2
>
> 2
>
> 2
>
> 2
>
> 2
>
> 2
>
> 9
>
> 0
>
> 1
>
> 0
>
> 1
>
> 1
>
> NaN
>
> 1
>
> 2
>
> 10
>
> 2
>
> 2
>
> 2
>
> 2
>
> 2
>
> 2
>
> 2
>
> 2
>
> 11
>
> 2
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 12
>
> 0
>
> 1
>
> 0
>
> 1
>
> 1
>
> 0
>
> 1
>
> 1
>
>
>
> Y dataset:
>
> Probes
>
> X10851
>
> X12144
>
> X12155
>
> X11882
>
> X10860
>
> X12762
>
> X12239
>
> X12154
>
> 1
>
> 793.0831
>
> 788.1814
>
> 867.8504
>
> 729.8321
>
> 816.852
>
> 805.2114
>
> 774.599
>
> 854.6384
>
> 2
>
> 12.8695
>
> 4.312894
>
> 10.69769
>
> 5.872213
>
> 13.793
>
> 9.394133
>
> 6.297553
>
> 9.307943
>
> 3
>
> 699.7792
>
> 826.9974
>
> 795.641
>
> 770.9376
>
> 806.1241
>
> 782.397
>
> 817.1075
>
> 859.7155
>
> 4
>
> 892.8217
>
> 869.0481
>
> 806.3387
>
> 812.0431
>
> 873.5565
>
> 794.4752
>
> 813.9587
>
> 814.8681
>
> 5
>
> 892.8217
>
> 869.0481
>
> 806.3387
>
> 812.0431
>
> 873.5565
>
> 794.4752
>
> 813.9587
>
> 814.8681
>
> 6
>
> 839.735
>
> 943.4456
>
> 950.7575
>
> 859.0208
>
> 894.246
>
> 853.5241
>
> 941.4842
>
> 913.0246
>
> 7
>
> 653.1272
>
> 751.5218
>
> 750.1758
>
> 737.3821
>
> 757.8486
>
> 758.2407
>
> 724.2186
>
> 770.8669
>
> 8
>
> 12.8695
>
> 4.312894
>
> 10.69769
>
> 5.872213
>
> 13.793
>
> 9.394133
>
> 6.297553
>
> 9.307943
>
> 9
>
> 839.735
>
> 943.4456
>
> 950.7575
>
> 859.0208
>
> 894.246
>
> 853.5241
>
> 941.4842
>
> 913.0246
>
> 10
>
> 653.1272
>
> 751.5218
>
> 750.1758
>
> 737.3821
>
> 757.8486
>
> 758.2407
>
> 724.2186
>
> 770.8669
>
> 11
>
> 653.1272
>
> 751.5218
>
> 750.1758
>
> 737.3821
>
> 757.8486
>
> 758.2407
>
> 724.2186
>
> 770.8669
>
> 12
>
> 839.735
>
> 943.4456
>
> 950.7575
>
> 859.0208
>
> 894.246
>
> 853.5241
>
> 941.4842
>
> 913.0246
>
>
>
>
>
>
>
> Thanks in advance
>
>
>
> Manisha
>
>
>
> Mount Sinai School of Medicine
>
> Icahn Medical Institute,
>
> 1425 Madison Avenue, Box 1498
>
> NY-10029, NEW-YORK, USA
>
>
>
>
>       [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 73
Date: Fri, 21 Jan 2011 15:16:14 -0800
From: Horace Tso <Horace.Tso@pgn.com>
To: r-help <r-help@r-project.org>
Subject: [R] glitch in building R package
Message-ID:
       <5C3F9922B1D5FB4886B2D2045AB952F3056E4D0C3F@IPEXMAIL.corp.dom>
Content-Type: text/plain

I follow Alan Lenarcic's very helpful tutorial on building R package for
Windows (XP), which could be found in
www.stat.columbia.edu/~gelman/stuff_for_blog/AlanRPackageTutorial.pdf<http://www.stat.columbia.edu/%7Egelman/stuff_for_blog/AlanRPackageTutorial.pdf>
<
http://www.stat.columbia.edu/~gelman/stuff_for_blog/AlanRPackageTutorial.pdf<http://www.stat.columbia.edu/%7Egelman/stuff_for_blog/AlanRPackageTutorial.pdf>>.
The package involves a small dll compiled from some very simple C++ codes.

The build process seemed to work smoothly, until i install. Then I got an
error saying the C function was not in the load table. This is rather
mysterious because I've been able to call this function from R with
dyn.load("name.dll"). So the dll is working.

The install error says :

C:\R-test>R CMD INSTALL --build FirstPack_0.1.tar.gz
* installing to library 'c:/R/R-2.12.0/library'
* installing *source* package 'FirstPack' ...
** libs
cygwin warning:
 MS-DOS style path detected: c:/R/R-2.12.0/etc/i386/Makeconf
 Preferred POSIX equivalent is: /cygdrive/c/R/R-2.12.0/etc/i386/Makeconf
 CYGWIN environment variable option "nodosfilewarning" turns off this
warning.
 Consult the user's guide for more details about POSIX paths:
   http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
g++ -I"c:/R/R-2.12.0/include"         -O2 -Wall  -c XDemo.cpp -o XDemo.o
g++ -I"c:/R/R-2.12.0/include"         -O2 -Wall  -c XDemo_main.cpp -o
XDemo_main
.o
g++ -shared -s -static-libgcc -o FirstPack.dll tmp.def XDemo.o XDemo_main.o
-Lc:
/R/R-2.12.0/bin/i386 -lR
installing to c:/R/R-2.12.0/library/FirstPack/libs/i386
** R
** data
Warning: empty 'data' directory
** preparing package for lazy loading
Error in .C("DemoAutoCor", OutVec = as.double(vector("numeric", OutLength)),
 :

 C symbol name "DemoAutoCor" not in load table
ERROR: lazy loading failed for package 'FirstPack'
* removing 'c:/R/R-2.12.0/library/FirstPack'
Here is how i built the package. I have the directory structure as described
in "Writing R Extensions" and I issued the following command in DOS prompt,

C:\R-test>R CMD build FirstPack
* checking for file 'FirstPack/DESCRIPTION' ... OK
* preparing 'FirstPack':
* checking DESCRIPTION meta-information ... OK
* cleaning src
cygwin warning:
 MS-DOS style path detected: C:/R-test/FirstPack_0.1.tar
 Preferred POSIX equivalent is: /cygdrive/c/R-test/FirstPack_0.1.tar
 CYGWIN environment variable option "nodosfilewarning" turns off this
warning.
 Consult the user's guide for more details about POSIX paths:
   http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
cygwin warning:
 MS-DOS style path detected: C:/R-test/FirstPack_0.1.tar
 Preferred POSIX equivalent is: /cygdrive/c/R-test/FirstPack_0.1.tar
 CYGWIN environment variable option "nodosfilewarning" turns off this
warning.
 Consult the user's guide for more details about POSIX paths:
   http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Warning in readLines(ldpath) :
 incomplete final line found on 'FirstPack/DESCRIPTION'
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
WARNING: directory 'FirstPack/data' is empty
* building 'FirstPack_0.1.tar.gz'
cygwin warning:
 MS-DOS style path detected: C:/R-test/FirstPack_0.1.tar
 Preferred POSIX equivalent is: /cygdrive/c/R-test/FirstPack_0.1.tar
 CYGWIN environment variable option "nodosfilewarning" turns off this
warning.
 Consult the user's guide for more details about POSIX paths:
   http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
cygwin warning:
 MS-DOS style path detected: C:/R-test/FirstPack_0.1.tar
 Preferred POSIX equivalent is: /cygdrive/c/R-test/FirstPack_0.1.tar
 CYGWIN environment variable option "nodosfilewarning" turns off this
warning.
 Consult the user's guide for more details about POSIX paths:
   http://cygwin.com/cygwin-ug-net/using.html#using-pathnames

Thanks in advance.

H



       [[alternative HTML version deleted]]



------------------------------

Message: 74
Date: Fri, 21 Jan 2011 20:29:32 -0500
From: Duncan Murdoch <murdoch.duncan@gmail.com>
To: las65@buffalo.edu
Cc: r-help@r-project.org
Subject: Re: [R] building package
Message-ID: <4D3A32FC.3010509@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 11-01-21 3:33 PM, las65@buffalo.edu wrote:
> I have built a package that I would like to submit to the CRAN. When I
perform a R CMD
> check I get the following warning:
> * checking Rd cross-references ... WARNING
> Error in .find.package(package, lib.loc) :
>    there is no package called 'foreign'
> Calls:<Anonymous>  ->  lapply ->  FUN ->  .find.package
> Execution halted
>
> I believe this has to do with the fact I use mapply function utilizing
internal
> functions I have within the package? Am I wrong in this assumption? How
would I remedy
> this in order to get rid of the warning?

This message is about your documentation files, not your R code.  Search
your .Rd files for "foreign" and either remove the reference, or add a
Depends statement to your DESCRIPTION saying you depend on the foreign
package.

Duncan Murdoch

>
> Any advice is appreciated.
> Thank you
> Lori
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



------------------------------

Message: 75
Date: Sat, 22 Jan 2011 01:10:45 +0200
From: Den <d.kazakiewicz@gmail.com>
To: Henrique Dallazuanna <wwwhsd@gmail.com>
Cc: R-help <r-help@r-project.org>
Subject: Re: [R] complex transformation of data
Message-ID: <1295651445.1724.0.camel@den2042-desktop>
Content-Type: text/plain; charset="UTF-8"

[[elided Yahoo spam]]
It is a pure magic which makes my head spin.
aggregate(.~ id, lapply(df, as.character), FUN =
function(x)paste(sort(x), collapse = ''), na.action = na.pass)

1. help says:
 Note that ?paste()? coerces ?NA_character_?, the character missing
value, to ?"NA"'
And at the same time:
 ?na.pass? returns the object unchanged.
I am happy, that I don't have NAs in mydata.  I just don't understand
how
it happened.
2. Can't see the real difference between 'FUN = function(x) paste(x)'
and 'FUN = paste'. However, former working perfectly while latter simply
not.
3.Finally, all help says about LHS in formulas like '.~id' is that it's
name is "dot notation". And not a single word more. Thus, I have no
clue, what dot in that formula really means.


Conclusion:
1. It's a magic.
2. You definitely saved my investigation. (When I've started I had no
idea it would be so difficult to arrange those chemotherapy cycles in
dataframe, although I dare to call myself pharmacoepidemiologist (which
sounds rather funny after that story))
3. THANK YOU!!!!!!

Sincerely yours
Denis Kazakiewicz
Belarus


? ???, 21/01/2011 ? 18:37 -0200, Henrique Dallazuanna ????:
> Just change the FUN function:
>
> aggregate(.~ id, lapply(df, as.character), FUN =
> function(x)paste(sort(x), collapse = ''), na.action = na.pass)
>
> On Fri, Jan 21, 2011 at 6:27 PM, Den <d.kazakiewicz@gmail.com> wrote:
>
>         Thank you for your efforts.
>         Although it is still not working, it feels like getting closer
>         and
>         closer.
>
>         id cycle1 cycle2 cycle3
>         1  1    cmf    cmf    cmf
>         2  2    mfc    mfc    mfc
>
>         3  3  acfNA  acfNA  NAcfm
>
>         I really appreciate transformation from subsets ("c","m","f")
>         to "cmf".
>         That was critical for me.
>         Hopefully, I'll figure  out the rest later with ddply from
>         plyr package.
>         At least this is my idea for now.
>
>
>
>         ? ???, 21/01/2011 ? 18:00 -0200, Henrique Dallazuanna ????:
>
>         > correction:
>         > aggregate(.~ id, lapply(df, as.character), FUN = paste,
>         collapse = "",
>         > na.action = na.pass)
>         >
>         > On Fri, Jan 21, 2011 at 5:56 PM, Henrique Dallazuanna
>         > <wwwhsd@gmail.com> wrote:
>         >         Try this:
>         >
>         >         aggregate(.~ id, lapply(replace(df, is.na(df), ''),
>         >         as.character), FUN = paste, collapse = "", na.action
>         =
>         >         na.pass)
>         >
>         >
>         >
>         >         On Fri, Jan 21, 2011 at 5:45 PM, Den
>         <d.kazakiewicz@gmail.com>
>         >         wrote:
>         >                 Dear Henrique
>         >                 Thank you again for helping me
>         >                 Unfortunately, your code seems not to be
>         working
>         >
>         >                 > aggregate(.~ id, lapply(df, as.character),
>         FUN =
>         >                 paste, collapse = "")
>         >                  id cycle1 cycle2 cycle3
>         >                 1  1    cmf    cmf    cmf
>         >                 2  2    mfc    mfc    mfc
>         >                 3  3     cf     cf     cf
>         >
>         >                 (letter 'a' missing in
>         df[3,c("cycle1",cycle2")]
>         >
>         >                 You suggested very interesting approach,
>         however.
>         >                 Those '.~ id' and
>         >                 'as.character' gave me hope for success.
>         >                 With very best regards
>         >                 Denis
>         >
>         >
>         >                 ? ???, 21/01/2011 ? 14:16 -0200, Henrique
>         Dallazuanna
>         >                 ????:
>         >
>         >                 > Try this:
>         >                 >
>         >                 > aggregate(.~ id, lapply(test,
>         as.character), FUN =
>         >                 paste, collapse =
>         >                 > "")
>         >                 >
>         >                 > On Fri, Jan 21, 2011 at 10:25 AM, Den
>         >                 <d.kazakiewicz@gmail.com> wrote:
>         >                 >         Dear [R] people
>         >                 >         Could you please help with
>         following data
>         >                 transformation.
>         >                 >         Any suggestions, hints, references
>         and even
>         >                 guessing on
>         >                 >         performing any
>         >                 >         of the following steps are highly
>         >                 appreciated. Those
>         >                 >         transformations are
>         >                 >         crucial for my work.
>         >                 >
>         >                 >         (n_, _n, j_, k_ signify numbers)
>         >                 >
>         >                 >         SOURCE DATA:
>         >                 >         id      cycle1  cycle2  cycle3  ?
>         >                 cycle_n
>         >                 >         1       c       c       c
>         c
>         >                 >         1       m       m       m
>         m
>         >                 >         1       f       f       f
>         f
>         >                 >         2       m       m       m
>         NA
>         >                 >         2       f       f       f
>         NA
>         >                 >         2       c       c       c
>         NA
>         >                 >         3       a       a       NA
>                NA
>         >                 >         3       c       c       c
>         NA
>         >                 >         3       f       f       f
>         NA
>         >                 >         3       NA      NA      m
>         NA
>         >                 >
>           ...........................................
>         >                 >
>         >                 >
>         >                 >
>         >                 >         RESULT DATA1:
>         >                 >         id      cyc1    cyc2    cyc3    ?
>         >                 cyc_n
>         >                 >         1       cfm     cfm     cfm
>         cfm
>         >                 >         2       cfm     cfm     cfm
>         NA
>         >                 >         3       acf     acf     cfm
>         NA
>         >                 >
>           ...........................................
>         >                 >
>         >                 >
>         >                 >         RESULT DATA2:
>         >                 >         id      treatment
>         >                 >         1       n_cfm
>         >                 >         2       j_cfm
>         >                 >         3       2acf->k_cfm
>         >                 >         ...................
>         >                 >
>         >                 >
>         >                 >         RESULT DATA3:
>         >                 >         id      regimen numOfCycles
>         >                 >         1       cfm     n_
>         >                 >         2       cfm     j_
>         >                 >         3       asf->cfm        {2+k_}
>         >                 >         .............................
>         >                 >
>         >                 >
>         >                 >
>         >                 >         Thank you
>         >                 >         Denis
>         >                 >
>         >                 >
>         >
>         ______________________________________________
>         >                 >         R-help@r-project.org mailing list
>         >                 >
>         https://stat.ethz.ch/mailman/listinfo/r-help
>         >                 >         PLEASE do read the posting guide
>         >                 >
>         http://www.R-project.org/posting-guide.html
>         >                 >         and provide commented, minimal,
>         >                 self-contained, reproducible
>         >                 >         code.
>         >                 >
>         >                 >
>         >                 >
>         >                 > --
>         >                 > Henrique Dallazuanna
>         >                 > Curitiba-Paran?-Brasil
>         >                 > 25? 25' 40" S 49? 16' 22" O
>         >
>         >
>         >
>         >
>         >
>         >
>         >         --
>         >         Henrique Dallazuanna
>         >         Curitiba-Paran?-Brasil
>         >         25? 25' 40" S 49? 16' 22" O
>         >
>         >
>         >
>         >
>         > --
>         > Henrique Dallazuanna
>         > Curitiba-Paran?-Brasil
>         > 25? 25' 40" S 49? 16' 22" O
>
>
>
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paran?-Brasil
> 25? 25' 40" S 49? 16' 22" O



------------------------------

Message: 76
Date: Sat, 22 Jan 2011 03:04:30 +0200
From: Den <d.kazakiewicz@gmail.com>
To: poppinkid <jtlu@bcm.edu>
Cc: R-help <r-help@r-project.org>
Subject: Re: [R] How to find data that includes certain values
Message-ID: <1295658270.1947.19.camel@den2042-desktop>
Content-Type: text/plain; charset="UTF-8"

Hello
Consider following dataframe named df


var1    var2    var3
3771    354     565
654654  963     6677
775     147     657754

df <- read.table('clipboard', header = TRUE)
df
#find indexes with '77' in var 1
myIndexes <- grep( glob2rx("*77*"), df$var1)
myIndexes
#find actual values of seach above
myValu <- grep( glob2rx("*77*"), df$var1, value=TRUE)
myValu
#find all '77' in entire dataframe
all77 <- lapply(df, function(x)grep( glob2rx("*77*"), x, value=TRUE))
all77
#OR indexes
all77ind <-lapply(df, function(x)grep( glob2rx("*77*"), x))
all77ind


Hope that helps
With best regards
Denis



------------------------------

Message: 77
Date: Sat, 22 Jan 2011 03:03:08 +0100
From: jochen laubrock <jochen.laubrock@gmail.com>
To: r-help@r-project.org
Subject: [R] lm(y ~ x1) vs. lm(y ~ x0 + x1 - 1) with x0 <- rep(1,
       length(y))
Message-ID: <58726081-253A-4326-9989-0D00037C3CCC@gmail.com>
Content-Type: text/plain; charset=us-ascii

Dear list,

the following came up in an introductory class. Please help me understand
the -1 (or 0+) syntax in formulae: Why do the enumerator dfs, F-statisics
etc. differ between the models lm(y ~ x1) and lm(y ~ x0 + x1 - 1), if x0 is
a vector containing simply ones?

Example:

N  <- 40
x0 <- rep(1,N)
x1 <- 1:N
vare <- N/8
set.seed(4)
e <- rnorm(N, 0, vare^2)

X <- cbind(x0, x1)
beta <- c(.4, 1)
y <- X %*% beta + e

summary(lm(y ~ x1))
# [...]
# Residual standard error: 20.92 on 38 degrees of freedom
# Multiple R-squared: 0.1151,   Adjusted R-squared: 0.09182
# F-statistic: 4.943 on 1 and 38 DF,  p-value: 0.03222

summary(lm(y ~ x0 + x1 - 1))        # or summary(lm(y ~ 0 + x0 + x1))
# [...]
# Residual standard error: 20.92 on 38 degrees of freedom
# Multiple R-squared: 0.6888,   Adjusted R-squared: 0.6724
# F-statistic: 42.05 on 2 and 38 DF,  p-value: 2.338e-10


Thanks in advance,
Jochen


----
Jochen Laubrock, Dept. of Psychology, University of Potsdam,
Karl-Liebknecht-Strasse 24-25, 14476 Potsdam, Germany
phone: +49-331-977-2346, fax: +49-331-977-2793



------------------------------

Message: 78
Date: Fri, 21 Jan 2011 18:31:13 -0800
From: Dennis Murphy <djmuser@gmail.com>
To: Michael Costello <michaelavcostello@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Looping with incremented object name and increment
       function
Message-ID:
       <AANLkTi=ccHR6pNvJWNY3wBXrs3mBe5y1kmbXSZUHo9y1@mail.gmail.com>
Content-Type: text/plain

Hi:

Here's an example of how to extract pieces from model objects using the plyr
package. I'm using the attitude data set from the datasets package
(autoloaded).

# Generate four models
m1 <- lm(rating ~ ., data = attitude)
m2 <- lm(rating ~ complaints + learning, data = attitude)
m3 <- lm(rating ~ complaints * learning, data = attitude)
m4 <- lm(rating ~ complaints, data = attitude)
# Combine them into a list
mlist <- list(m1 = m1, m2 = m2, m3 = m3, m4 = m4)

# Utility functions:
# In this context, x represents a generic model object. We want
# to extract the same information from each object.
# Can package these (or others) into a single function if you
# wish to output a list object.

# Sums of squares extraction:
ss <- function(x) summary(x)$coefficients[, 2]

# R^2
r2 <- function(x) summary(x)$r.squared

# Model and residual df:
dfs <- function(x) summary(x)$df[1:2]

# ldply() takes a list object as input and returns a data frame object
# llply() takes a list object as input and returns a list
# Each call applies a utility function to each component model in the list
library(plyr)
ldply(mlist, r2)
ldply(mlist, dfs)
llply(mlist, ss)

HTH,
Dennis

On Fri, Jan 21, 2011 at 8:42 AM, Michael Costello <
michaelavcostello@gmail.com> wrote:

> Folks,
>
> I am trying to get a loop to run which increments the object name as part
> of
> the loop.  Here "fit1" "fit2" "fit3" and "fit4" are linear regression
> models
> that I have created.
>
> > for (ii in c(1:4)){
> + SSE[ii]=rbind(anova(fit[ii])$"Sum Sq")
> + dfe[ii]=rbind(summary(fit[ii])$df)
> + }
> Error in anova(fit[ii]) : object 'fit' not found
>
> Why isn't it looking for object 'fit1' instead of 'fit'?
>
> The idea is that it would store in SSE1 the Sum Sq of the model fit1, and
> so
> on for the other 3 models.  Is there a way to do this in R?  I can do it
in
> Stata, but am only somewhat knowledgeable in R.
>
> -Michael
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

       [[alternative HTML version deleted]]



------------------------------

Message: 79
Date: Fri, 21 Jan 2011 22:48:06 -0500
From: David Winsemius <dwinsemius@comcast.net>
To: jochen laubrock <jochen.laubrock@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] lm(y ~ x1) vs. lm(y ~ x0 + x1 - 1) with x0 <- rep(1,
       length(y))
Message-ID: <C3AAAFD9-4D92-4D8A-88D8-4BE0E32C87D4@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Jan 21, 2011, at 9:03 PM, jochen laubrock wrote:

> Dear list,
>
> the following came up in an introductory class. Please help me
> understand the -1 (or 0+) syntax in formulae: Why do the enumerator
> dfs, F-statisics etc. differ between the models lm(y ~ x1) and lm(y
> ~ x0 + x1 - 1), if x0 is a vector containing simply ones?

You are testing something different. In the first case you are testing
the difference between the baseline and the second level of x1 (so
there is only one d.f.), while in the second case you are testing for
both of the coefficients being zero (so the numerator has 2 d.f.). It
would be easier to see if you did print() on the fit object. The first
model would give you an estimate for an "Intercept", which is really
an estimate for the first level of x1.  Having been taught to think of
anova as just a special case of regression is helpful here. Look at
the model first  and only then look at the anova table.


>
> Example:
>
> N  <- 40
> x0 <- rep(1,N)
> x1 <- 1:N
> vare <- N/8
> set.seed(4)
> e <- rnorm(N, 0, vare^2)
>
> X <- cbind(x0, x1)
> beta <- c(.4, 1)
> y <- X %*% beta + e
>
> summary(lm(y ~ x1))
> # [...]
> # Residual standard error: 20.92 on 38 degrees of freedom
> # Multiple R-squared: 0.1151, Adjusted R-squared: 0.09182
> # F-statistic: 4.943 on 1 and 38 DF,  p-value: 0.03222
>
> summary(lm(y ~ x0 + x1 - 1))        # or summary(lm(y ~ 0 + x0 + x1))
> # [...]
> # Residual standard error: 20.92 on 38 degrees of freedom
> # Multiple R-squared: 0.6888, Adjusted R-squared: 0.6724
> # F-statistic: 42.05 on 2 and 38 DF,  p-value: 2.338e-10
>
>
> Thanks in advance,
> Jochen
>
>
> ----
> Jochen Laubrock, Dept. of Psychology, University of Potsdam,
> Karl-Liebknecht-Strasse 24-25, 14476 Potsdam, Germany
> phone: +49-331-977-2346, fax: +49-331-977-2793
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 80
Date: Fri, 21 Jan 2011 22:10:05 -0500
From: Mingo <catojones@gmail.com>
To: R-help@r-project.org
Subject: [R] R - Vectorization and Functional Programming Constructs
Message-ID:
       <AANLkTi=J+=yV_gUZNNtjj+wqXG80owKEnAzGA2v_jCVQ@mail.gmail.com<yV_gUZNNtjj%2BwqXG80owKEnAzGA2v_jCVQ@mail.gmail.com>
>
Content-Type: text/plain

Hello, I am new to R (coming from Perl) and have what is, at least at this
point, a philosophical question and a request for comment on some basic
code. As I understand it - R emphasizes ,or at least supports, the
functional programming model. I've come across some code that was markedly
absent in for loops - and have been seeing some constructs that relate to
functional programming and vectorized code (not that is at all unique to R
of course). But I'm also new to the concept of vectorizing code.

However, since I anticipate dealing with vectors of large sizes I think that
this approach is probably going to serve well in terms of performance. As an
example I anticipate having vector operations  calling for shifting. I'll be
shifting vectors to the right (or left) like below while maintaining the
length and filling with zeros. Keep in mind I'll ultimately be dealing with
vectors with very large length.

>x <- c(0,3,2,1,0,0,0)
>vlen <- length(x)
[1] 7

One solution to accomplish the right shift is to do something like:

>x=c(0,x[1:vlen-1])
>x
1] 0 0 3 2 1 0 0

this does the trick though I'm wondering if this is in the spirit of
"Vectorization". I could make recursive function that would cycle through
the whole vector eventually leaving it full of 0s thus ending the recursion.
Though does this capture the spirit of R programming and vectorizing ? Are
there more primitive operators "closer" to the underlying C code that would
serve performance interests better ?

       [[alternative HTML version deleted]]



------------------------------

Message: 81
Date: Fri, 21 Jan 2011 20:18:30 -0800
From: Bert Gunter <gunter.berton@gene.com>
To: David Winsemius <dwinsemius@comcast.net>
Cc: r-help@r-project.org
Subject: Re: [R] lm(y ~ x1) vs. lm(y ~ x0 + x1 - 1) with x0 <- rep(1,
       length(y))
Message-ID:
       <AANLkTi=Be=dtFDW1rm1QzSo54kFkGRxUtp9usXn=Hgpz@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Well ... as x1 is continuous(numeric), it has no levels. So ...??

Note that the fits are identical for both models. The issue is only
what is the Null that you are testing in the two cases. In the first
case, it is just y = constant, so you are testing the 1 df for x1. In
the second, it is y = 0 (which rarely makes any sense) and you are
testing the 2 df for the two terms (x0 and x1). Etc. etc.

-- Bert

On Fri, Jan 21, 2011 at 7:48 PM, David Winsemius <dwinsemius@comcast.net>
wrote:
>
> On Jan 21, 2011, at 9:03 PM, jochen laubrock wrote:
>
>> Dear list,
>>
>> the following came up in an introductory class. Please help me understand
>> the -1 (or 0+) syntax in formulae: Why do the enumerator dfs, F-statisics
>> etc. differ between the models lm(y ~ x1) and lm(y ~ x0 + x1 - 1), if x0
is
>> a vector containing simply ones?
>
> You are testing something different. In the first case you are testing the
> difference between the baseline and the second level of x1 (so there is
only
> one d.f.), while in the second case you are testing for both of the
> coefficients being zero (so the numerator has 2 d.f.). It would be easier
to
> see if you did print() on the fit object. The first model would give you
an
> estimate for an "Intercept", which is really an estimate for the first
level
> of x1. ?Having been taught to think of anova as just a special case of
> regression is helpful here. Look at the model first ?and only then look at
> the anova table.
>
>
>>
>> Example:
>>
>> N ?<- 40
>> x0 <- rep(1,N)
>> x1 <- 1:N
>> vare <- N/8
>> set.seed(4)
>> e <- rnorm(N, 0, vare^2)
>>
>> X <- cbind(x0, x1)
>> beta <- c(.4, 1)
>> y <- X %*% beta + e
>>
>> summary(lm(y ~ x1))
>> # [...]
>> # Residual standard error: 20.92 on 38 degrees of freedom
>> # Multiple R-squared: 0.1151, ? Adjusted R-squared: 0.09182
>> # F-statistic: 4.943 on 1 and 38 DF, ?p-value: 0.03222
>>
>> summary(lm(y ~ x0 + x1 - 1)) ? ? ? ?# or summary(lm(y ~ 0 + x0 + x1))
>> # [...]
>> # Residual standard error: 20.92 on 38 degrees of freedom
>> # Multiple R-squared: 0.6888, ? Adjusted R-squared: 0.6724
>> # F-statistic: 42.05 on 2 and 38 DF, ?p-value: 2.338e-10
>>
>>
>> Thanks in advance,
>> Jochen
>>
>>
>> ----
>> Jochen Laubrock, Dept. of Psychology, University of Potsdam,
>> Karl-Liebknecht-Strasse 24-25, 14476 Potsdam, Germany
>> phone: +49-331-977-2346, fax: +49-331-977-2793
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Bert Gunter
Genentech Nonclinical Biostatistics
467-7374
http://devo.gene.com/groups/devo/depts/ncb/home.shtml



------------------------------

Message: 82
Date: Sat, 22 Jan 2011 05:33:06 +0100
From: jochen laubrock <jochen.laubrock@gmail.com>
To: Bert Gunter <gunter.berton@gene.com>
Cc: r-help@r-project.org
Subject: Re: [R] lm(y ~ x1) vs. lm(y ~ x0 + x1 - 1) with x0 <- rep(1,
       length(y))
Message-ID: <D1AF1968-93F3-42B5-8100-99E3DDF9B3B2@gmail.com>
Content-Type: text/plain; charset=us-ascii

Thank you all (including Dennis), this was elucidating.

I would have (maybe naively) anticipated that in this somewhat pathological
case of fitting without an intercept and re-introducing it via constant x1,
R might check whether the design matrix includes a column of ones, and
adjust the degrees of freedom accordingly. But now I can see that by
explicitly requesting via the formula interface not to fit a constant, I am
implicitly stating my hypothesis that y==0, even if I re-introduce my
suspicion that y==mu via x1 <- 1. If I understood correctly, x1 is treated
as a variable in the latter case, right?



On Jan 22, 2011, at 5:18 , Bert Gunter wrote:

> Well ... as x1 is continuous(numeric), it has no levels. So ...??
>
> Note that the fits are identical for both models. The issue is only
> what is the Null that you are testing in the two cases. In the first
> case, it is just y = constant, so you are testing the 1 df for x1. In
> the second, it is y = 0 (which rarely makes any sense) and you are
> testing the 2 df for the two terms (x0 and x1). Etc. etc.
>
> -- Bert
>
> On Fri, Jan 21, 2011 at 7:48 PM, David Winsemius <dwinsemius@comcast.net>
wrote:
>>
>> On Jan 21, 2011, at 9:03 PM, jochen laubrock wrote:
>>
>>> Dear list,
>>>
>>> the following came up in an introductory class. Please help me
understand
>>> the -1 (or 0+) syntax in formulae: Why do the enumerator dfs,
F-statisics
>>> etc. differ between the models lm(y ~ x1) and lm(y ~ x0 + x1 - 1), if x0
is
>>> a vector containing simply ones?
>>
>> You are testing something different. In the first case you are testing
the
>> difference between the baseline and the second level of x1 (so there is
only
>> one d.f.), while in the second case you are testing for both of the
>> coefficients being zero (so the numerator has 2 d.f.). It would be easier
to
>> see if you did print() on the fit object. The first model would give you
an
>> estimate for an "Intercept", which is really an estimate for the first
level
>> of x1.  Having been taught to think of anova as just a special case of
>> regression is helpful here. Look at the model first  and only then look
at
>> the anova table.
>>
>>
>>>
>>> Example:
>>>
>>> N  <- 40
>>> x0 <- rep(1,N)
>>> x1 <- 1:N
>>> vare <- N/8
>>> set.seed(4)
>>> e <- rnorm(N, 0, vare^2)
>>>
>>> X <- cbind(x0, x1)
>>> beta <- c(.4, 1)
>>> y <- X %*% beta + e
>>>
>>> summary(lm(y ~ x1))
>>> # [...]
>>> # Residual standard error: 20.92 on 38 degrees of freedom
>>> # Multiple R-squared: 0.1151,   Adjusted R-squared: 0.09182
>>> # F-statistic: 4.943 on 1 and 38 DF,  p-value: 0.03222
>>>
>>> summary(lm(y ~ x0 + x1 - 1))        # or summary(lm(y ~ 0 + x0 + x1))
>>> # [...]
>>> # Residual standard error: 20.92 on 38 degrees of freedom
>>> # Multiple R-squared: 0.6888,   Adjusted R-squared: 0.6724
>>> # F-statistic: 42.05 on 2 and 38 DF,  p-value: 2.338e-10
>>>
>>>
>>> Thanks in advance,
>>> Jochen
>>>
>>>
>>> ----
>>> Jochen Laubrock, Dept. of Psychology, University of Potsdam,
>>> Karl-Liebknecht-Strasse 24-25, 14476 Potsdam, Germany
>>> phone: +49-331-977-2346, fax: +49-331-977-2793
>>>
>>> ______________________________________________
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Bert Gunter
> Genentech Nonclinical Biostatistics
> 467-7374
> http://devo.gene.com/groups/devo/depts/ncb/home.shtml

----
Jochen Laubrock, Dept. of Psychology, University of Potsdam,
Karl-Liebknecht-Strasse 24-25, 14476 Potsdam, Germany
phone: +49-331-977-2346, fax: +49-331-977-2793



------------------------------

Message: 83
Date: Sat, 22 Jan 2011 12:13:35 +0530
From: pratik wankhade <pratikmwankhade.w123@gmail.com>
To: r-help@r-project.org
Subject: [R] about matrices merge and retrieve algorithm.
Message-ID:
       <AANLkTin1q+pc+h+XfEY42kF3Dj1bDGVGhHVTT=P=TQkD@mail.gmail.com>
Content-Type: text/plain

I have a problem as follows:

 1. If we have 3 matrices A,B,C and we merge them in a single matrix ABC by
any method like addition , subtraction division,multiplication,etc
 2. and then we want to retrieve original 3 matrices A,B,C from single ABC
matrix
What will be the algorithm?

       [[alternative HTML version deleted]]



------------------------------

Message: 84
Date: Sat, 22 Jan 2011 12:20:10 +0530
From: Ajay Ohri <ohri2007@gmail.com>
To: r-sig-debian@r-project.org, R list <r-help@stat.math.ethz.ch>
Subject: [R] Debian ?Ubuntu version of latest R using synaptic in
       Ubuntu  10.10
Message-ID:
       <AANLkTimRyj7dzzB7hcGzit21AYMnwz8vLYpQF57Cfnb_@mail.gmail.com>
Content-Type: text/plain

Dear List

I use synaptic to download R on my Ubuntu 10.10. It seems latest version of
R on Ubuntu is 2.11.1

Even when I use debian.cran.r-project.org to update my packages the problem
remains (latest versions on CRAN are almost always 2 updates ahead of Debian
packages) This is also true for a lot of other packages as well

My specific problem is while I can use sudo apt-get to update packages from
Debian repository I get a permission denied when I am trying to update from
CRAN from within R. I am a Linux newbie

Please help

Regards

Ajay

Websites-
http://decisionstats.com

       [[alternative HTML version deleted]]



------------------------------

Message: 85
Date: Sat, 22 Jan 2011 08:58:11 +0100 (CET)
From: Sascha Vieweg <saschaview@gmail.com>
To: Spencer Graves <spencer.graves@structuremonitoring.com>
Cc: r-help@r-project.org, PtitBleu <ptit_bleu@yahoo.fr>
Subject: Re: [R] Accessing MySQL Database in R
Message-ID: <alpine.OSX.2.00.1101220856040.18654@dngan>
Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed

I think this is not an R issue, but one of MAMP. On my server's
sql service, I can connect using password, however, on my local
MAMP, I need the socket:

dbCon <- dbConnect(dbdr, user="root", password="root",
dbname="mydb",
unix.socket="/Applications/MAMP/tmp/mysql/mysql.sock")

HTH, *S*


On 11-01-20 08:30, Spencer Graves wrote:

>       The following worked for me recently:
>
>
> library(RMySQL)
> MySQL. <- MySQL()
> MySQLcon <- dbConnect(MySQL., user='thisuser', password='thispassword',
>                       dbname='desiredDB')
>
>
>      I have the following suggestions and questions for you:
>
>
>            1.  Have you tried supplying "dbname" rather than "host"?
>
>
>            2.  Please provide "sessionInfo()".  Many packages have a
> function named "dbConnect", and I don't know which one you are using.
>
>
>            3.  I don't know if "MySQL()" is equivalent to
dbDriver("MySQL"),
> which you used.  It might be;  I don't know.
>
>
>            4.  The standard "install.packages('RMySQL')" may not work,
> because this package needs to be built to configure itself properly to
your
> local operating system and versions of MySQL and R installed.
 Installation
> instructions are available at
> "http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL".  If you have not
already
> followed those instructions, please do so.  There is a good chance that
will
> fix your problem, I think.
>
>
>            5.  If this is not adequate, I suggest you post this question
to
> "r-sig-db@stat.math.ethz.ch".  [I suggest you subscribe first.  This list
has
> low volume and you can unsubscribe later if you prefer.  And please also
> provide "sessionInfo()".]
>
>
>            6.  Or use RODBC as suggested by Ptit Bleu.  It comes highly
> recommended (including by Brian Ripley).  However, I had difficulties
getting
> positive results from both RMySQL and RODBC.  I tried both, with each
> receiving similar quantities of expletives.  Finally, I got RMySQL to do
what
> I wanted and suspended my schoolboy exercises with RODBC.
>
>
>       Hope this helps.
>       Spencer
>
>
> On 1/20/2011 5:55 AM, PtitBleu wrote:
>>  Hello,
>>
>>  I used to use RMySQL but as there is no more package for windows, I
>>  decided
>>  to move to RODBC.
>>  I installed ODBC driver for MySQL (downloaded on the MySQL website) and
>>  then
>>  the RODBC package.
>>
>>  I finally discovered that it was not needed to "register" your database
>>  with
>>  ODBC before using it.
>>  These commands below work for me.
>>
>>  library(RODBC)
>>  ch<-odbcDriverConnect(connection="SERVER=localhost;DRIVER=MySQL ODBC 5.1
>>  Driver;DATABASE=my_database;UID=root;PWD=my_password;case=tolower")
>>  resultdb<-sqlQuery(ch,"SELECT * from my_table")
>>  odbcClose(ch)
>>
>>  Try to modify them for your case.
>>  I hope it will work for you.
>>  Good luck,
>>  Ptit Bleu.
>>
>>
>>  Re: Accessing MySQL Database in R
>>  Jan 18, 2011; 12:10am ? by djmuseR [User is online] djmuseR
>>  Hi:
>>
>>  Because R does not have a direct interface to MySQL?
>>
>>  You need to load a communication package - the two most common ones are
>>  RODBC and RMySQL. The former requires that you register your MySQL
>>  database
>>  table(s) with ODBC before using the RODBC package on them, whereas the
>>  latter works with specific version combinations of MySQL and R. The
RODBC
>>  package has a very informative vignette; for information re the RMySQL
>>  package, see
>>  http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL
>>
>>  HTH,
>>  Dennis
>>
>>  On Mon, Jan 17, 2011 at 1:30 PM, schlafly<[hidden email]>  wrote:
>>
>> >  I have a local installation of MySQL on my computer.
>> >
>> >  I enter the following to access MySQL from the command line:
>> >  /Applications/MAMP/Library/bin/mysql -h localhost -u root -p
>> >  I am then prompted for a password, and I use: root
>> >  This connects me to MySQL in the command line.
>> >
>> >  I now want to access MySQL databases in R. I enter the following:
>> >  mysql<- dbDriver("MySQL")
>> >  conn<- dbConnect(mysql,user='root',host='localhost', password='root')
>> >
>> >  I get the following error message: Error in mysqlNewConnection(drv,
...)
>> >  :
>> >  RS-DBI driver: (Failed to connect to database: Error: Access denied
for
>> >  user
>> >  'root'@'localhost' (using password: YES)
>> >
>> >  Does anyone know why these aren't equivalent?
>> >  --
>> >  View this message in context:
>> >
http://r.789695.n4.nabble.com/Accessing-MySQL-Database-in-R-tp3221264p3221264.html
>> >  Sent from the R help mailing list archive at Nabble.com
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

--
Sascha Vieweg, saschaview@gmail.com



------------------------------

Message: 86
Date: Sat, 22 Jan 2011 00:06:38 -0800
From: "Daniel Nordlund" <djnordlund@frontier.com>
To: "'R list'" <r-help@stat.math.ethz.ch>
Subject: Re: [R] [R-sig-Debian] Debian ?Ubuntu version of latest R
       using   synaptic inUbuntu 10.10
Message-ID: <55D5B0CC6D2C47578059AA1BE5295B92@Aragorn>
Content-Type: text/plain;       charset="utf-8"

> -----Original Message-----
> From: r-sig-debian-bounces@r-project.org [mailto:r-sig-debian-bounces@r-
> project.org] On Behalf Of Ajay Ohri
> Sent: Friday, January 21, 2011 10:50 PM
> To: r-sig-debian@r-project.org; R list
> Subject: [R-sig-Debian] Debian ?Ubuntu version of latest R using synaptic
> inUbuntu 10.10
>
> Dear List
>
> I use synaptic to download R on my Ubuntu 10.10. It seems latest version
> of
> R on Ubuntu is 2.11.1
>
> Even when I use debian.cran.r-project.org to update my packages the
> problem
> remains (latest versions on CRAN are almost always 2 updates ahead of
> Debian
> packages) This is also true for a lot of other packages as well
>
> My specific problem is while I can use sudo apt-get to update packages
> from
> Debian repository I get a permission denied when I am trying to update
> from
> CRAN from within R. I am a Linux newbie
>
> Please help
>
> Regards
>
> Ajay
>

Ajay,

To update from within R, start R using sudo and you should solve your
permissions problem.  In addition, go to the Linux section of "Download and
Install R" on CRAN and see the instructions for downloading and installing
the latest version of R for your version of Ubuntu.

Hope this is helpful,

Dan

Daniel Nordlund
Bothell, WA USA



------------------------------

Message: 87
Date: Sat, 22 Jan 2011 09:55:49 +0000
From: Steve Powell <steve@promente.net>
To: r-help@r-project.org
Subject: [R] effect size measure for dependent samples
Message-ID:
       <AANLkTimdH6upd2Z4qOMZyryuuLZ1GwAdFmAsKqaYoNi_@mail.gmail.com>
Content-Type: text/plain

Any advice on which package I can use for calculating effect sizes for two
dependent samples? compute.es seems only to consider independent samples.
Thanks in advance
Steve Powell

       [[alternative HTML version deleted]]



------------------------------

_______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

End of R-help Digest, Vol 95, Issue 22
**************************************

	[[alternative HTML version deleted]]

