Re: [R] pairwise deletion in regression models

2016-07-13 Thread Adel Daoud
Hi



Yes, I am sure. Have a look here for SPSS e.g.:

http://www-01.ibm.com/support/docview.wss?uid=swg21475199 and here

http://www.ats.ucla.edu/stat/spss/modules/missing.htm



and for STATA here,

http://www.ats.ucla.edu/stat/stata/modules/missing.html





I know that R allows for pairwise deletion in the cor() function, but I
need it for regression analysis. The default is listwise (casewise)
deletion. Would be grateful for further input on this.





Best,

Adel

--

Adel Daoud, PhD, Researcher

*Newly published:*

* Daoud, Adel and Kohl, Sebastian, *How Much Do Sociologists Write About
Economic Topics? Using Big-Data to Test Some Conventional Views in Economic
Sociology, 1890 to 2014*. Max Planck Institute for the Study of Societies,
Discussion Paper 16/7  <http://www.mpifg.de/pu/mpifg_dp/dp16-7.pdf>

* Daoud, Adel, Björn Halleröd, and Debarati Guha-Sapir, (2016) “What Is the
Association between Absolute Child Poverty, Poor Governance, and Natural
Disasters? A Global Comparison of Some of the Realities of Climate
Change”, *PLoS
ONE* 11(4)
<http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0153296>

*Shailen Nandy, Adel Daoud, David Gordon, (2016), Examining the changing
profile of undernutrition in the context of food price rises and greater
inequality, *Social Science & Medicine*, Volume 149, Pages 153–163
<http://www.sciencedirect.com/science/article/pii/S0277953615302446>


*Department of Sociology and Work Science,*

*University of Gothenburg*

Box 720

405 30, Göteborg, Sweden

Email: adel.da...@sociology.gu.se

Website: http://adeldaoud.se/  <http://adeldaoud.se/>

On Wed, Jul 13, 2016 at 10:53 AM, PIKAL Petr <petr.pi...@precheza.cz> wrote:

> Hi
>
>
>
> Hm. Are you 100% sure that other software packages can do pairwise
> deletion in OLS or GLM? I am not at all familiar with them but
>
>
>
> http://www.ats.ucla.edu/stat/spss/modules/stats.htm
>
>
>
> suggests that option pairwise is available with corr and I believe the
> same option exists in cor function in R.
>
>
>
> My statistical knowledge is inferior but I just cannot imagine how whole
> model could be computed when one value is missing.
>
>
>
> Cheers
>
> Petr
>
>
>
> *From:* adelda...@gmail.com [mailto:adelda...@gmail.com] *On Behalf Of *Adel
> Daoud
> *Sent:* Wednesday, July 13, 2016 10:00 AM
> *To:* PIKAL Petr <petr.pi...@precheza.cz>
> *Cc:* r-help <r-help@r-project.org>
> *Subject:* Re: [R] pairwise deletion in regression models
>
>
>
> Thanks Petr for the suggestion.
>
>
>
> I just took the regtools package for a quick test drive. It looks
> promising, but it still needs further development to make it a viable
> option. You will not get a standard regression output (as in lm or glm),
> only the regression coefficients (without standard errors). I will be happy
> to try it out once it is more robust.
>
>
>
> I am a bit puzzled that the R universe seems to lack a robust package that
> allows for pairwise deletion (which is standard in the otherwise poorer
> software packages STATA or SPSS…). Would be very happy if anyone can show
> me otherwise.
>
>
> Best,
>
> Adel
>
> --
>
> Adel Daoud, PhD, Researcher
>
> *Newly published:*
>
> * Daoud, Adel and Kohl, Sebastian, *How Much Do Sociologists Write About
> Economic Topics? Using Big-Data to Test Some Conventional Views in Economic
> Sociology, 1890 to 2014*. Max Planck Institute for the Study of
> Societies, Discussion Paper 16/7
> <http://www.mpifg.de/pu/mpifg_dp/dp16-7.pdf>
>
> * Daoud, Adel, Björn Halleröd, and Debarati Guha-Sapir, (2016) “What Is
> the Association between Absolute Child Poverty, Poor Governance, and
> Natural Disasters? A Global Comparison of Some of the Realities of Climate
> Change”, *PLoS ONE* 11(4)
> <http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0153296>
>
> *Shailen Nandy, Adel Daoud, David Gordon, (2016), Examining the changing
> profile of undernutrition in the context of food price rises and greater
> inequality, *Social Science & Medicine*, Volume 149, Pages 153–163
> <http://www.sciencedirect.com/science/article/pii/S0277953615302446>
>
>
>
> *Department of Sociology and Work Science,*
>
> *University of Gothenburg*
>
> Box 720
>
> 405 30, Göteborg, Sweden
>
> Email: adel.da...@sociology.gu.se
>
> Website: http://adeldaoud.se/  <http://adeldaoud.se/>
>
>
>
> On Wed, Jul 13, 2016 at 8:21 AM, PIKAL Petr <petr.pi...@precheza.cz>
> wrote:
>
> Hi
>
>
> http://stats.stackexchange.com/questions/158366/fit-multiple-regression-model-with-pairwise-deletion-or-on-a-correlation-covari
>
> The package is probably not available on CRAN

Re: [R] pairwise deletion in regression models

2016-07-13 Thread Adel Daoud
Thanks Petr for the suggestion.



I just took the regtools package for a quick test drive. It looks
promising, but it still needs further development to make it a viable
option. You will not get a standard regression output (as in lm or glm),
only the regression coefficients (without standard errors). I will be happy
to try it out once it is more robust.



I am a bit puzzled that the R universe seems to lack a robust package that
allows for pairwise deletion (which is standard in the otherwise poorer
software packages STATA or SPSS…). Would be very happy if anyone can show
me otherwise.

Best,

Adel

--

Adel Daoud, PhD, Researcher

*Newly published:*

* Daoud, Adel and Kohl, Sebastian, *How Much Do Sociologists Write About
Economic Topics? Using Big-Data to Test Some Conventional Views in Economic
Sociology, 1890 to 2014*. Max Planck Institute for the Study of Societies,
Discussion Paper 16/7  <http://www.mpifg.de/pu/mpifg_dp/dp16-7.pdf>

* Daoud, Adel, Björn Halleröd, and Debarati Guha-Sapir, (2016) “What Is the
Association between Absolute Child Poverty, Poor Governance, and Natural
Disasters? A Global Comparison of Some of the Realities of Climate
Change”, *PLoS
ONE* 11(4)
<http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0153296>

*Shailen Nandy, Adel Daoud, David Gordon, (2016), Examining the changing
profile of undernutrition in the context of food price rises and greater
inequality, *Social Science & Medicine*, Volume 149, Pages 153–163
<http://www.sciencedirect.com/science/article/pii/S0277953615302446>


*Department of Sociology and Work Science,*

*University of Gothenburg*

Box 720

405 30, Göteborg, Sweden

Email: adel.da...@sociology.gu.se

Website: http://adeldaoud.se/  <http://adeldaoud.se/>

On Wed, Jul 13, 2016 at 8:21 AM, PIKAL Petr <petr.pi...@precheza.cz> wrote:

> Hi
>
>
> http://stats.stackexchange.com/questions/158366/fit-multiple-regression-model-with-pairwise-deletion-or-on-a-correlation-covari
>
> The package is probably not available on CRAN but seems to be still
> maintained on github.
>
> Cheers
> Petr
>
> > -Original Message-
> > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of adel
> > daoud
> > Sent: Tuesday, July 12, 2016 8:28 PM
> > To: r-help <r-help@r-project.org>
> > Subject: [R] pairwise deletion in regression models
> >
> > Dear R users,
> >
> >
> >
> > I would like to use a pairwise deletion of missing values in linear
> regression
> > (lm or glm preferably). I want to replicate some studies done in STATA
> that
> > uses this type of deletion. What options do we have in R to work with
> > pairwise deletion? Most packages I have found do not have this option, it
> > seems (lm, glm, plm, psych, sampleSelection).
> >
> >
> >
> > This question has been raised here
> > <
> http://r.789695.n4.nabble.com/set-the-bahavior-that-R-deal-with-missing-
> > values-td803840.html>
> > and here
> > <http://r.789695.n4.nabble.com/Pairwise-deletion-in-a-linear-regression-
> > and-in-a-GLM-td4653004.html>,
> > but without any clear answer.
> >
> >
> >
> > Any input is welcomed
> >
> >
> >
> > Thanks in advance
> >
> >
> > Adel
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
> 
> Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou
> určeny pouze jeho adresátům.
> Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě
> neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie
> vymažte ze svého systému.
> Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email
> jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
> Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi
> či zpožděním přenosu e-mailu.
>
> V případě, že je tento e-mail součástí obchodního jednání:
> - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření
> smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu.
> - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout;
> Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany
> příjemce s dodatkem či odchylkou.
> - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve
> výslovným dosažením shody na všech 

[R] pairwise deletion in regression models

2016-07-12 Thread adel daoud
Dear R users,



I would like to use a pairwise deletion of missing values in linear
regression (lm or glm preferably). I want to replicate some studies done in
STATA that uses this type of deletion. What options do we have in R to work
with pairwise deletion? Most packages I have found do not have this option,
it seems (lm, glm, plm, psych, sampleSelection).



This question has been raised here
<http://r.789695.n4.nabble.com/set-the-bahavior-that-R-deal-with-missing-values-td803840.html>
and here
<http://r.789695.n4.nabble.com/Pairwise-deletion-in-a-linear-regression-and-in-a-GLM-td4653004.html>,
but without any clear answer.



Any input is welcomed



Thanks in advance


Adel

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Alpha not working in geom_rect

2015-03-10 Thread adel daoud
Thanks for the info Jeff. I will stick to using annotate()


--

Adel Daoud, PhD, Researcher



The New School for Social Research,

Visiting Scholar in the Economics Department,

6 East 16th Street New York, NY 10003,

dao...@newschool.edu





University of Gothenburg

Department of Sociology and Work Science,

Box 720

405 30, Göteborg, Sweden

Visiting address: Sprängkullsgatan 25, room F411

Sprängkullsgatan 25, room K109

+46 031-786 41 73

adel.da...@sociology.gu.se

On Mon, Mar 9, 2015 at 9:42 PM, Jeff Newmiller jdnew...@dcn.davis.ca.us
wrote:

 I have run into this a couple of times ... If you generate the rectangles
 once per row of your data, the fill gets more and more dense so your
 alpha seems to not work. The annotate call only paints the rectangle once
 so you don't have this problem.
 ---
 Jeff NewmillerThe .   .  Go Live...
 DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live
 Go...
   Live:   OO#.. Dead: OO#..  Playing
 Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
 /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
 ---
 Sent from my phone. Please excuse my brevity.

 On March 9, 2015 3:24:23 PM PDT, adel daoud dao...@newschool.edu wrote:
 Hi Jim,
 
 Thanks for the input but that did not work. I am suing Rstudio by the
 way
 and I guess that has a better device that would support ggplot output.
 
 The annotate options works but that does not explain why the geom_area
 does
 not work:
 annotate(rect, xmin=2, xmax=10, ymin=0,  ymax=1, fill=black,
 alpha=0.5)
 
 Best
 Adel
 
 
 --
 
 Adel Daoud, PhD, Researcher
 
 
 
 The New School for Social Research,
 
 Visiting Scholar in the Economics Department,
 
 6 East 16th Street New York, NY 10003,
 
 dao...@newschool.edu
 
 
 
 
 
 University of Gothenburg
 
 Department of Sociology and Work Science,
 
 Box 720
 
 405 30, Göteborg, Sweden
 
 Visiting address: Sprängkullsgatan 25, room F411
 
 Sprängkullsgatan 25, room K109
 
 +46 031-786 41 73
 
 adel.da...@sociology.gu.se
 
 On Sun, Mar 8, 2015 at 12:46 AM, Jim Lemon drjimle...@gmail.com
 wrote:
 
  Hi Adel,
  Almost certainly because the device you were using doesn't support
  transparency.Try it with a PDF device and check the resulting file in
 a PDF
  reader:
 
  pdf(ad.pdf)
  print(p)
  dev.off()
 
  Jim
 
 
  On Sun, Mar 8, 2015 at 4:39 AM, Adel adel.da...@socav.gu.se wrote:
 
  Hi
  I am trying to activate the alpha argument to work, but for some
 reason it
  does not to play with me. Anybody has an idea why?
 
 
  p - ggplot(data = prediction_df, aes(x=x, y=prediction,
 fill=threshold))
  +
  geom_area(colour=black, size=.2, alpha=.4) +
  scale_fill_brewer(palette=Set1,
  breaks=rev(levels(prediction_df$threshold)))
  p + geom_rect(aes(xmin=2, xmax=10, ymin=(0), ymax=(1)),
 fill=black,
  alpha=0.5)
 
 
  prediction_df
   x prediction  threshold
  1  -10  0.5694161   noAF
  2   -9  0.5700513   noAF
  3   -8  0.5706863   noAF
  4   -7  0.5713211   noAF
  5   -6  0.5719556   noAF
  6   -5  0.5725899   noAF
  7   -4  0.5732240   noAF
  8   -3  0.5738578   noAF
  9   -2  0.5744914   noAF
  10  -1  0.5751247   noAF
  11   0  0.5757578   noAF
  12   1  0.5763906   noAF
  13   2  0.5770232   noAF
  14   3  0.5776556   noAF
  15   4  0.5782876   noAF
  16   5  0.5789195   noAF
  17   6  0.5795510   noAF
  18   7  0.5801823   noAF
  19   8  0.5808134   noAF
  20   9  0.5814441   noAF
  21  10  0.5820747   noAF
  22 -10  0.2359140   singleAF
  23  -9  0.2356847   singleAF
  24  -8  0.2354550   singleAF
  25  -7  0.2352249   singleAF
  26  -6  0.2349943   singleAF
  27  -5  0.2347634   singleAF
  28  -4  0.2345321   singleAF
  29  -3  0.2343003   singleAF
  30  -2  0.2340682   singleAF
  31  -1  0.2338356   singleAF
  32   0  0.2336027   singleAF
  33   1  0.2333694   singleAF
  34   2  0.2331357   singleAF
  35   3  0.2329016   singleAF
  36   4  0.2326671   singleAF
  37   5  0.2324322   singleAF
  38   6  0.2321969   singleAF
  39   7  0.2319613   singleAF
  40   8  0.2317253   singleAF
  41   9  0.2314889   singleAF
  42  10  0.2312522   singleAF
  43 -10  0.1946699 multipleAF
  44  -9  0.1942640 multipleAF
  45  -8  0.1938587 multipleAF
  46  -7  0.1934540 multipleAF
  47  -6  0.1930500 multipleAF
  48  -5  0.1926467 multipleAF
  49  -4  0.1922440 multipleAF
  50  -3  0.1918419 multipleAF
  51  -2  0.1914404 multipleAF
  52  -1  0.1910397 multipleAF
  53   0  0.1906395 multipleAF
  54   1  0.1902400 multipleAF
  55   2  0.1898411 multipleAF
  56   3  0.1894429 multipleAF
  57   4  0.1890453 multipleAF
  58   5  0.1886483 multipleAF
  59   6  0.1882520 multipleAF
  60   7  0.1878564 multipleAF
  61   8  0.1874613 multipleAF

Re: [R] Alpha not working in geom_rect

2015-03-09 Thread adel daoud
Hi Jim,

Thanks for the input but that did not work. I am suing Rstudio by the way
and I guess that has a better device that would support ggplot output.

The annotate options works but that does not explain why the geom_area does
not work:
annotate(rect, xmin=2, xmax=10, ymin=0,  ymax=1, fill=black, alpha=0.5)

Best
Adel


--

Adel Daoud, PhD, Researcher



The New School for Social Research,

Visiting Scholar in the Economics Department,

6 East 16th Street New York, NY 10003,

dao...@newschool.edu





University of Gothenburg

Department of Sociology and Work Science,

Box 720

405 30, Göteborg, Sweden

Visiting address: Sprängkullsgatan 25, room F411

Sprängkullsgatan 25, room K109

+46 031-786 41 73

adel.da...@sociology.gu.se

On Sun, Mar 8, 2015 at 12:46 AM, Jim Lemon drjimle...@gmail.com wrote:

 Hi Adel,
 Almost certainly because the device you were using doesn't support
 transparency.Try it with a PDF device and check the resulting file in a PDF
 reader:

 pdf(ad.pdf)
 print(p)
 dev.off()

 Jim


 On Sun, Mar 8, 2015 at 4:39 AM, Adel adel.da...@socav.gu.se wrote:

 Hi
 I am trying to activate the alpha argument to work, but for some reason it
 does not to play with me. Anybody has an idea why?


 p - ggplot(data = prediction_df, aes(x=x, y=prediction, fill=threshold))
 +
 geom_area(colour=black, size=.2, alpha=.4) +
 scale_fill_brewer(palette=Set1,
 breaks=rev(levels(prediction_df$threshold)))
 p + geom_rect(aes(xmin=2, xmax=10, ymin=(0), ymax=(1)), fill=black,
 alpha=0.5)


 prediction_df
  x prediction  threshold
 1  -10  0.5694161   noAF
 2   -9  0.5700513   noAF
 3   -8  0.5706863   noAF
 4   -7  0.5713211   noAF
 5   -6  0.5719556   noAF
 6   -5  0.5725899   noAF
 7   -4  0.5732240   noAF
 8   -3  0.5738578   noAF
 9   -2  0.5744914   noAF
 10  -1  0.5751247   noAF
 11   0  0.5757578   noAF
 12   1  0.5763906   noAF
 13   2  0.5770232   noAF
 14   3  0.5776556   noAF
 15   4  0.5782876   noAF
 16   5  0.5789195   noAF
 17   6  0.5795510   noAF
 18   7  0.5801823   noAF
 19   8  0.5808134   noAF
 20   9  0.5814441   noAF
 21  10  0.5820747   noAF
 22 -10  0.2359140   singleAF
 23  -9  0.2356847   singleAF
 24  -8  0.2354550   singleAF
 25  -7  0.2352249   singleAF
 26  -6  0.2349943   singleAF
 27  -5  0.2347634   singleAF
 28  -4  0.2345321   singleAF
 29  -3  0.2343003   singleAF
 30  -2  0.2340682   singleAF
 31  -1  0.2338356   singleAF
 32   0  0.2336027   singleAF
 33   1  0.2333694   singleAF
 34   2  0.2331357   singleAF
 35   3  0.2329016   singleAF
 36   4  0.2326671   singleAF
 37   5  0.2324322   singleAF
 38   6  0.2321969   singleAF
 39   7  0.2319613   singleAF
 40   8  0.2317253   singleAF
 41   9  0.2314889   singleAF
 42  10  0.2312522   singleAF
 43 -10  0.1946699 multipleAF
 44  -9  0.1942640 multipleAF
 45  -8  0.1938587 multipleAF
 46  -7  0.1934540 multipleAF
 47  -6  0.1930500 multipleAF
 48  -5  0.1926467 multipleAF
 49  -4  0.1922440 multipleAF
 50  -3  0.1918419 multipleAF
 51  -2  0.1914404 multipleAF
 52  -1  0.1910397 multipleAF
 53   0  0.1906395 multipleAF
 54   1  0.1902400 multipleAF
 55   2  0.1898411 multipleAF
 56   3  0.1894429 multipleAF
 57   4  0.1890453 multipleAF
 58   5  0.1886483 multipleAF
 59   6  0.1882520 multipleAF
 60   7  0.1878564 multipleAF
 61   8  0.1874613 multipleAF
 62   9  0.1870669 multipleAF
 63  10  0.1866732 multipleAF





 --
 View this message in context:
 http://r.789695.n4.nabble.com/Alpha-not-working-in-geom-rect-tp4704291.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

[R] Alpha not working in geom_rect

2015-03-07 Thread Adel
Hi 
I am trying to activate the alpha argument to work, but for some reason it
does not to play with me. Anybody has an idea why?


p - ggplot(data = prediction_df, aes(x=x, y=prediction, fill=threshold)) +
geom_area(colour=black, size=.2, alpha=.4) +
scale_fill_brewer(palette=Set1,
breaks=rev(levels(prediction_df$threshold)))
p + geom_rect(aes(xmin=2, xmax=10, ymin=(0), ymax=(1)), fill=black,
alpha=0.5)


prediction_df
 x prediction  threshold
1  -10  0.5694161   noAF
2   -9  0.5700513   noAF
3   -8  0.5706863   noAF
4   -7  0.5713211   noAF
5   -6  0.5719556   noAF
6   -5  0.5725899   noAF
7   -4  0.5732240   noAF
8   -3  0.5738578   noAF
9   -2  0.5744914   noAF
10  -1  0.5751247   noAF
11   0  0.5757578   noAF
12   1  0.5763906   noAF
13   2  0.5770232   noAF
14   3  0.5776556   noAF
15   4  0.5782876   noAF
16   5  0.5789195   noAF
17   6  0.5795510   noAF
18   7  0.5801823   noAF
19   8  0.5808134   noAF
20   9  0.5814441   noAF
21  10  0.5820747   noAF
22 -10  0.2359140   singleAF
23  -9  0.2356847   singleAF
24  -8  0.2354550   singleAF
25  -7  0.2352249   singleAF
26  -6  0.2349943   singleAF
27  -5  0.2347634   singleAF
28  -4  0.2345321   singleAF
29  -3  0.2343003   singleAF
30  -2  0.2340682   singleAF
31  -1  0.2338356   singleAF
32   0  0.2336027   singleAF
33   1  0.2333694   singleAF
34   2  0.2331357   singleAF
35   3  0.2329016   singleAF
36   4  0.2326671   singleAF
37   5  0.2324322   singleAF
38   6  0.2321969   singleAF
39   7  0.2319613   singleAF
40   8  0.2317253   singleAF
41   9  0.2314889   singleAF
42  10  0.2312522   singleAF
43 -10  0.1946699 multipleAF
44  -9  0.1942640 multipleAF
45  -8  0.1938587 multipleAF
46  -7  0.1934540 multipleAF
47  -6  0.1930500 multipleAF
48  -5  0.1926467 multipleAF
49  -4  0.1922440 multipleAF
50  -3  0.1918419 multipleAF
51  -2  0.1914404 multipleAF
52  -1  0.1910397 multipleAF
53   0  0.1906395 multipleAF
54   1  0.1902400 multipleAF
55   2  0.1898411 multipleAF
56   3  0.1894429 multipleAF
57   4  0.1890453 multipleAF
58   5  0.1886483 multipleAF
59   6  0.1882520 multipleAF
60   7  0.1878564 multipleAF
61   8  0.1874613 multipleAF
62   9  0.1870669 multipleAF
63  10  0.1866732 multipleAF





--
View this message in context: 
http://r.789695.n4.nabble.com/Alpha-not-working-in-geom-rect-tp4704291.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Using gregexpr and regmatches but getting Iconv error

2014-12-11 Thread Adel
Hi 

I have stumbled upon a problem when using gregexpr and regmatches, with the
following error-message: 

Error in iconv(x, latin1, ASCII) : 
  'x' must be a list of NULL or raw vectors 

The data: 

(1) 
I have two journal articles and after some regex manipulation I am at the
following situation: 

# manipluat only two full text articles 
author.test - articles1[1:2]   
# extract author informaiton 
r - gregexpr((\authors\:(.*?)\(.*?)\)|(\authors\: \\[(.*?)\\],),
author.test) 
authors.raw - regmatches(author.test, r) 

authors.raw 
[[1]] 
[1] \authors\: [\Allan G. KING\, \B. Lindsay LOWELL\, \Frank D.
BEAN\], 

[[2]] 
[1] \authors\: \Chris Baldry\, \ 

(2) 
Now, if I want to conduct additional regex manipulation I get the Error
stated above. 

r -  gregexpr(([^(\authors\:)])(.*?)(\(.*?)\), authors.raw) 
authors.raw - regmatches(authors.raw, r) 

Error in iconv(x, latin1, ASCII) : 
  'x' must be a list of NULL or raw vectors 

(3) 
One of the ways to avoid this is to unlist(authors.raw)  - see below - but
the problem with this is that I lose some information which was contained in
the list. The first element contains three character elements and which are
the authors of the first paper. I want to keep them in that list format. 

 authors.raw - unlist(regmatches(authors.raw, r)) 
 authors.raw 
[1]  [\Allan G. KING\ , \B. Lindsay LOWELL\ , \Frank D.
BEAN\  \Chris Baldry\ 

(4) 
So what I want to do is to avoid unlis() and apply the gregex() multiple
times in a row. Any ideas? 

Thanks in advance 
Adel 



--
View this message in context: 
http://r.789695.n4.nabble.com/Using-gregexpr-and-regmatches-but-getting-Iconv-error-tp4700677.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] list.files accessing subdirectory as relative path?

2014-05-06 Thread Adel
Thanks for the reply Don and Frede,

Your suggestions works perfectly!

Best
Adel




--
View this message in context: 
http://r.789695.n4.nabble.com/list-files-accessing-subdirectory-as-relative-path-tp4689997p4690048.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.


[R] list.files accessing subdirectory as relative path?

2014-05-05 Thread Adel
Dear list members,

I would like to access a subdirectory given where the work directory has
been set. So I have:

 getwd()
[1] C:/Users/Lord Adellus/Dropbox/I8child1/Data

 list.files() # give three folders
 [1] Least Developed Countries 
 [4] Low middle income grouping More advanced
developing countries and territories 

 list.files(path = ../Least Developed Countries) # I want to access now
 one of the subdirectories
character(0)

But as you can see R does not want to look into the specified subdirectory.
I have tried several combination and searched the list but without any great
success. 

Actually: 

list.files(path = ../...) #goes up one level in the folder structure so I
cannot see what the problem is.


Thanks in advance.
Adel




--
View this message in context: 
http://r.789695.n4.nabble.com/list-files-accessing-subdirectory-as-relative-path-tp4689997.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.


Re: [R] barchar or barp on multiple data

2014-01-15 Thread Adel ESSAFI
here is the solution if anyone is interrested

barchart(V5 ~ V3 | V1 * V2 , data = t,groups = V4, layout = c(1,6),
auto.key = list(space = right), ylab = Makespan)

Regards



2014/1/14 Adel ESSAFI adeless...@gmail.com

 Hello list
 I have the following data in file in attachment.
 in want to draw bars for every value of V5 in finction of V3
 grouped by V2*V1. however, each unique value
 of V4, V2 and V1 I want to draw a bar.

 This example is very close to want I want to do. but
 here, for each value of V3, barchart draws 2 superimposed  bar.
 How to do to make them one beside another.


 Thanks


 t=read.table(actual)
 barchart( V5 ~ V3 | V2 * V1,t)






-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] barchar or barp on multiple data

2014-01-14 Thread Adel ESSAFI
Hello list
I have the following data in file in attachment.
in want to draw bars for every value of V5 in finction of V3
grouped by V2*V1. however, each unique value
of V4, V2 and V1 I want to draw a bar.

This example is very close to want I want to do. but
here, for each value of V3, barchart draws 2 superimposed  bar.
How to do to make them one beside another.


Thanks


t=read.table(actual)
barchart( V5 ~ V3 | V2 * V1,t)
__
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.


Re: [R] barchar or barp on multiple data

2014-01-14 Thread Adel ESSAFI
Ok,
I put here the data exported with dput().
structure(list(V1 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L), V2 = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), V3 = structure(c(1L, 1L, 2L,
2L, 8L, 8L, 7L, 7L, 9L, 9L, 10L, 10L, 4L, 4L, 3L, 3L, 5L, 5L,
6L, 6L, 1L, 1L, 2L, 2L, 8L, 8L, 7L, 7L, 9L, 9L, 10L, 10L, 4L,
4L, 3L, 3L, 5L, 5L, 6L, 6L, 1L, 1L, 2L, 2L, 8L, 8L, 7L, 7L, 9L,
9L, 10L, 10L, 4L, 4L, 3L, 3L, 5L, 5L, 6L, 6L, 1L, 1L, 2L, 2L,
8L, 8L, 7L, 7L, 9L, 9L, 10L, 10L, 4L, 4L, 3L, 3L, 5L, 5L, 6L,
6L), .Label = c(C/L, C/S, D/F, D/I, D/L, D/S, I/F,
I/I, I/L, I/S), class = factor), V4 = c(0L, 1L, 0L, 1L,
0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L,
0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L,
0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L,
0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L,
0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L), V5 = c(671115,
1028526, 734174, 1327998, 838787, 1422540, 803142, 1206913, 1981495,
1856112, 1981495, 1856112, 689313.033281565, 1167279.07984257,
666335.015648723, 1087554.01538312, 670777.019860625, 1028317.0531472,
730457.025310636, 1298133.01414597, 690879, 996712, 755213, 1293494,
871769, 1478186, 830802, 1169810, 2364168, 2364168, 2364168,
2364168, 710988.088020086, 1119450.09723687, 685209.028554797,
1041768.02318358, 689760.04900682, 997493.021301806, 752893.050110579,
1286333.03097144, 671437, 1029284, 732144, 1317596, 844051, 1422540,
803142, 1205147, 1981495, 1856112, 1981495, 1856112, 690552.014781833,
1168328.05673718, 14.011364698, 1089523.05270934, 670944.00994724,
1029246.06969887, 728912.037932515, 1294319.04904819, 691311,
996821, 753640, 1299848, 871769, 1443884, 830802, 1169810, 2364168,
2364168, 2364168, 2364168, 711121.048051834, 1115219.00324583,
685480.015842438, 1042424.03302765, 690023.032608509, 998007.038496614,
751040.029144168, 1277138.01515984), V6 = c(631830L, 631830L,
631830L, 631830L, 631830L, 631830L, 631830L, 631830L, 631830L,
631830L, 631830L, 631830L, 631830L, 631830L, 631830L, 631830L,
631830L, 631830L, 631830L, 631830L, 651129L, 651129L, 651129L,
651129L, 651129L, 651129L, 651129L, 651129L, 651129L, 651129L,
651129L, 651129L, 651129L, 651129L, 651129L, 651129L, 651129L,
651129L, 651129L, 651129L, 632125L, 632125L, 632125L, 632125L,
632125L, 632125L, 632125L, 632125L, 632125L, 632125L, 632125L,
632125L, 632125L, 632125L, 632125L, 632125L, 632125L, 632125L,
632125L, 632125L, 651458L, 651458L, 651458L, 651458L, 651458L,
651458L, 651458L, 651458L, 651458L, 651458L, 651458L, 651458L,
651458L, 651458L, 651458L, 651458L, 651458L, 651458L, 651458L,
651458L), V7 = c(471L, 900L, 423L, 830L, 4L,
4L, 192L, 157L, 477L, 900L, 428L, 827L,
59L, 72L, 6221L, 5409L, 11752L, 17060L,
10766L, 17546L, 462L, 830L, 417L, 774L,
4L, 4L, 182L, 142L, 472L, 824L, 421L,
771L, 58L, 66L, 5799L, 4819L, 11581L,
16325L, 10860L, 17255L, 472L, 901L, 424L,
835L, 5L, 5L, 192L, 160L, 477L, 900L,
428L, 826L, 58L, 72L, 6176L, 5390L, 11590L,
17028L, 10782L, 17561L, 465L, 827L, 422L,
777L, 4L, 4L, 180L, 142L, 470L, 827L,
422L, 774L, 57L, 68L, 5781L, 4798L, 11558L,
16348L, 10885L, 17221L), V8 = c(4.71, 9, 4.23, 8.3,
0.04, 0.04, 1.92, 1.57, 4.77, 9, 4.28, 8.27, 0.59, 0.72, 62.21,
54.09, 117.52, 170.6, 107.66, 175.46, 4.62, 8.3, 4.17, 7.74,
0.04, 0.04, 1.82, 1.42, 4.72, 8.24, 4.21, 7.71, 0.58, 0.66, 57.99,
48.19, 115.81, 163.25, 108.6, 172.55, 4.72, 9.01, 4.24, 8.35,
0.05, 0.05, 1.92, 1.6, 4.77, 9, 4.28, 8.26, 0.58, 0.72, 61.76,
53.9, 115.9, 170.28, 107.82, 175.61, 4.65, 8.27, 4.22, 7.77,
0.04, 0.04, 1.8, 1.42, 4.7, 8.27, 4.22, 7.74, 0.57, 0.68, 57.81,
47.98, 115.58, 163.48, 108.85, 172.21)), row.names = c(NA, -80L
), .Names = c(V1, V2, V3, V4, V5, V6, V7, V8), class =
data.frame)


2014/1/14 Adel ESSAFI adeless...@gmail.com

 Hello list
 I have the following data in file in attachment.
 in want to draw bars for every value of V5 in finction of V3
 grouped by V2*V1. however, each unique value
 of V4, V2 and V1 I want to draw a bar.

 This example is very close to want I want to do. but
 here, for each value of V3, barchart draws 2 superimposed  bar.
 How

[R] barchar and box on the same figure! is it possible

2014-01-10 Thread Adel ESSAFI
Hello list

I have this data frame which represent values grouped by algorithm.
remark that for each algorithm, we have the same value in V3 but differnt
values in V4.
I want to make a plot with algorithms in axes, and for each algorithm I
draw a bar (for V3) and a bwplot for V4.
is thart possible.
Thanks for any entry.



 t[t[,2]3,]
  V1 V2   V3   V4
1HEFT-AC  1 402499.9 460543.4
2HEFT-AC  2 402499.9 470316.8
31  HEFT-ACU  1 420814.2 433203.7
32  HEFT-ACU  2 420814.2 453475.8
60   LPT  1 402499.9 460543.4
61   LPT  2 402499.9 470316.8
90   SPT  1 453262.3 459070.3
91   SPT  2 453262.3 483893.6
119  MIN-MIN  1 447286.4 477632.5
120  MIN-MIN  2 447286.4 488146.3
149  MAX-MIN  1 457122.6 498265.2
150  MAX-MIN  2 457122.6 491143.3



-- 


*PhD in Computer ScienceAddress   *



*Avenue Taha Hussein Montfleury, 1008 Tunistél : +216 71 49 60 66 fax: +216
71 39 11 66*

[[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.


[R] Fwd: barchar and box on the same figure! is it possible

2014-01-10 Thread Adel ESSAFI
Hello list

I have this data frame which represent values grouped by algorithm.
remark that for each algorithm, we have the same value in V3 but differnt
values in V4.
I want to make a plot with algorithms in axes, and for each algorithm I
draw a bar (for V3) and a bwplot for V4.
is thart possible.
Thanks for any entry.



 t[t[,2]3,]
  V1 V2   V3   V4
1HEFT-AC  1 402499.9 460543.4
2HEFT-AC  2 402499.9 470316.8
31  HEFT-ACU  1 420814.2 433203.7
32  HEFT-ACU  2 420814.2 453475.8
60   LPT  1 402499.9 460543.4
61   LPT  2 402499.9 470316.8
90   SPT  1 453262.3 459070.3
91   SPT  2 453262.3 483893.6
119  MIN-MIN  1 447286.4 477632.5
120  MIN-MIN  2 447286.4 488146.3
149  MAX-MIN  1 457122.6 498265.2
150  MAX-MIN  2 457122.6 491143.3



-- 


*PhD in Computer ScienceAddress   *



*Avenue Taha Hussein Montfleury, 1008 Tunis tél : +216 71 49 60 66
%2B216%2071%2049%2060%2066 fax: +216 71 39 11 66
%2B216%2071%2039%2011%2066*



-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] embedd fonts in pdf generated by R

2014-01-10 Thread Adel ESSAFI
Hello list
I generated pdf files with R that I integrated
in .tex file and compiled with pdflatex.

however, all the fonts of my R figure not embadded. so the file is rejected
from EDAS web site.

Could you help please.


[adel@localhost hcw]$  pdffonts hcw.pdf
name type  encoding emb
sub uni object ID
 -  ---
--- --- -
ZIMYVR+NimbusRomNo9L-MediType 1Custom   yes
yes no   7  0
EYECKV+NimbusRomNo9L-ReguType 1Custom   yes
yes no   8  0
WKYGSZ+CMSY8 Type 1Builtin  yes
yes no   9  0
TEABSF+NimbusRomNo9L-ReguItalType 1Custom   yes
yes no  10  0
MPLOPB+NimbusRomNo9L-MediItalType 1Custom   yes
yes no  11  0
XSKVTD+CMMI10Type 1Builtin  yes
yes no  19  0
NKXZUI+CMSY10Type 1Builtin  yes
yes no  20  0
PVJEEI+CMR10 Type 1Builtin  yes
yes no  21  0
TEORRU+CMR7  Type 1Builtin  yes
yes no  22  0
NGESNP+CMMI7 Type 1Builtin  yes
yes no  23  0
ZDXXKY+CMMI5 Type 1Builtin  yes
yes no  24  0
VGZAHY+CMR5  Type 1Builtin  yes
yes no  25  0
NOPBSI+CMSY5 Type 1Builtin  yes
yes no  26  0
ZYGQZM+CMMI6 Type 1Builtin  yes
yes no  27  0
QRZPBZ+CMMI8 Type 1Builtin  yes
yes no  28  0
TZYURE+MSBM10Type 1Builtin  yes
yes no  29  0
HIBZGW+Times-Roman   Type 1C   WinAnsi  yes
yes no  37  0
QLAAJV+CMSY7 Type 1Builtin  yes
yes no  46  0
RMTRPB+CMEX10Type 1Builtin  yes
yes no  47  0
BNPUIJ+Courier   Type 1C   WinAnsi  yes
yes no  60  0
GZSZHC+Times-Roman   Type 1C   WinAnsi  yes
yes no  61  0
QBHKPM+Times-Roman   Type 1C   WinAnsi  yes
yes no  70  0
Symbol   Type 1Custom   no
no  no  81  0
ZapfDingbats Type 1Custom   no
no  yes 82  0
HelveticaType 1Standard no
no  no  83  0



-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] ifelse statement with two vectors of different length

2013-12-18 Thread Adel

Dear list-members,

I have the following problem: I have a vector (countrydiff) with length 72
and another vector (long_df$country_name) which is about 12000 long.
Basically what I want to do is to if the factor level (or string name) in
long_df$country_name appears on the countrydiff, then long_df$povdat should
be equal to 1, if it does not appear on the countrydiff vector then
long_df$povdat should be equal to zero. I have tried different combinations
and read some. The following code should in my mind do it, but it doesn’t:

long_df$povdat-ifelse(long_df$country_name == countrydiff, 1, 0)

long_df$povdat-ifelse(long_df$country_name %in% countrydiff, 1, 0)

Additional information: the factor vector countrydiff contains unique
country names (Albania, Zimbabwe etc.), whereas long_df$country_name also
contains country names albeit not unique since it is in longform. The unique
names that appear in long_df$country_name is around 200.


Any suggestions?
Thanks in advance.

Best
Adel




--
View this message in context: 
http://r.789695.n4.nabble.com/ifelse-statement-with-two-vectors-of-different-length-tp4682401.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.


Re: [R] ifelse statement with two vectors of different length

2013-12-18 Thread Adel

Dear Arun

Thanks for your reply, it made me realize that the problem was not in the
code but in the levels() of the factors. Some countries had some extra
spacing which made the ifelse() function not work. So if I modify your code
(added space to countrydiff), it will then look something like this:

countrydiff - c(Albania, Algeria, Belarus, Canada   ,
Germany   ) 
long_df - data.frame(country_name = c(Algeria, Guyana, Hungary,
Algeria, Canada, Iran, Iran, Norway,Uruguay, Zimbabwe) ) 

I had to use the gsub to fix this first.


Interestingly, the setdiff() function did not react on spacing difference
which I used before coming to the ifelse statement and therefore I did not
react on this in the first place

#no reaction from R on spacing diff.
setdiff(countrydiff, long_df$country_name)


Nevertheless, thanks again for being helpful!
Adel




--
View this message in context: 
http://r.789695.n4.nabble.com/ifelse-statement-with-two-vectors-of-different-length-tp4682401p4682403.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.


[R] multiple bar for barchart

2013-12-09 Thread Adel ESSAFI
Hello list,
I have the following data on dm table

 dm
   Group.1 V1   V2  V3V4 V5  V6  V7 V8
1  C/L NA 15.5  732179  875270.6 -143091.46 1107270 1088300   18964.40
2  C/S NA 15.5  803926  850352.1  -46426.03 1395710 1312310   83403.30
3  D/D NA 15.5  751660  857828.2 -106168.17 1340360 1322790   17569.30
4  D/F NA 15.5  724924  969418.7 -244494.67 1181280 1160760   20519.20
5  D/I NA 15.5  755841  842130.5  -86289.48 1264250 1241750   22495.20
6  D/L NA 15.5  731904  875340.0 -143435.84 1107600 1087940   19657.30
7  D/S NA 15.5  798289  844102.0  -45812.85 1399840 1305000   94832.10
8  I/F NA 15.5  871670 1074136.3 -202466.58 1304290 1249006   55286.59
9  I/I NA 15.5  897718 1029579.0 -131861.35 1542810 1398716  144100.07
10 I/L NA 15.5 2628110  862466.8 1765645.67 2628110 1073510 1554610.00
11 I/S NA 15.5 2628110  831486.8 1796627.33 2475450 1282100 1193350.00
 barchart (dm[,4] ~ dm[,1])

For each value of Group.1 I want to draw 4 bars (v3,v4, v6 and v7).

Can you suggest me a solution please

barchat draws only one value.
regards



-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


Re: [R] the wilcox.test() and pairwise.wilcox.test are producing different results

2013-12-01 Thread Adel
Thanks Arun! It was simple as that. You suggestion solved it. 

Best
Adel



--
View this message in context: 
http://r.789695.n4.nabble.com/the-wilcox-test-and-pairwise-wilcox-test-are-producing-different-results-tp4681375p4681423.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.


[R] the wilcox.test() and pairwise.wilcox.test are producing different results

2013-11-29 Thread Adel
Dear list member,



I want to compare if the rank order is significantly different for seven
different measures. So we have same sample but different measures which
reduces the problem to a paired one sample Wilcox test if I understood the
test correctly. In constructed toy examples for my sake of understanding,
but things are not adding up. Basically, the wilcox.test() and
pairwise.wilcox.test are producing different results when they should not
(according to my understanding of course):



#take a vector

daily.intake - c(5260,5470,5640,6180,6390,6515,

  + 6805,7515,7515,8230,8770)



#I get desired results when I do the following

daily-data.frame(pre=daily.intake, post=daily.intake)



#add som differences

daily[1,1]-5000

daily[2,1]-5100





#reshape the data for pairwise comparison

library(reshape2)

daily_long-melt(daily, id=)



#conduct simple test

wilcox.test(daily$pre,daily$post, paired=T) #produces desired results



#do the test again but now in a pairwise, which produces the same p-value
as in the simple test above

pairwise.wilcox.test(daily_long$value,daily_long$variable, paired=T)



#But now I the issues arise when testing more than two vectors.



#take three vectors this time

daily-data.frame(pre=daily.intake, post=daily.intake, posttwo=daily.intake)



#add some differences

daily[1,1]-5000

daily[2,1]-5100

daily[10,3]-9000

daily[11,3]-9100



#the wilcox.test() produces a set of p-values

wilcox.test(daily$pre,daily$posttwo, paired=T)

 wilcox.test(daily$pre,daily$post, paired=T)

wilcox.test(daily$post,daily$posttwo, paired=T)



#and the pairwise.wilcox.test produces another set

pairwise.wilcox.test(daily_long$value,daily_long$variable, paired=T)







##And from the manual for pairwise.wilcox we get similar issues



#produces a given set of p-values

attach(airquality)

Month - factor(Month, labels = month.abb[5:9])

## These give warnings because of ties :

pairwise.wilcox.test(Ozone, Month)

pairwise.wilcox.test(Ozone, Month, p.adj = bonf)

detach()



#but if we want to test the rank difference between the 6th and 7th month
we get a p-value of 0.5775



testar skillnaden mellan 6e och 7e månaden – observ however that this data
is not paired which makes it different to the example I gave above.

#p-värdet är 0.5775



air-subset(airquality, airquality$Month  7)



#p-value is now 0.1925

wilcox.test(air$Ozone~air$Month)





What am I doing wrong here?

Best

Adel

-- 
Adel Daoud, PhD
Visiting researcher (post-doc)

Max Planck Institute for the Study of Societies / Max-Planck-Institut für
Gesellschaftsforschung
Paulstr. 3 | 506 76 Köln | Germany
Tel.: + 49 (0) 221 2767-534
da...@mpifg.de



Department of Sociology and Work Science,  University of Gothenburg
Box 720
405 30 Göteborg, Sweden
Visiting address: Sprängkullsgatan 25, room K109
+46 031-786 41 73
adel.da...@sociology.gu.se




--
View this message in context: 
http://r.789695.n4.nabble.com/the-wilcox-test-and-pairwise-wilcox-test-are-producing-different-results-tp4681375.html
Sent from the R help mailing list archive at Nabble.com.
[[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.


[R] legend for bar plot ?

2013-11-26 Thread Adel ESSAFI
Hello;
I have the following table
 m
V2 V1  V3
1  C/L  0  732179
3  C/S  0  803926
19 D/F  0  724924
17 D/I  0  755841
13 D/L  0  731904
15 D/S  0  798289
11 I/F  0  871670
9  I/I  0  897718
5  I/L  0 2628113
7  I/S  0 2628113
2  C/L  1 1107269
4  C/S  1 1395714
20 D/F  1 1181282
18 D/I  1 1264249
14 D/L  1 1107595
16 D/S  1 1399836
12 I/F  1 1304294
10 I/I  1 1542813
6  I/L  1 2628113
8  I/S  1 2475448
as you can see, the table is sorted by the second and the first column.
with this command :
 barplot(m$V3,names.arg=m$V2,col=rainbow(10))
I succeded to print the figure attached.
Now, I need to indicate that the first 10 bar are for beta=0 and the second
10 bars are for beta=1.
Could you help please.
Best regards


-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] legend for bar plot ?

2013-11-26 Thread Adel ESSAFI
Hello;
I have the following table
 m
V2 V1  V3
1  C/L  0  732179
3  C/S  0  803926
19 D/F  0  724924
17 D/I  0  755841
13 D/L  0  731904
15 D/S  0  798289
11 I/F  0  871670
9  I/I  0  897718
5  I/L  0 2628113
7  I/S  0 2628113
2  C/L  1 1107269
4  C/S  1 1395714
20 D/F  1 1181282
18 D/I  1 1264249
14 D/L  1 1107595
16 D/S  1 1399836
12 I/F  1 1304294
10 I/I  1 1542813
6  I/L  1 2628113
8  I/S  1 2475448
as you can see, the table is sorted by the second and the first column.
with this command :
 barplot(m$V3,names.arg=m$V2,col=rainbow(10))
I succeded to print the figure attached.
Now, I need to indicate that the first 10 bar are for beta=0 and the second
10 bars are for beta=1.
Could you help please.
Best regards


-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166


plot.pdf
Description: Adobe PDF document
__
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.


Re: [R] scatter plot matrix with different x-y variables

2013-05-13 Thread adel daoud
Greg, the pairs2 function was exactly what I wanted. Thanks for a very
useful function. May I ask a follow up question, is it possible to draw a
correlation line with R2 values for each graph – on each graph, or on the
side of the graph. I am sure this is possible somehow, but I am new to R
programming so please just direct me into the right direction.



John, the grid.arrange() function is useful too but not exactly what I
needed. Thanks any way.



Best



Adel


On Sat, May 11, 2013 at 4:52 PM, Greg Snow 538...@gmail.com wrote:

 The pairs2 function in the TeachingDemos package does what you describe.
  You give it 2 matricies instead of just one and it creates the plots.


 On Wed, May 8, 2013 at 10:49 AM, Adel adelda...@gmail.com wrote:

 Dear list-members,

 I wonder if there is a way of creating a scatter plot table/grid with
 different variables on the y-axis compared to the x-axis? Something like
 this:

  A***
 B***
 C***
 -XYZ


 I know that you can create scatter plot matrix with the same variables on
 the
 y-axis as on the x-axis, like this:



 A*
 *B
 **C***
 ***X**
 Y*
 *Z

 But this is not what I want. I basically want to get a visual
 representation of different dependent variables (y-axis) on various
 independent variables (x-axis). So I want it to look like a scatter plot
 matrix or grid, but with my own specified variables on each axis.

 Secondly, to add to this, can I add a correlation line (linear and
 quadratic)
 through all scatter plots with both correlation and R2 values?


 All help appreciated.

 Adel

 --
 Adel Daoud, PhD
 Department of Sociology,  University of Gothenburg
 Box 720
 405 30 Göteborg, SWEDEN
 Visiting address: Sprängkullsgatan 25, room F411
 +46 031-786 47 84
 adel.da...@sociology.gu.se




 --
 View this message in context:
 http://r.789695.n4.nabble.com/scatter-plot-matrix-with-different-x-y-variables-tp4666598.html
 Sent from the R help mailing list archive at Nabble.com.
 [[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.




 --
 Gregory (Greg) L. Snow Ph.D.
 538...@gmail.com




-- 
Adel Daoud, PhD
Department of Sociology,  University of Gothenburg
Box 720
405 30 Göteborg, SWEDEN
Visiting address: Sprängkullsgatan 25, room F411
+46 031-786 47 84
adel.da...@sociology.gu.se

[[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.


Re: [R] R prints empty group on my figure!!

2013-05-10 Thread Adel ESSAFI
2013/5/9 PIKAL Petr petr.pi...@precheza.cz

 Hi


Thank you, that was the option I look for





 Use drop=TRUE argument in interaction for removing unused levels.

 Petr


  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
  project.org] On Behalf Of Adel ESSAFI
  Sent: Wednesday, May 08, 2013 12:48 PM
  To: r-help
  Subject: Re: [R] R prints empty group on my figure!!
 
  hello,
  I attach the figure generated by R:
 
 
  2013/5/8 Adel ESSAFI adeless...@gmail.com
 
   Hello list
   I am trying to solve a problem when drawing a figure related to the
   dataframe below.
   I draw V6 in Y axes and V3 as X axes. The data are grouped by V1 AND
  V2.
   I use this commande to make it:
  
  
  xyplot(cm[,6]~cm[,3],type=b,group=interaction(cm[,1],cm[,2],sep=/)
   , auto.key =list( title=Makespan en fonction de beta, points =
   FALSE, columns=2, lines = TRUE)
   ,data=cm,xlab=expression(beta),ylab=Ratio)
  
   The problem is that, R puts (for example) the entry C/D in the
  legend,
   however, I have no such entry. Note that R it does not draw a line
  for
   that entry.
  
   So, the question : how to do to remove the empty groups from the
  legend.
  
   Cordially
  
  
  
  
cm
  V1 V2  V3V4 V5   V6
   1   C  L 0.0  732179.0 686983 1.065789
   2   C  L 0.2  900956.4 686983 1.311468
   3   C  L 0.4  964725.0 686983 1.404292
   4   C  L 0.6 1017984.0 686983 1.481818
   5   C  L 0.8 1064745.8 686983 1.549887
   6   C  L 1.0 1107269.0 686983 1.611785
   7   C  S 0.0  803926.0 686983 1.170227
   8   C  S 0.2 1020492.0 686983 1.485469
   9   C  S 0.4 1134818.0 686983 1.651887
   10  C  S 0.6 1223596.0 686983 1.781115
   11  C  S 0.8 1322548.8 686983 1.925155
   12  C  S 1.0 1395714.0 686983 2.031657
   13  I  L 0.0 2628113.0 686983 3.825587
   14  I  L 0.2 2628113.0 686983 3.825587
   15  I  L 0.4 2628113.0 686983 3.825587
   16  I  L 0.6 2628113.0 686983 3.825587
   17  I  L 0.8 2628113.0 686983 3.825587
   18  I  L 1.0 2628113.0 686983 3.825587
   19  I  S 0.0 2628113.0 686983 3.825587 20  I  S 0.2 2628113.0 686983
   3.825587
   21  I  S 0.4 2475448.0 686983 3.603361
   22  I  S 0.6 2475448.0 686983 3.603361
   23  I  S 0.8 2475448.0 686983 3.603361
   24  I  S 1.0 2475448.0 686983 3.603361
   25  I  F 0.0  871670.0 686983 1.268838
   26  I  F 0.2 1066742.0 686983 1.552792
   27  I  F 0.4 1136213.0 686983 1.653917
   28  I  F 0.6 1210547.0 686983 1.762121
   29  I  F 0.8 1256777.0 686983 1.829415 30  I  F 1.0 1304294.0 686983
   1.898583
   31  I  I 0.0  897718.0 686983 1.306754
   32  I  I 0.2 1123968.0 686983 1.636093
   33  I  I 0.4 1301097.0 686983 1.893929
   34  I  I 0.6 1373663.0 686983 1.999559
   35  I  I 0.8 1424121.0 686983 2.073008
   36  I  I 1.0 1542813.0 686983 2.245780
   37  I  D 0.0  937621.0 686983 1.364839
   38  I  D 0.2 1205063.0 686983 1.754138
   39  I  D 0.4 1341839.0 686983 1.953235 40  I  D 0.6 1431970.0 686983
   2.084433
   41  I  D 0.8 1538944.0 686983 2.240149
   42  I  D 1.0 1670073.0 686983 2.431025
   43  D  L 0.0  731904.0 686983 1.065389
   44  D  L 0.2  900183.0 686983 1.310342
   45  D  L 0.4  964870.1 686983 1.404504
   46  D  L 0.6 1017462.8 686983 1.481060
   47  D  L 0.8 1064435.2 686983 1.549435
   48  D  L 1.0 1107595.0 686983 1.612260
   49  D  S 0.0  798289.0 686983 1.162022 50  D  S 0.2 1014643.2 686983
   1.476955
   51  D  S 0.4 1125711.8 686983 1.638631
   52  D  S 0.6 1220923.0 686983 1.777224
   53  D  S 0.8 1306571.2 686983 1.901897
   54  D  S 1.0 1399836.0 686983 2.037657
   55  D  F 0.0  724924.0 686983 1.055229
   56  D  F 0.2  935413.5 686983 1.361625
   57  D  F 0.4 1011621.9 686983 1.472557
   58  D  F 0.6 1071081.6 686983 1.559109
   59  D  F 0.8 1139325.8 686983 1.658448 60  D  F 1.0 1181282.1 686983
   1.719522
   61  D  I 0.0  755841.0 686983 1.100232
   62  D  I 0.2  964335.0 686983 1.403725
   63  D  I 0.4 1051233.4 686983 1.530218
   64  D  I 0.6 1110842.0 686983 1.616986
   65  D  I 0.8 1193509.0 686983 1.737320
   66  D  I 1.0 1264249.0 686983 1.840292
   67  D  D 0.0  751660.0 686983 1.094146
   68  D  D 0.2 1019735.0 686983 1.484367
   69  D  D 0.4 1101191.0 686983 1.602938 70  D  D 0.6 1191547.0 686983
   1.734464
   71  D  D 0.8 1293433.0 686983 1.882773
   72  D  D 1.0 1340360.0 686983 1.951082
  
  
 
 
  --
  PhD candidate in Computer Science
  Address
  3 avenue lamine, cité ezzahra, Sousse 4000 Tunisia
  tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
  fax: +216 71 391 166




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] R prints empty group on my figure!!

2013-05-08 Thread Adel ESSAFI
Hello list
I am trying to solve a problem when drawing a figure related to the
dataframe below.
I draw V6 in Y axes and V3 as X axes. The data are grouped by V1 AND V2.
I use this commande to make it:

xyplot(cm[,6]~cm[,3],type=b,group=interaction(cm[,1],cm[,2],sep=/),
auto.key =list( title=Makespan en fonction de beta, points = FALSE,
columns=2, lines = TRUE)
,data=cm,xlab=expression(beta),ylab=Ratio)

The problem is that, R puts (for example) the entry C/D in the legend,
however, I have no such entry. Note that R it does not draw a line for that
entry.

So, the question : how to do to remove the empty groups from the legend.

Cordially




 cm
   V1 V2  V3V4 V5   V6
1   C  L 0.0  732179.0 686983 1.065789
2   C  L 0.2  900956.4 686983 1.311468
3   C  L 0.4  964725.0 686983 1.404292
4   C  L 0.6 1017984.0 686983 1.481818
5   C  L 0.8 1064745.8 686983 1.549887
6   C  L 1.0 1107269.0 686983 1.611785
7   C  S 0.0  803926.0 686983 1.170227
8   C  S 0.2 1020492.0 686983 1.485469
9   C  S 0.4 1134818.0 686983 1.651887
10  C  S 0.6 1223596.0 686983 1.781115
11  C  S 0.8 1322548.8 686983 1.925155
12  C  S 1.0 1395714.0 686983 2.031657
13  I  L 0.0 2628113.0 686983 3.825587
14  I  L 0.2 2628113.0 686983 3.825587
15  I  L 0.4 2628113.0 686983 3.825587
16  I  L 0.6 2628113.0 686983 3.825587
17  I  L 0.8 2628113.0 686983 3.825587
18  I  L 1.0 2628113.0 686983 3.825587
19  I  S 0.0 2628113.0 686983 3.825587
20  I  S 0.2 2628113.0 686983 3.825587
21  I  S 0.4 2475448.0 686983 3.603361
22  I  S 0.6 2475448.0 686983 3.603361
23  I  S 0.8 2475448.0 686983 3.603361
24  I  S 1.0 2475448.0 686983 3.603361
25  I  F 0.0  871670.0 686983 1.268838
26  I  F 0.2 1066742.0 686983 1.552792
27  I  F 0.4 1136213.0 686983 1.653917
28  I  F 0.6 1210547.0 686983 1.762121
29  I  F 0.8 1256777.0 686983 1.829415
30  I  F 1.0 1304294.0 686983 1.898583
31  I  I 0.0  897718.0 686983 1.306754
32  I  I 0.2 1123968.0 686983 1.636093
33  I  I 0.4 1301097.0 686983 1.893929
34  I  I 0.6 1373663.0 686983 1.999559
35  I  I 0.8 1424121.0 686983 2.073008
36  I  I 1.0 1542813.0 686983 2.245780
37  I  D 0.0  937621.0 686983 1.364839
38  I  D 0.2 1205063.0 686983 1.754138
39  I  D 0.4 1341839.0 686983 1.953235
40  I  D 0.6 1431970.0 686983 2.084433
41  I  D 0.8 1538944.0 686983 2.240149
42  I  D 1.0 1670073.0 686983 2.431025
43  D  L 0.0  731904.0 686983 1.065389
44  D  L 0.2  900183.0 686983 1.310342
45  D  L 0.4  964870.1 686983 1.404504
46  D  L 0.6 1017462.8 686983 1.481060
47  D  L 0.8 1064435.2 686983 1.549435
48  D  L 1.0 1107595.0 686983 1.612260
49  D  S 0.0  798289.0 686983 1.162022
50  D  S 0.2 1014643.2 686983 1.476955
51  D  S 0.4 1125711.8 686983 1.638631
52  D  S 0.6 1220923.0 686983 1.777224
53  D  S 0.8 1306571.2 686983 1.901897
54  D  S 1.0 1399836.0 686983 2.037657
55  D  F 0.0  724924.0 686983 1.055229
56  D  F 0.2  935413.5 686983 1.361625
57  D  F 0.4 1011621.9 686983 1.472557
58  D  F 0.6 1071081.6 686983 1.559109
59  D  F 0.8 1139325.8 686983 1.658448
60  D  F 1.0 1181282.1 686983 1.719522
61  D  I 0.0  755841.0 686983 1.100232
62  D  I 0.2  964335.0 686983 1.403725
63  D  I 0.4 1051233.4 686983 1.530218
64  D  I 0.6 1110842.0 686983 1.616986
65  D  I 0.8 1193509.0 686983 1.737320
66  D  I 1.0 1264249.0 686983 1.840292
67  D  D 0.0  751660.0 686983 1.094146
68  D  D 0.2 1019735.0 686983 1.484367
69  D  D 0.4 1101191.0 686983 1.602938
70  D  D 0.6 1191547.0 686983 1.734464
71  D  D 0.8 1293433.0 686983 1.882773
72  D  D 1.0 1340360.0 686983 1.951082

[[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.


Re: [R] R prints empty group on my figure!!

2013-05-08 Thread Adel ESSAFI
hello,
I attach the figure generated by R:


2013/5/8 Adel ESSAFI adeless...@gmail.com

 Hello list
 I am trying to solve a problem when drawing a figure related to the
 dataframe below.
 I draw V6 in Y axes and V3 as X axes. The data are grouped by V1 AND V2.
 I use this commande to make it:

 xyplot(cm[,6]~cm[,3],type=b,group=interaction(cm[,1],cm[,2],sep=/),
 auto.key =list( title=Makespan en fonction de beta, points = FALSE,
 columns=2, lines = TRUE)
 ,data=cm,xlab=expression(beta),ylab=Ratio)

 The problem is that, R puts (for example) the entry C/D in the legend,
 however, I have no such entry. Note that R it does not draw a line for that
 entry.

 So, the question : how to do to remove the empty groups from the legend.

 Cordially




  cm
V1 V2  V3V4 V5   V6
 1   C  L 0.0  732179.0 686983 1.065789
 2   C  L 0.2  900956.4 686983 1.311468
 3   C  L 0.4  964725.0 686983 1.404292
 4   C  L 0.6 1017984.0 686983 1.481818
 5   C  L 0.8 1064745.8 686983 1.549887
 6   C  L 1.0 1107269.0 686983 1.611785
 7   C  S 0.0  803926.0 686983 1.170227
 8   C  S 0.2 1020492.0 686983 1.485469
 9   C  S 0.4 1134818.0 686983 1.651887
 10  C  S 0.6 1223596.0 686983 1.781115
 11  C  S 0.8 1322548.8 686983 1.925155
 12  C  S 1.0 1395714.0 686983 2.031657
 13  I  L 0.0 2628113.0 686983 3.825587
 14  I  L 0.2 2628113.0 686983 3.825587
 15  I  L 0.4 2628113.0 686983 3.825587
 16  I  L 0.6 2628113.0 686983 3.825587
 17  I  L 0.8 2628113.0 686983 3.825587
 18  I  L 1.0 2628113.0 686983 3.825587
 19  I  S 0.0 2628113.0 686983 3.825587
 20  I  S 0.2 2628113.0 686983 3.825587
 21  I  S 0.4 2475448.0 686983 3.603361
 22  I  S 0.6 2475448.0 686983 3.603361
 23  I  S 0.8 2475448.0 686983 3.603361
 24  I  S 1.0 2475448.0 686983 3.603361
 25  I  F 0.0  871670.0 686983 1.268838
 26  I  F 0.2 1066742.0 686983 1.552792
 27  I  F 0.4 1136213.0 686983 1.653917
 28  I  F 0.6 1210547.0 686983 1.762121
 29  I  F 0.8 1256777.0 686983 1.829415
 30  I  F 1.0 1304294.0 686983 1.898583
 31  I  I 0.0  897718.0 686983 1.306754
 32  I  I 0.2 1123968.0 686983 1.636093
 33  I  I 0.4 1301097.0 686983 1.893929
 34  I  I 0.6 1373663.0 686983 1.999559
 35  I  I 0.8 1424121.0 686983 2.073008
 36  I  I 1.0 1542813.0 686983 2.245780
 37  I  D 0.0  937621.0 686983 1.364839
 38  I  D 0.2 1205063.0 686983 1.754138
 39  I  D 0.4 1341839.0 686983 1.953235
 40  I  D 0.6 1431970.0 686983 2.084433
 41  I  D 0.8 1538944.0 686983 2.240149
 42  I  D 1.0 1670073.0 686983 2.431025
 43  D  L 0.0  731904.0 686983 1.065389
 44  D  L 0.2  900183.0 686983 1.310342
 45  D  L 0.4  964870.1 686983 1.404504
 46  D  L 0.6 1017462.8 686983 1.481060
 47  D  L 0.8 1064435.2 686983 1.549435
 48  D  L 1.0 1107595.0 686983 1.612260
 49  D  S 0.0  798289.0 686983 1.162022
 50  D  S 0.2 1014643.2 686983 1.476955
 51  D  S 0.4 1125711.8 686983 1.638631
 52  D  S 0.6 1220923.0 686983 1.777224
 53  D  S 0.8 1306571.2 686983 1.901897
 54  D  S 1.0 1399836.0 686983 2.037657
 55  D  F 0.0  724924.0 686983 1.055229
 56  D  F 0.2  935413.5 686983 1.361625
 57  D  F 0.4 1011621.9 686983 1.472557
 58  D  F 0.6 1071081.6 686983 1.559109
 59  D  F 0.8 1139325.8 686983 1.658448
 60  D  F 1.0 1181282.1 686983 1.719522
 61  D  I 0.0  755841.0 686983 1.100232
 62  D  I 0.2  964335.0 686983 1.403725
 63  D  I 0.4 1051233.4 686983 1.530218
 64  D  I 0.6 1110842.0 686983 1.616986
 65  D  I 0.8 1193509.0 686983 1.737320
 66  D  I 1.0 1264249.0 686983 1.840292
 67  D  D 0.0  751660.0 686983 1.094146
 68  D  D 0.2 1019735.0 686983 1.484367
 69  D  D 0.4 1101191.0 686983 1.602938
 70  D  D 0.6 1191547.0 686983 1.734464
 71  D  D 0.8 1293433.0 686983 1.882773
 72  D  D 1.0 1340360.0 686983 1.951082




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166


cmax.pdf
Description: Adobe PDF document
__
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.


[R] scatter plot matrix with different x-y variables

2013-05-08 Thread Adel
Dear list-members,

I wonder if there is a way of creating a scatter plot table/grid with
different variables on the y-axis compared to the x-axis? Something like
this:

 A***
B***
C***
-XYZ


I know that you can create scatter plot matrix with the same variables on
the
y-axis as on the x-axis, like this:



A*
*B
**C***
***X**
Y*
*Z

But this is not what I want. I basically want to get a visual
representation of different dependent variables (y-axis) on various
independent variables (x-axis). So I want it to look like a scatter plot
matrix or grid, but with my own specified variables on each axis.

Secondly, to add to this, can I add a correlation line (linear and
quadratic)
through all scatter plots with both correlation and R2 values?


All help appreciated.

Adel

-- 
Adel Daoud, PhD
Department of Sociology,  University of Gothenburg
Box 720
405 30 Göteborg, SWEDEN
Visiting address: Sprängkullsgatan 25, room F411
+46 031-786 47 84
adel.da...@sociology.gu.se




--
View this message in context: 
http://r.789695.n4.nabble.com/scatter-plot-matrix-with-different-x-y-variables-tp4666598.html
Sent from the R help mailing list archive at Nabble.com.
[[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.


Re: [R] xyplot legend : simple question

2013-05-06 Thread Adel ESSAFI
thank you


2013/5/6 Gerrit Eichner gerrit.eich...@math.uni-giessen.de

 Hello, Adel,

 maybe the argument sep of interaction() helps you. Try

 interaction( g[,1], g[,2], sep = /)

  Regards -- Gerrit



  I am using this command to draw the figure attached to this mail.

 xyplot(g[,4]~g[,3],type=b,**group=interaction(g[,1],g[,2])**,  auto.key
 =list( title=Evolution de la stabilité , points = FALSE,  columns=2,
 lines = TRUE,space=right) ,data=g,xlab=expression(beta),**
 ylab=stabilité)

 I want to change name of the legend that were attributed automaticalle
 (for
 example from C.D to C/D)?

 Can you help me to solve this?



 Regards

 --
 PhD candidate in Computer Science
 Address
 3 avenue lamine, cité ezzahra, Sousse 4000
 Tunisia
 tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
 fax: +216 71 391 166




-- 
*PhD in Computer Science
Address
*
*Avenue Taha Hussein Montfleury, 1008 Tunis

tél : +216 71 49 60 66
fax: +216 71 39 11 66*

[[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.


Re: [R] xyplot legend : simple question

2013-05-06 Thread Adel ESSAFI
Thank you

maybe the argument sep of interaction() helps you. Try

 interaction( g[,1], g[,2], sep = /)

  Regards -- Gerrit



  I am using this command to draw the figure attached to this mail.

 xyplot(g[,4]~g[,3],type=b,**group=interaction(g[,1],g[,2])**,  auto.key
 =list( title=Evolution de la stabilité , points = FALSE,  columns=2,
 lines = TRUE,space=right) ,data=g,xlab=expression(beta),**
 ylab=stabilité)

 I want to change name of the legend that were attributed automaticalle
 (for
 example from C.D to C/D)?

 Can you help me to solve this?



 Regards

 --
 PhD candidate in Computer Science
 Address
 3 avenue lamine, cité ezzahra, Sousse 4000
 Tunisia
 tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
 fax: +216 71 391 166




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] ggplot and colors

2013-02-04 Thread Adel ESSAFI
Hello,
I have a problem with ggplot and colors

I used this function to draw somes lines and I want them to be all black
(just to test)
however, I dont get any black line in the figure.

Do you have any experience with ggplot and manual colors??



ggplot(cmax, aes(cmax[,3], cmax[,6],colour=interaction(cmax[,1],cmax[,2])))
+ geom_line() +  geom_point() +  scale_fill_manual(values=c(black,
black , black, black, black, black, black, black, black,
black, black, black ))


best regards





-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166
attachment: test.png__
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.


[R] monte carlo simulation on R

2012-12-04 Thread Adel ESSAFI
Hello,

How can I make a monte carlo simulation on R?

Regards
Adel


-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] mean and kurtosis

2012-11-09 Thread Adel Powell
Need help!
I know how to get the mean and kurtosis for a single variable but I am
reading in an excel file that has several columns representing variables. I
need a way to find descriptive statistics across ALL the variables?

[[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.


[R] Problems getting slope and intercept to change when do multiple reps.

2012-10-26 Thread Adel Powell
library(ROCR)



n - 1000



fitglm - function(iteration,intercept,sigma,tau,beta){

x - rnorm(n,0,sigma)

ystar - intercept+beta*x

z - rbinom(n,1,plogis(ystar))

xerr - x + rnorm(n,0,tau)

model-glm(z ~ xerr, family=binomial(logit))

*int*-coef(model)[1]

*slope*-coef(model)[2]  # when add error you are suppose to get slightly
bias slope. However when I change the beta in the original X, I am not
getting the save average slope as output? strange?

pred-predict(model,type=response)

cutp-.5

result-ifelse(predcutp,1,0)

rocpreds-prediction(result,z)

auc-performance(rocpreds,auc)@y.values

accuracy-length(which(result==z))/length(z)



tn- sum(z==0  result==0)  # True Negative

fp- sum(z==0  result==1)  # False Positive

tp- sum(z==1  result==1)  # True Positive

fn- sum(z==1  result==0)  # False Negative



sensitivity- tp/(tp+fn)

specificity-tn/(tn+fp)



output-c(*int,slope*,cutp,accuracy,auc,sensitivity,specificity,iteration)

names(output)-c(Intercept,Slope,CutPoint,Accuracy,AUC,Sensitivity,Specificity,iteration)

return(output)

}



y-fitglm(1,2,1,2,4)

y




Output-t(sapply(1:10, function(x) fitglm(x,intercept=2, sigma=1,tau=2,beta=
4)))

apply(output,2, function(x) mean(unlist(x)))

apply(output,2, function(x) var(unlist(x)))


Output-t(sapply(1:500, function(x) fitglm(x,intercept=0, sigma=1,tau=.25,
beta=1)))

apply(output,2, function(x) mean(unlist(x)))

apply(output,2, function(x) var(unlist(x)))


Output-t(sapply(1:500, function(x) fitglm(x,intercept=2, sigma=1,tau=.25,
beta=6)))

apply(output,2, function(x) mean(unlist(x)))

apply(output,2, function(x) var(unlist(x)))

[[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.


[R] How to extract auc, specificity and sensitivity

2012-10-25 Thread Adel Powell
I am running my code in a loop and it does not work but when I run it
outside the loop I get the values I want.

n - 1000; # Sample size

fitglm - function(sigma,tau){
x - rnorm(n,0,sigma)
intercept - 0
beta - 0
ystar - intercept+beta*x
z - rbinom(n,1,plogis(ystar))
xerr - x + rnorm(n,0,tau)
model-glm(z ~ xerr, family=binomial(logit))
int-coef(model)[1]
slope-coef(model)[2]
pred-predict(model)

result-ifelse(pred.5,1,0)

accuracy-length(which(result==z))/length(z)
accuracy

rocpreds-prediction(result,z)
auc-performance(rocpreds,auc)@y.values
sentiv-performance(rocpreds,sens)@y.values
sentiv-slot(fp,y.values)[[1]]
sentiv-sentiv[2]
sentiv
specs-performance(rocpreds,spec)@y.values
specs-slot(fp2,y.values)[[1]]
specs-specs[2]
specs
output-c(int,slope,.5,accuracy,auc,sentiv,specs)

names(output)-c(Intercept,Slope,CutPoint,Accuracy,AUC,Sentivity,Specificity)
return(output)

}

y-fitglm(.05,1)
y


The code runs without the sentiv and specs but when I remove the loop i can
get the sensitivity and spec. values ???

[[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.


Re: [R] How to extract auc, specificity and sensitivity

2012-10-25 Thread Adel Powell
 n - 10; # Sample size

 fitglm - function(sigma,tau){
+ x - rnorm(n,0,sigma)
+ intercept - 0
+ beta - 0
+ ystar - intercept+beta*x
+ z - rbinom(n,1,plogis(ystar))
+ xerr - x + rnorm(n,0,tau)
+ model-glm(z ~ xerr, family=binomial(logit))
+ int-coef(model)[1]
+ slope-coef(model)[2]
+ pred-predict(model)
+
+ result-ifelse(pred.5,1,0)
+
+ accuracy-length(which(result==z))/length(z)
+ accuracy
+
+ rocpreds-prediction(result,z)
+ auc-performance(rocpreds,auc)@y.values
+ fp-performance(rocpreds,sens)
+ sentiv-slot(fp,y.values)[[1]]
+ sentiv-sentiv[2]
+ sentiv
+ fp2-performance(rocpreds,spec)
+ specs-slot(fp2,y.values)[[1]]
+ specs-specs[2]
+ specs
+ output-c(int,slope,.5,accuracy,auc,sentiv,specs)
+
names(output)-c(Intercept,Slope,CutPoint,Accuracy,AUC,Sentivity,Specificity)
+ return(output)
+
+ }

 y-fitglm(2,1)
 y
$Intercept
[1] 1.335284

$Slope
[1] 0.1562984

$CutPoint
[1] 0.5

$Accuracy
[1] 0.8

$AUC
[1] 0.5

$Sentivity
[1] 1

$Specificity
[1] 0



Don't get error message but wrong values

On Thu, Oct 25, 2012 at 4:05 PM, Berend Hasselman b...@xs4all.nl wrote:



 Your code is still not runnable.
 It gives the error message

 Error in fitglm(0.05, 1) : could not find function prediction

 Berend

 On 25-10-2012, at 21:55, Adel Powell wrote:

  I think I have corrected it. Can you tell me are my spec and sens values
 correct
  n - 1000; # Sample size
 
  fitglm - function(sigma,tau){
  x - rnorm(n,0,sigma)
  intercept - 0
  beta - 0
  ystar - intercept+beta*x
  z - rbinom(n,1,plogis(ystar))
  xerr - x + rnorm(n,0,tau)
  model-glm(z ~ xerr, family=binomial(logit))
  int-coef(model)[1]
  slope-coef(model)[2]
  pred-predict(model)
 
  result-ifelse(pred.5,1,0)
 
  accuracy-length(which(result==z))/length(z)
  accuracy
 
  rocpreds-prediction(result,z)
  auc-performance(rocpreds,auc)@y.values
  fp-performance(rocpreds,sens)
  sentiv-slot(fp,y.values)[[1]]
  sentiv-sentiv[2]
  sentiv
  fp2-performance(rocpreds,spec)
  specs-slot(fp2,y.values)[[1]]
  specs-specs[2]
  specs
  output-c(int,slope,.5,accuracy,auc,sentiv,specs)
 
 names(output)-c(Intercept,Slope,CutPoint,Accuracy,AUC,Sentivity,Specificity)
  return(output)
 
  }
 
  y-fitglm(.05,1)
  y
 
 
  On Thu, Oct 25, 2012 at 3:43 PM, Berend Hasselman b...@xs4all.nl wrote:
 
  On 25-10-2012, at 21:28, Adel Powell wrote:
 
   I am running my code in a loop and it does not work but when I run it
   outside the loop I get the values I want.
  
   n - 1000; # Sample size
  
   fitglm - function(sigma,tau){
  x - rnorm(n,0,sigma)
  intercept - 0
  beta - 0
  ystar - intercept+beta*x
  z - rbinom(n,1,plogis(ystar))
  xerr - x + rnorm(n,0,tau)
  model-glm(z ~ xerr, family=binomial(logit))
  int-coef(model)[1]
  slope-coef(model)[2]
  pred-predict(model)
  
  result-ifelse(pred.5,1,0)
  
  accuracy-length(which(result==z))/length(z)
  accuracy
  
  rocpreds-prediction(result,z)
  auc-performance(rocpreds,auc)@y.values
  sentiv-performance(rocpreds,sens)@y.values
  sentiv-slot(fp,y.values)[[1]]
  sentiv-sentiv[2]
  sentiv
  specs-performance(rocpreds,spec)@y.values
  specs-slot(fp2,y.values)[[1]]
  specs-specs[2]
  specs
  output-c(int,slope,.5,accuracy,auc,sentiv,specs)
  
  
 names(output)-c(Intercept,Slope,CutPoint,Accuracy,AUC,Sentivity,Specificity)
 
  A missing  before Specificity?
 
  return(output)
  
   }
  
   y-fitglm(.05,1)
   y
  
 
  Running this after correction of the missing   one gets en error
 
  Error in fitglm(0.05, 1) : could not find function prediction
 
  How are you using a loop?
  Your example is not reproducible.
 
  Berend
 
 
  
   The code runs without the sentiv and specs but when I remove the loop
 i can
   get the sensitivity and spec. values ???
  
 [[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]]

__
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.


Re: [R] How to extract auc, specificity and sensitivity

2012-10-25 Thread Adel Powell
n - 10; # Sample size

fitglm - function(sigma,tau){
x - rnorm(n,0,sigma)
intercept - 0
beta - 0
ystar - intercept+beta*x
z - rbinom(n,1,plogis(ystar))
xerr - x + rnorm(n,0,tau)
model-glm(z ~ xerr, family=binomial(logit))
int-coef(model)[1]
slope-coef(model)[2]
pred-predict(model)

result-ifelse(pred.5,1,0)

accuracy-length(which(result==z))/length(z)
accuracy

rocpreds-prediction(result,z)
auc-performance(rocpreds,auc)@y.values
fp-performance(rocpreds,sens)
sentiv-slot(fp,y.values)[[1]]
sentiv-sentiv[2]
sentiv
fp2-performance(rocpreds,spec)
specs-slot(fp2,y.values)[[1]]
specs-specs[2]
specs
output-c(int,slope,.5,accuracy,auc,sentiv,specs)

names(output)-c(Intercept,Slope,CutPoint,Accuracy,AUC,Sentivity,Specificity)
return(output)

}

y-fitglm(2,1)
y


I corrected the code. I am put everything in a loop because I am running
monte carlo reps outside of this later.

It works but the value returned is wrong.

Here is the manual manipulation:

* x - rnorm(10,0,2)*
* *

* intercept - 0*
* *

* beta - 5*
* *

* ystar - intercept+beta*x*
* *

* ystar*

 [1]  16.5436337   7.7740329 -10.1653928  -2.8338118 -21.5410780   2.6902171
5.1156558   5.0729933 -10.8556430   0.9208434

* test - plogis(ystar)*
* *

* test*

 [1] 9.99e-01 9.995797e-01 3.847772e-05 5.552417e-02 4.413963e-10
9.364469e-01 9.940338e-01 9.937753e-01 1.929504e-05 7.152139e-01

* z - rbinom(10,1,plogis(ystar))*
* *

* z*

 [1] 1 1 0 0 0 1 1 1 0 1

* xerr - x + rnorm(10,0,1) *
* *

* xerr*

 [1]  0.5610573  3.1741687 -2.3915066 -0.2546224 -4.1790037 -1.4387786
 1.4211227
-1.1141176 -1.6230087  0.7595021

* model-glm(z ~ xerr, family=binomial(logit))*
* *

* model*



Call:  glm(formula = z ~ xerr, family = binomial(logit))



Coefficients:

(Intercept) xerr

  1.5001.309

* int-coef(model)[1]*
* *

* slope-coef(model)[2]*
* *

*  pred1-predict(model)*
* *

* pred2-predict(model,type=response)*
* *

* pred1*

  1   2   3   4   5
6
7   8   9  10

 2.23478077  5.65499178 -1.62972799  1.16716581 -3.96932102 -0.38273530
3.36049056  0.04220225 -0.62386760  2.49451832

* pred2*

 1  2  3  4  5  6
7
8  9 10

0.90332965 0.99651221 0.16386763 0.76263234 0.01853617 0.40546735
0.96644669 0.51054900 0.34890234 0.92375664

* result-ifelse(pred2.5,1,0) *
* *

* result*

 1  2  3  4  5  6  7  8  9 10

 1  1  0  1  0  0  1  1  0  1

* accuracy-length(which(result==z))/length(z)*
* *

*  accuracy*

[1] 0.8

* rocpreds-prediction(result,z)*
* *

* rocpreds*

* auc-performance(rocpreds,auc)@y.values*
* *

* auc*

[[1]]

[1] 0.7916667

*  fp-performance(rocpreds,sens)*
* *

* sentiv-slot(fp,y.values)[[1]]*
* *

* sentiv-sentiv[2]*
* *

* sentiv*

[1] 0.833


* *

*  fp2-performance(rocpreds,spec)*
* *

* specs-slot(fp2,y.values)[[1]]*
* *

* specs*

[1] 1.00 0.75 0.00

* specs-specs[2]*
* *

* specs*

[1] 0.75
On Thu, Oct 25, 2012 at 3:43 PM, Berend Hasselman b...@xs4all.nl wrote:


 On 25-10-2012, at 21:28, Adel Powell wrote:

  I am running my code in a loop and it does not work but when I run it
  outside the loop I get the values I want.
 
  n - 1000; # Sample size
 
  fitglm - function(sigma,tau){
 x - rnorm(n,0,sigma)
 intercept - 0
 beta - 0
 ystar - intercept+beta*x
 z - rbinom(n,1,plogis(ystar))
 xerr - x + rnorm(n,0,tau)
 model-glm(z ~ xerr, family=binomial(logit))
 int-coef(model)[1]
 slope-coef(model)[2]
 pred-predict(model)
 
 result-ifelse(pred.5,1,0)
 
 accuracy-length(which(result==z))/length(z)
 accuracy
 
 rocpreds-prediction(result,z)
 auc-performance(rocpreds,auc)@y.values
 sentiv-performance(rocpreds,sens)@y.values
 sentiv-slot(fp,y.values)[[1]]
 sentiv-sentiv[2]
 sentiv
 specs-performance(rocpreds,spec)@y.values
 specs-slot(fp2,y.values)[[1]]
 specs-specs[2]
 specs
 output-c(int,slope,.5,accuracy,auc,sentiv,specs)
 
 
 names(output)-c(Intercept,Slope,CutPoint,Accuracy,AUC,Sentivity,Specificity)

 A missing  before Specificity?

 return(output)
 
  }
 
  y-fitglm(.05,1)
  y
 

 Running this after correction of the missing   one gets en error

 Error in fitglm(0.05, 1) : could not find function prediction

 How are you using a loop?
 Your example is not reproducible.

 Berend


 
  The code runs without the sentiv and specs but when I remove the loop i
 can
  get the sensitivity and spec. values ???
 
[[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

[R] Logistic regression/Cut point? predict ??

2012-10-20 Thread Adel Powell
I am new to R and I am trying to do a monte carlo simulation where I
generate data and interject error then test various cut points; however, my
output was garbage (at x equal zero, I did not get .50)
I am basically testing the performance of classifiers.

Here is the code:
n - 1000; # Sample size

fitglm - function(sigma,tau){
x - rnorm(n,0,sigma)
intercept - 0
beta - 5
   * ystar - intercept+beta*x*
   * z - rbinom(n,1,plogis(ystar))**# I believe plogis accepts the a
+bx augments and return the  e^x/(1+e^x)  which is then used to generate 0
and 1 data*
xerr - x + rnorm(n,0,tau)# error is added here
model-glm(z ~ xerr, family=binomial(logit))
int-coef(model)[1]
slope-coef(model)[2]
pred-predict(model)  #this gives me the a+bx data for new error?  I
know I can add type= response to get the probab. but only e^x not *e^x/(1+e^x)
*

pi1hat-length(z[which(z==1)]/length(z)) My cut point is calculated  is
the proportion of 0s to 1.
pi0hat-length(z[which(z==0)]/length(z))

cutmid - log(pi0hat/pi1hat)
pred-ifelse(predcutmid,1,0) * I am not sure if I need to compare
these two. I think this is an error.
*
accuracy-length(which(pred==z))/length(z)
accuracy

rocpreds-prediction(pred,z)
auc-performance(rocpreds,auc)@y.values

output-c(int,slope,cutmid,accuracy,auc)
names(output)-c(Intercept,Slope,CutPoint,Accuracy,AUC)
return(output)

}

y-fitglm(.05,1)
y

nreps - 500;
output-data.frame(matrix(rep(NA),nreps,6,ncol=6))

mysigma-.5
mytau-.1

i-1

for(j in 1:nreps) {
output[j,1:5]-fitglm(mysigma,mytau)
output[j,6]-j
}

names(output)-c(Intercept,Slope,CutPoint,Accuracy,AUC,Iteration)

apply(output,2, mean)
apply(output,2, var)

[[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.


[R] syntaxe problem

2012-02-24 Thread Adel ESSAFI
Hello,
I want to create 10 dataframe  using a for loop.
I don t know what to do to create 10 different dataframes whose name is
parametrized with variable i.
This syntaxe fails. It create a unique fataframe called dfn.
Any input will help
Thanks

  for (i in 1:10){
+ filename=paste(avail4,i,sep = _)
+ dfn=read.table(filename)
+ }


-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] transforming a data frame to matrix

2012-02-18 Thread Adel ESSAFI
Hello

 orderulcount
   Group.1 Group.2 Group.3  xV5
7C   L 0.0 30 C / L
19   C   L 0.2 27 C / L
31   C   L 0.4 15 C / L
43   C   L 0.6  7 C / L
54   C   L 0.8  2 C / L
10   C   S 0.0 27 C / S
22   C   S 0.2 10 C / S
34   C   S 0.4  6 C / S
46   C   S 0.6  1 C / S
1D   D 0.0 30 D / D
13   D   D 0.2 30 D / D
25   D   D 0.4 17 D / D
37   D   D 0.6  9 D / D
49   D   D 0.8  2 D / D
3D   F 0.0 30 D / F
15   D   F 0.2 26 D / F
27   D   F 0.4 13 D / F
39   D   F 0.6  3 D / F
51   D   F 0.8  3 D / F
5D   I 0.0 26 D / I
17   D   I 0.2  7 D / I
29   D   I 0.4  7 D / I
41   D   I 0.6  1 D / I
53   D   I 0.8  1 D / I
8D   L 0.0 30 D / L
20   D   L 0.2 26 D / L
32   D   L 0.4 14 D / L
44   D   L 0.6  8 D / L
55   D   L 0.8  2 D / L
11   D   S 0.0 27 D / S
23   D   S 0.2  8 D / S
35   D   S 0.4  4 D / S
47   D   S 0.6  1 D / S
2I   D 0.0 30 I / D
14   I   D 0.2 30 I / D
26   I   D 0.4 14 I / D
38   I   D 0.6  9 I / D
50   I   D 0.8  2 I / D
4I   F 0.0 30 I / F
16   I   F 0.2 29 I / F
28   I   F 0.4 16 I / F
40   I   F 0.6  5 I / F
52   I   F 0.8  2 I / F
6I   I 0.0 30 I / I
18   I   I 0.2 17 I / I
30   I   I 0.4  4 I / I
42   I   I 0.6  1 I / I
9I   L 0.0 30 I / L
21   I   L 0.2 27 I / L
33   I   L 0.4 17 I / L
45   I   L 0.6  8 I / L
56   I   L 0.8  2 I / L
12   I   S 0.0 28 I / S
24   I   S 0.2 11 I / S
36   I   S 0.4  6 I / S
48   I   S 0.6  3 I / S

I have a data frame formed by 5 colomns. How to transform this data frame
to a matrix formed as follow:
1. the colomn 5 is the comumn (string)
2.  the colomn 5 row
3. the data are the colomn x.

I aim to draw barplot later using the matrix.

Thanks for any help









-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


Re: [R] transforming a data frame to matrix

2012-02-18 Thread Adel ESSAFI
with simpler expressions:
if I have a dataframe
A B C
is it possible de transform it to a matrix where nrow(A) colomns, nrow(B)
row and for each value of C, we put the corresponding value in the matrix.

Regards



Le 18 février 2012 13:57, Adel ESSAFI adeless...@gmail.com a écrit :

 Hello

  orderulcount
Group.1 Group.2 Group.3  xV5
 7C   L 0.0 30 C / L
 19   C   L 0.2 27 C / L
 31   C   L 0.4 15 C / L
 43   C   L 0.6  7 C / L
 54   C   L 0.8  2 C / L
 10   C   S 0.0 27 C / S
 22   C   S 0.2 10 C / S
 34   C   S 0.4  6 C / S
 46   C   S 0.6  1 C / S
 1D   D 0.0 30 D / D
 13   D   D 0.2 30 D / D
 25   D   D 0.4 17 D / D
 37   D   D 0.6  9 D / D
 49   D   D 0.8  2 D / D
 3D   F 0.0 30 D / F
 15   D   F 0.2 26 D / F
 27   D   F 0.4 13 D / F
 39   D   F 0.6  3 D / F
 51   D   F 0.8  3 D / F
 5D   I 0.0 26 D / I
 17   D   I 0.2  7 D / I
 29   D   I 0.4  7 D / I
 41   D   I 0.6  1 D / I
 53   D   I 0.8  1 D / I
 8D   L 0.0 30 D / L
 20   D   L 0.2 26 D / L
 32   D   L 0.4 14 D / L
 44   D   L 0.6  8 D / L
 55   D   L 0.8  2 D / L
 11   D   S 0.0 27 D / S
 23   D   S 0.2  8 D / S
 35   D   S 0.4  4 D / S
 47   D   S 0.6  1 D / S
 2I   D 0.0 30 I / D
 14   I   D 0.2 30 I / D
 26   I   D 0.4 14 I / D
 38   I   D 0.6  9 I / D
 50   I   D 0.8  2 I / D
 4I   F 0.0 30 I / F
 16   I   F 0.2 29 I / F
 28   I   F 0.4 16 I / F
 40   I   F 0.6  5 I / F
 52   I   F 0.8  2 I / F
 6I   I 0.0 30 I / I
 18   I   I 0.2 17 I / I
 30   I   I 0.4  4 I / I
 42   I   I 0.6  1 I / I
 9I   L 0.0 30 I / L
 21   I   L 0.2 27 I / L
 33   I   L 0.4 17 I / L
 45   I   L 0.6  8 I / L
 56   I   L 0.8  2 I / L
 12   I   S 0.0 28 I / S
 24   I   S 0.2 11 I / S
 36   I   S 0.4  6 I / S
 48   I   S 0.6  3 I / S

 I have a data frame formed by 5 colomns. How to transform this data frame
 to a matrix formed as follow:
 1. the colomn 5 is the comumn (string)
 2.  the colomn 5 row
 3. the data are the colomn x.

 I aim to draw barplot later using the matrix.

 Thanks for any help









 --
 PhD candidate in Computer Science
 Address
 3 avenue lamine, cité ezzahra, Sousse 4000
 Tunisia
 tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
 fax: +216 71 391 166




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


Re: [R] multiple histograms from a dataframe

2012-02-11 Thread Adel ESSAFI
Le 11 février 2012 02:33, David Winsemius dwinsem...@comcast.net a écrit :


 On Feb 10, 2012, at 7:05 PM, Adel ESSAFI wrote:

  Hi list


 I  need some help for drawing some histograms

 I have a dataframe , say,
 X Y Z T

 I want to draw a histogram Z-T for each value of the couple (X-Y).
 When I use thus syntax

  library(lattice)
 histogram(law[,3] ~ law[,66] | law[,1] )


 Perhaps (but untested in the absence of data);

  histogram( Z ~ T | interaction(X, Y)  , data=dfrmname )

 Thanks ,
that helped a lot.

now, I have another problem: I want  to draw many (two) figures together.
The par(new=T) directve does not recognize the ploy provided by lattice
library
when I tired :
 xyplot(law[,66] ~ law[,3]| interaction(law[,1],law[,2]),type='l')
 par(new=T)
*Warning message:
In par(new = T) : calling par(new=TRUE) with no plot*
 xyplot(law[,67] ~ law[,3]| interaction(law[,1],law[,2]),type='l')

and the second xyplot() draws a new figure.

what can I do to draw to figures together using lattice?
Thanks









 it draws multiple histograms but by selecting distinct values of  law[,1]
 The deal is to make the same thing but for a couple of columns

 Thanks in advance for help

 Adel


 --

 David Winsemius, MD
 West Hartford, CT




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] multiple histograms from a dataframe

2012-02-10 Thread Adel ESSAFI
Hi list


I  need some help for drawing some histograms

I have a dataframe , say,
X Y Z T

I want to draw a histogram Z-T for each value of the couple (X-Y).
When I use thus syntax

 library(lattice)
 histogram(law[,3] ~ law[,66] | law[,1] )

it draws multiple histograms but by selecting distinct values of  law[,1]
The deal is to make the same thing but for a couple of columns

Thanks in advance for help

Adel



-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] generate a random number with rexp ?

2012-01-27 Thread Adel ESSAFI
dear list

I use runif to generate a ramdom number between min and max

runif(n, min=0, max=1)


however , the syntaxe of rexp does not allow that

rexp(n, rate = 1)


and it generate a number with the corresponding rate.

The question is: how to generate a number between min and max using rexp().

Regards


-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


Re: [R] generate a number using exponential low

2011-12-13 Thread Adel ESSAFI
Deal list

 I want to generate a random number in an interval using exponential low
 I know how to make that simply using uniform low
 x1 - runif(1, 5.0, 7.5)
 this will generate a number between 5 et 7.5 but with uniform low.
 Could you help pease.?
 Regards

 --
 PhD candidate in Computer Science
 Address
 3 avenue lamine, cité ezzahra, Sousse 4000
 Tunisia
 tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
 fax: +216 71 391 166


[[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.


Re: [R] question about aggregate

2011-10-22 Thread Adel ESSAFI
Hello,
is there any help please.
Regards


2011/10/21 Adel ESSAFI adeless...@gmail.com

 Hello
 I am discovering R and I find it is really very powerful.

 However, I find some newbie difficulties.

 Here, I have a data frame with manu values that I want to calculate the
 frequency (the nomber of line) of the some criteria.
 For exemple here,  I want it to print the number of occurence where
 sci[,2]=0 and sci[,1]=L. In my exemple, he is printing the number of the
 line in the result data frame.
 however, I have at least 90 line with sci[,2]=0 and sci[,1]=L.
 Thank you in advance for any input.


   aggregate(sci[,5],list(sci[,2],sci[,1]),frequency)
Group.1 Group.2 x
 1  0.0   L 1
 2  0.2   L 1


 --
 PhD candidate in Computer Science
 Address
 3 avenue lamine, cité ezzahra, Sousse 4000
 Tunisia
 tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
 fax: +216 71 391 166




-- 
*PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706
fax: +216 71 391 166*

[[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.


[R] Fwd: question about aggregate

2011-10-22 Thread Adel ESSAFI
Hello,
is there any help please.
Regards



2011/10/21 Adel ESSAFI adeless...@gmail.com

 Hello
 I am discovering R and I find it is really very powerful.

 However, I find some newbie difficulties.

 Here, I have a data frame with manu values that I want to calculate the
 frequency (the nomber of line) of the some criteria.
 For exemple here,  I want it to print the number of occurence where
 sci[,2]=0 and sci[,1]=L. In my exemple, he is printing the number of the
 line in the result data frame.
 however, I have at least 90 line with sci[,2]=0 and sci[,1]=L.
 Thank you in advance for any input.


   aggregate(sci[,5],list(sci[,2],sci[,1]),frequency)
Group.1 Group.2 x
 1  0.0   L 1
 2  0.2   L 1


 --
 PhD candidate in Computer Science
 Address
 3 avenue lamine, cité ezzahra, Sousse 4000
 Tunisia
 tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
 fax: +216 71 391 166




-- 
*PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706
fax: +216 71 391 166*




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


Re: [R] question about aggregate

2011-10-22 Thread Adel ESSAFI
Hi,
It is not what I want, but, thx anyway.
Regards


2011/10/22 Weidong Gu anopheles...@gmail.com

 try this

 table(sci[,2]=0,sci[,1]=L)

 Weidong Gu

 On Sat, Oct 22, 2011 at 7:51 AM, Adel ESSAFI adel.s...@imag.fr wrote:
  Hello,
  is there any help please.
  Regards
 
 
  2011/10/21 Adel ESSAFI adeless...@gmail.com
 
  Hello
  I am discovering R and I find it is really very powerful.
 
  However, I find some newbie difficulties.
 
  Here, I have a data frame with manu values that I want to calculate the
  frequency (the nomber of line) of the some criteria.
  For exemple here,  I want it to print the number of occurence where
  sci[,2]=0 and sci[,1]=L. In my exemple, he is printing the number of the
  line in the result data frame.
  however, I have at least 90 line with sci[,2]=0 and sci[,1]=L.
  Thank you in advance for any input.
 
 
aggregate(sci[,5],list(sci[,2],sci[,1]),frequency)
 Group.1 Group.2 x
  1  0.0   L 1
  2  0.2   L 1
 
 
  --
  PhD candidate in Computer Science
  Address
  3 avenue lamine, cité ezzahra, Sousse 4000
  Tunisia
  tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
  fax: +216 71 391 166
 
 
 
 
  --
  *PhD candidate in Computer Science
  Address
  3 avenue lamine, cité ezzahra, Sousse 4000
  Tunisia
  tel: +216 97 246 706
  fax: +216 71 391 166*
 
 [[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.
 
 

 __
 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.




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


Re: [R] question about aggregate

2011-10-22 Thread Adel ESSAFI
NO
 aggregate(si[,7],list(si[,2],si[,1]),mean)
   Group.1 Group.2   x
1  0.0   D 212.5015448
2  0.2   D 200.5271137
3  0.4   D 191.5387529
4  0.6   D 131.5856218
5  0.8   D  16.4515798
6  1.0   D   0.9698699
7  0.0   F 211.6176036
8  0.2   F 199.5358336
9  0.4   F 179.1472057
10 0.6   F  70.3376311
11 0.8   F  25.0939253
12 1.0   F   0.9759778
13 0.0   I 199.1829674
14 0.2   I 188.8703456
15 0.4   I 147.5194562
16 0.6   I  18.1743204
17 0.8   I   0.9563789
18 1.0   I   0.9531993
19 0.0   L  95.1813009
20 0.2   L  95.1813009
21 0.4   L  92.3533476
22 0.6   L  47.1235041
23 0.8   L   9.4129464
24 1.0   L   0.9336508
25 0.0   S  95.1813009
26 0.2   S  91.4119070
27 0.4   S  81.9875960
28 0.6   S  11.3183831
29 0.8   S   1.8843307
30 1.0   S   0.9310779

for exemple, for the last line, I want aggregate to show me the number of
lines with col1=1 and col2=S in stead of the mean.

Regards



2011/10/22 Weidong Gu anopheles...@gmail.com

 Is this waht you want?

 sci[,5][sci[,2]==0  sci[,1]==L]

 Weidong

 On Sat, Oct 22, 2011 at 8:19 AM, Adel ESSAFI adeless...@gmail.com wrote:
  Hi,
  It is not what I want, but, thx anyway.
  Regards
 
 
  2011/10/22 Weidong Gu anopheles...@gmail.com
 
  try this
 
  table(sci[,2]=0,sci[,1]=L)
 
  Weidong Gu
 
  On Sat, Oct 22, 2011 at 7:51 AM, Adel ESSAFI adel.s...@imag.fr wrote:
   Hello,
   is there any help please.
   Regards
  
  
   2011/10/21 Adel ESSAFI adeless...@gmail.com
  
   Hello
   I am discovering R and I find it is really very powerful.
  
   However, I find some newbie difficulties.
  
   Here, I have a data frame with manu values that I want to calculate
 the
   frequency (the nomber of line) of the some criteria.
   For exemple here,  I want it to print the number of occurence where
   sci[,2]=0 and sci[,1]=L. In my exemple, he is printing the number of
   the
   line in the result data frame.
   however, I have at least 90 line with sci[,2]=0 and sci[,1]=L.
   Thank you in advance for any input.
  
  
 aggregate(sci[,5],list(sci[,2],sci[,1]),frequency)
  Group.1 Group.2 x
   1  0.0   L 1
   2  0.2   L 1
  
  
   --
   PhD candidate in Computer Science
   Address
   3 avenue lamine, cité ezzahra, Sousse 4000
   Tunisia
   tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
   fax: +216 71 391 166
  
  
  
  
   --
   *PhD candidate in Computer Science
   Address
   3 avenue lamine, cité ezzahra, Sousse 4000
   Tunisia
   tel: +216 97 246 706
   fax: +216 71 391 166*
  
  [[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.
  
  
 
  __
  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.
 
 
 
  --
  PhD candidate in Computer Science
  Address
  3 avenue lamine, cité ezzahra, Sousse 4000
  Tunisia
  tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
  fax: +216 71 391 166
 




-- 
*PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706
fax: +216 71 391 166*

[[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.


Re: [R] question about aggregate

2011-10-22 Thread Adel ESSAFI
2011/10/22 Adel ESSAFI adel.s...@imag.fr

 NO
  aggregate(si[,7],list(si[,2],si[,1]),mean)
Group.1 Group.2   x
 1  0.0   D 212.5015448
 2  0.2   D 200.5271137
 3  0.4   D 191.5387529
 4  0.6   D 131.5856218
 5  0.8   D  16.4515798
 6  1.0   D   0.9698699
 7  0.0   F 211.6176036
 8  0.2   F 199.5358336
 9  0.4   F 179.1472057
 10 0.6   F  70.3376311
 11 0.8   F  25.0939253
 12 1.0   F   0.9759778
 13 0.0   I 199.1829674
 14 0.2   I 188.8703456
 15 0.4   I 147.5194562
 16 0.6   I  18.1743204
 17 0.8   I   0.9563789
 18 1.0   I   0.9531993
 19 0.0   L  95.1813009
 20 0.2   L  95.1813009
 21 0.4   L  92.3533476
 22 0.6   L  47.1235041
 23 0.8   L   9.4129464
 24 1.0   L   0.9336508
 25 0.0   S  95.1813009
 26 0.2   S  91.4119070
 27 0.4   S  81.9875960
 28 0.6   S  11.3183831
 29 0.8   S   1.8843307
 30 1.0   S   0.9310779

 for exemple, for the last line, I want aggregate to show me the number of
 lines with col1=1 and col2=S in stead of the mean.


 Regards



 2011/10/22 Weidong Gu anopheles...@gmail.com

 Is this waht you want?

 sci[,5][sci[,2]==0  sci[,1]==L]

 Weidong

 On Sat, Oct 22, 2011 at 8:19 AM, Adel ESSAFI adeless...@gmail.com
 wrote:
  Hi,
  It is not what I want, but, thx anyway.
  Regards
 
 
  2011/10/22 Weidong Gu anopheles...@gmail.com
 
  try this
 
  table(sci[,2]=0,sci[,1]=L)
 
  Weidong Gu
 
  On Sat, Oct 22, 2011 at 7:51 AM, Adel ESSAFI adel.s...@imag.fr
 wrote:
   Hello,
   is there any help please.
   Regards
  
  
   2011/10/21 Adel ESSAFI adeless...@gmail.com
  
   Hello
   I am discovering R and I find it is really very powerful.
  
   However, I find some newbie difficulties.
  
   Here, I have a data frame with manu values that I want to calculate
 the
   frequency (the nomber of line) of the some criteria.
   For exemple here,  I want it to print the number of occurence where
   sci[,2]=0 and sci[,1]=L. In my exemple, he is printing the number of
   the
   line in the result data frame.
   however, I have at least 90 line with sci[,2]=0 and sci[,1]=L.
   Thank you in advance for any input.
  
  
 aggregate(sci[,5],list(sci[,2],sci[,1]),frequency)
  Group.1 Group.2 x
   1  0.0   L 1
   2  0.2   L 1
  
  
   --
   PhD candidate in Computer Science
   Address
   3 avenue lamine, cité ezzahra, Sousse 4000
   Tunisia
   tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
   fax: +216 71 391 166
  
  
  
  
   --
   *PhD candidate in Computer Science
   Address
   3 avenue lamine, cité ezzahra, Sousse 4000
   Tunisia
   tel: +216 97 246 706
   fax: +216 71 391 166*
  
  [[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.
  
  
 
  __
  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.
 
 
 
  --
  PhD candidate in Computer Science
  Address
  3 avenue lamine, cité ezzahra, Sousse 4000
  Tunisia
  tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
  fax: +216 71 391 166
 




 --
 *PhD candidate in Computer Science
 Address
 3 avenue lamine, cité ezzahra, Sousse 4000
 Tunisia
 tel: +216 97 246 706
 fax: +216 71 391 166*




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


Re: [R] question about aggregate

2011-10-22 Thread Adel ESSAFI
Thank you
I works as I need.

  aggregate(tmp[,5],list(tmp[,2],tmp[,1]),function(x) sum(table(x)))
  Group.1 Group.2   x
1 0.0   D 100
2 0.2   D 100
3 0.4   D 100
4 0.6   D  72
5 0.8   D   9


2011/10/22 Weidong Gu anopheles...@gmail.com

 Thanks for providing the example data, try this

  aggregate(si[,7],list(si[,2],si[,1]),function(x) sum(table(x)))

 Weidong

 On Sat, Oct 22, 2011 at 9:28 AM, Adel ESSAFI adel.s...@imag.fr wrote:
  NO
  aggregate(si[,7],list(si[,2],si[,1]),mean)
 Group.1 Group.2   x
  1  0.0   D 212.5015448
  2  0.2   D 200.5271137
  3  0.4   D 191.5387529
  4  0.6   D 131.5856218
  5  0.8   D  16.4515798
  6  1.0   D   0.9698699
  7  0.0   F 211.6176036
  8  0.2   F 199.5358336
  9  0.4   F 179.1472057
  10 0.6   F  70.3376311
  11 0.8   F  25.0939253
  12 1.0   F   0.9759778
  13 0.0   I 199.1829674
  14 0.2   I 188.8703456
  15 0.4   I 147.5194562
  16 0.6   I  18.1743204
  17 0.8   I   0.9563789
  18 1.0   I   0.9531993
  19 0.0   L  95.1813009
  20 0.2   L  95.1813009
  21 0.4   L  92.3533476
  22 0.6   L  47.1235041
  23 0.8   L   9.4129464
  24 1.0   L   0.9336508
  25 0.0   S  95.1813009
  26 0.2   S  91.4119070
  27 0.4   S  81.9875960
  28 0.6   S  11.3183831
  29 0.8   S   1.8843307
  30 1.0   S   0.9310779
 
  for exemple, for the last line, I want aggregate to show me the number of
  lines with col1=1 and col2=S in stead of the mean.
 
  Regards
 
 
 
  2011/10/22 Weidong Gu anopheles...@gmail.com
 
  Is this waht you want?
 
  sci[,5][sci[,2]==0  sci[,1]==L]
 
  Weidong
 
  On Sat, Oct 22, 2011 at 8:19 AM, Adel ESSAFI adeless...@gmail.com
 wrote:
   Hi,
   It is not what I want, but, thx anyway.
   Regards
  
  
   2011/10/22 Weidong Gu anopheles...@gmail.com
  
   try this
  
   table(sci[,2]=0,sci[,1]=L)
  
   Weidong Gu
  
   On Sat, Oct 22, 2011 at 7:51 AM, Adel ESSAFI adel.s...@imag.fr
 wrote:
Hello,
is there any help please.
Regards
   
   
2011/10/21 Adel ESSAFI adeless...@gmail.com
   
Hello
I am discovering R and I find it is really very powerful.
   
However, I find some newbie difficulties.
   
Here, I have a data frame with manu values that I want to
 calculate
the
frequency (the nomber of line) of the some criteria.
For exemple here,  I want it to print the number of occurence
 where
sci[,2]=0 and sci[,1]=L. In my exemple, he is printing the number
 of
the
line in the result data frame.
however, I have at least 90 line with sci[,2]=0 and sci[,1]=L.
Thank you in advance for any input.
   
   
  aggregate(sci[,5],list(sci[,2],sci[,1]),frequency)
   Group.1 Group.2 x
1  0.0   L 1
2  0.2   L 1
   
   
--
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166
   
   
   
   
--
*PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706
fax: +216 71 391 166*
   
   [[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.
   
   
  
   __
   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.
  
  
  
   --
   PhD candidate in Computer Science
   Address
   3 avenue lamine, cité ezzahra, Sousse 4000
   Tunisia
   tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
   fax: +216 71 391 166
  
 
 
 
  --
  PhD candidate in Computer Science
  Address
  3 avenue lamine, cité ezzahra, Sousse 4000
  Tunisia
  tel: +216 97 246 706
  fax: +216 71 391 166
 




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] question about aggregate

2011-10-21 Thread Adel ESSAFI
Hi list

I am discovering R, and

-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] question about aggregate

2011-10-21 Thread Adel ESSAFI
Hello
I am discovering R and I find it is really very powerful.

However, I find some newbie difficulties.

Here, I have a data frame with manu values that I want to calculate the
frequency (the nomber of line) of the some criteria.
For exemple here,  I want it to print the number of occurence where
sci[,2]=0 and sci[,1]=L. In my exemple, he is printing the number of the
line in the result data frame.
however, I have at least 90 line with sci[,2]=0 and sci[,1]=L.
Thank you in advance for any input.


  aggregate(sci[,5],list(sci[,2],sci[,1]),frequency)
   Group.1 Group.2 x
1  0.0   L 1
2  0.2   L 1

-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] multiple lines with the same data frame?

2011-10-17 Thread Adel ESSAFI
Bonjour

I have this data frame and I am newbie in R.
I want to ask if it is possible to draw 10 lines in a plot such that: a line
for every colomn, the x - axis is the second column and the y-axis is the
third one.

Thank you for any input


1   0  1094442
1   0.2  1163576.2
1   0.4  1238539.6
1   0.6  1303510.4
1   0.8  1376573.2
1   1  1454175
2   0  1076068
2   0.2  1139246
2   0.4  1212344
2   0.6  1277591.8
2   0.8  1346156.6
2   1  1410058
3   0  1097901
3   0.2  1173643.2
3   0.4  1258849.8
3   0.6  1343001.6
3   0.8  1427705.8
3   1  1507793
4   0  1197047
4   0.2  1292918.6
4   0.4  1383640.8
4   0.6  1480487.8
4   0.8  1571557.6
4   1  1659578
5   0  1120010
5   0.2  1200076.6
5   0.4  1279653
5   0.6  1360494.6
5   0.8  1437223.2
5   1  1512636
6   0  1082650
6   0.2  1154676.6
6   0.4  1223416.6
6   0.6  1297593.6
6   0.8  1366764.6
6   1  1432705
7   0  1023590
7   0.2  1077783.8
7   0.4  1133154.2
7   0.6  1190296
7   0.8  1244411.4
7   1  1297709
8   0  1042257
8   0.2  1107452.8
8   0.4  1174574.8
8   0.6  1238547.6
8   0.8  1301507.6
8   1  1363338
9   0  1066917
9   0.2  1136411.8
9   0.4  1202822
9   0.6  1273514.8
9   0.8  1340641.8
9   1  1408249
10   0  1069685
10   0.2  1138909
10   0.4  1213284.2
10   0.6  1282508.8
10   0.8  1346093.2
10   1  1410707

[[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.


[R] two ecdf in the same figure

2011-09-24 Thread Adel ESSAFI
Hello,

is ot possible to draw two ecdf of vectors (say s1 and s2) on the same
figire with R.

plot function draws a new plot and there is no function like points or lines
to draw a second ecdf on the figure.

Regards


-- 
*PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706
fax: +216 71 391 166*

[[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.


[R] draw points in R

2011-09-14 Thread Adel ESSAFI
Hello list
I have this file

0   121289479   25
0   212599129   1
0   285254098   21
0   444889848   45
0   469197123   30
0   640007403   82
0   718215617   8
0   758534043   56
0   799706577   4
0   814441385   93
0   843545059   37
0.2   121289479   6
0.2   285254098   3
0.2   444889848   6
0.2   469197123   13
0.2   640007403   24
0.2   718215617   3
0.2   758534043   2
0.2   799706577   2
0.2   814441385   70
0.2   843545059   3
0.4   121289479   1
0.4   444889848   14
0.4   469197123   4
0.4   640007403   11
0.4   799706577   2
0.4   814441385   8


I read it with R and next I want to draw a point for each line the X is in
col  2 and y is in col 3
but, I need that for each value of the first colomn , to have a color. Thus,
I want to get a draw with 3 colors for values 0 , 0.2 and 0.4

The probleme is that when I use points function; it plots to me lines and
not simpe points.

Thank you in advance for any input.







-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


Re: [R] draw points in R

2011-09-14 Thread Adel ESSAFI
You are kind

2011/9/14 Sarah Goslee sarah.gos...@gmail.com

 Hi,

  The probleme is that when I use points function; it plots to me lines and
  not simpe points.

 That seems unlikely, but without your code it's hard to figure out
 what you did. As usual, the telepathy is not working.

 Regardless, this will create a graph with points:

 x - read.table(clipboard, header=FALSE, as.is=TRUE)
 # including data is good; including data with dput() is better

 plot(x[,2], x[,3], type=p, xlab=X, ylab=Y, main=Points)

  I read it with R and next I want to draw a point for each line the X is
 in
  col  2 and y is in col 3
  but, I need that for each value of the first colomn , to have a color.
 Thus,
  I want to get a draw with 3 colors for values 0 , 0.2 and 0.4

 And here's one way to color them:
 plot(x[,2], x[,3], col=c(red, blue, green)[as.factor(x[,1])],
 xlab=X, ylab=Y, main=Colored Points)

 You might be interested in ?par especially pch and also in ?legend
 as well as in the basic help for ?plot and ?points.

 Sarah

 On Wed, Sep 14, 2011 at 1:57 PM, Adel ESSAFI adeless...@gmail.com wrote:
  Hello list
  I have this file
 
  0   121289479 25
  0   212599129 1
  0   285254098   21
  0   444889848   45
  0   469197123   30
  0   640007403   82
  0   718215617 8
  0   758534043   56
  0   799706577   4
  0   814441385   93
  0   843545059   37
  0.2   121289479   6
  0.2   285254098   3
  0.2   444889848   6
  0.2   469197123   13
  0.2   640007403   24
  0.2   718215617 3
  0.2   758534043   2
  0.2   799706577   2
  0.2   814441385   70
  0.2   843545059 3
  0.4   121289479   1
  0.4   444889848   14
  0.4   469197123   4
  0.4   640007403   11
  0.4   799706577   2
  0.4   814441385 8
 
 
 

 
  Thank you in advance for any input.
 
 
 



 --
 Sarah Goslee
 http://www.functionaldiversity.org




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] printing big real values

2011-01-19 Thread Adel ESSAFI
Hello,
I have a file with very big values.  I want to display the real values with
classic  ways (without exposant)

 summary(a[,1]);
 Min.   1st Qu.Median  Mean   3rd Qu.  Max.
1.198e+09 1.199e+09 1.200e+09 1.200e+09 1.201e+09 1.202e+09
Can you help please?
Regards
Adel







-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] basic hist() question

2010-08-21 Thread Adel ESSAFI
Hi list

I loaded the content  of a file dureetasks.txt to variable a. This file
contains an interger per line.
when I print a vector, it displays correctly.
however, when I  try to print the histogram, I get this error message

 a=read.table(dureetasks.txt)
 hist(a)
Error in hist.default(a) : 'x' must be numeric

Can you help please?

regards




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


Re: [R] basic hist() question

2010-08-21 Thread Adel ESSAFI
Hi
In fact, I  searching for a simpler solution. I remember that I have done
this without these functions (but I forgot)
simply, is there any function that force R to take variable a  as table ?

Regards
Adel



 a=read.table(dureetasks.txt)
 summary(a)
   V1
 Min.   :  1
 1st Qu.: 77
 Median :   2658
 Mean   :  25802
 3rd Qu.:  42558
 Max.   :1575814
 hist(a);
Error in hist.default(a) : 'x' must be numeric



2010/8/21 Gavin Simpson gavin.simp...@ucl.ac.uk

 On Sat, 2010-08-21 at 11:37 +0200, Adel ESSAFI wrote:
  Hi list
 
  I loaded the content  of a file dureetasks.txt to variable a. This file
  contains an interger per line.
  when I print a vector, it displays correctly.
  however, when I  try to print the histogram, I get this error message
 
   a=read.table(dureetasks.txt)
   hist(a)
  Error in hist.default(a) : 'x' must be numeric
 
  Can you help please?

 class(a)

 str(a)

  a - data.frame(x = rnorm(100))
  hist(a)
 Error in hist.default(a) : 'x' must be numeric

 So I suspect a is a data frame with a single column/variable. You need
 to pass hist the vector from /inside/ a that you want to plot:

  with(a, hist(x))

 is one way to do that. Note that 'x' is used because that is the name of
 the variable (component really) in a that I want to plot:

  names(a)
 [1] x

 You will need to work out what the correct name is for the component you
 want to plot. If there was no header to your text file then IIRC the
 variable will be named X1, but run names(a) and see what it returns.

 Because we don't have your dureetasks.txt file, there is no way for me
 to clarify that this is the problem and nothing else. If you can't send
 us data at the very least use tools like str(a) and class(a), and
 head(a) to show us what the data look like.

 HTH

 G

 
  regards
 
 
 
 
  __
  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.

 --
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
  Dr. Gavin Simpson [t] +44 (0)20 7679 0522
  ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
  Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
  Gower Street, London  [w] 
 http://www.ucl.ac.uk/~ucfagls/http://www.ucl.ac.uk/%7Eucfagls/
  UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] Fwd: basic hist() question

2010-08-21 Thread Adel ESSAFI
-- Forwarded message --
From: Adel ESSAFI adeless...@gmail.com
Date: 2010/8/21
Subject: Re: [R] basic hist() question
To: Henrique Dallazuanna www...@gmail.com


It works fine.

Could you explain to me why it did not worked for read.table?

regards
Adel


2010/8/21 Henrique Dallazuanna www...@gmail.com

 Try this:

 a - scan('dureetasks.txt')
 hist(a)

 On Sat, Aug 21, 2010 at 10:32 AM, Adel ESSAFI adeless...@gmail.comwrote:

 Hi
 In fact, I  searching for a simpler solution. I remember that I have done
 this without these functions (but I forgot)
 simply, is there any function that force R to take variable a  as table
 ?

 Regards
 Adel



  a=read.table(dureetasks.txt)
  summary(a)
   V1
  Min.   :  1
  1st Qu.: 77
  Median :   2658
  Mean   :  25802
  3rd Qu.:  42558
  Max.   :1575814
  hist(a);
 Error in hist.default(a) : 'x' must be numeric



 2010/8/21 Gavin Simpson gavin.simp...@ucl.ac.uk

  On Sat, 2010-08-21 at 11:37 +0200, Adel ESSAFI wrote:
   Hi list
  
   I loaded the content  of a file dureetasks.txt to variable a. This
 file
   contains an interger per line.
   when I print a vector, it displays correctly.
   however, when I  try to print the histogram, I get this error message
  
a=read.table(dureetasks.txt)
hist(a)
   Error in hist.default(a) : 'x' must be numeric
  
   Can you help please?
 
  class(a)
 
  str(a)
 
   a - data.frame(x = rnorm(100))
   hist(a)
  Error in hist.default(a) : 'x' must be numeric
 
  So I suspect a is a data frame with a single column/variable. You need
  to pass hist the vector from /inside/ a that you want to plot:
 
   with(a, hist(x))
 
  is one way to do that. Note that 'x' is used because that is the name of
  the variable (component really) in a that I want to plot:
 
   names(a)
  [1] x
 
  You will need to work out what the correct name is for the component you
  want to plot. If there was no header to your text file then IIRC the
  variable will be named X1, but run names(a) and see what it returns.
 
  Because we don't have your dureetasks.txt file, there is no way for me
  to clarify that this is the problem and nothing else. If you can't send
  us data at the very least use tools like str(a) and class(a), and
  head(a) to show us what the data look like.
 
  HTH
 
  G
 
  
   regards
  
  
  
  
   __
   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.
 
  --
  %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
   Dr. Gavin Simpson [t] +44 (0)20 7679 0522
   ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
   Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
   Gower Street, London  [w] 
  http://www.ucl.ac.uk/~ucfagls/http://www.ucl.ac.uk/%7Eucfagls/
 http://www.ucl.ac.uk/%7Eucfagls/

   UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
  %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 
 


 --
 PhD candidate in Computer Science
 Address
 3 avenue lamine, cité ezzahra, Sousse 4000
 Tunisia
 tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
 fax: +216 71 391 166

[[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




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166



-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


Re: [R] basic hist() question

2010-08-21 Thread Adel ESSAFI
thanks,
I'am not veru used with R!!


regards

2010/8/21 Henrique Dallazuanna www...@gmail.com

 Adel,

 read.table return a data.frame, Gavin showed, you need pass which column
 will be plotted to hist.
 scan return a vector.


 On Sat, Aug 21, 2010 at 10:59 AM, Adel ESSAFI adeless...@gmail.comwrote:

 It works fine.

 Could you explain to me why it did not worked for read.table?

 regards
 Adel


 2010/8/21 Henrique Dallazuanna www...@gmail.com

 Try this:

 a - scan('dureetasks.txt')
 hist(a)

 On Sat, Aug 21, 2010 at 10:32 AM, Adel ESSAFI adeless...@gmail.comwrote:

 Hi
 In fact, I  searching for a simpler solution. I remember that I have
 done
 this without these functions (but I forgot)
 simply, is there any function that force R to take variable a  as
 table ?

 Regards
 Adel



  a=read.table(dureetasks.txt)
  summary(a)
   V1
  Min.   :  1
  1st Qu.: 77
  Median :   2658
  Mean   :  25802
  3rd Qu.:  42558
  Max.   :1575814
  hist(a);
 Error in hist.default(a) : 'x' must be numeric



 2010/8/21 Gavin Simpson gavin.simp...@ucl.ac.uk

  On Sat, 2010-08-21 at 11:37 +0200, Adel ESSAFI wrote:
   Hi list
  
   I loaded the content  of a file dureetasks.txt to variable a. This
 file
   contains an interger per line.
   when I print a vector, it displays correctly.
   however, when I  try to print the histogram, I get this error
 message
  
a=read.table(dureetasks.txt)
hist(a)
   Error in hist.default(a) : 'x' must be numeric
  
   Can you help please?
 
  class(a)
 
  str(a)
 
   a - data.frame(x = rnorm(100))
   hist(a)
  Error in hist.default(a) : 'x' must be numeric
 
  So I suspect a is a data frame with a single column/variable. You need
  to pass hist the vector from /inside/ a that you want to plot:
 
   with(a, hist(x))
 
  is one way to do that. Note that 'x' is used because that is the name
 of
  the variable (component really) in a that I want to plot:
 
   names(a)
  [1] x
 
  You will need to work out what the correct name is for the component
 you
  want to plot. If there was no header to your text file then IIRC the
  variable will be named X1, but run names(a) and see what it returns.
 
  Because we don't have your dureetasks.txt file, there is no way for me
  to clarify that this is the problem and nothing else. If you can't
 send
  us data at the very least use tools like str(a) and class(a), and
  head(a) to show us what the data look like.
 
  HTH
 
  G
 
  
   regards
  
  
  
  
   __
   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.
 
  --
  %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
   Dr. Gavin Simpson [t] +44 (0)20 7679 0522
   ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
   Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
   Gower Street, London  [w] 
  http://www.ucl.ac.uk/~ucfagls/http://www.ucl.ac.uk/%7Eucfagls/
 http://www.ucl.ac.uk/%7Eucfagls/

   UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
  %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 
 


 --
 PhD candidate in Computer Science
 Address
 3 avenue lamine, cité ezzahra, Sousse 4000
 Tunisia
 tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
 fax: +216 71 391 166

[[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




 --
 PhD candidate in Computer Science
 Address
 3 avenue lamine, cité ezzahra, Sousse 4000
 Tunisia
 tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
 fax: +216 71 391 166




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




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] variation

2010-06-05 Thread Adel ESSAFI
Hi list
I am a new user of R. I ask for some beginner question

I am searching if there is any function that computes the variation of some
discrete values of a vector (mean() and sd() exists, but i have not find
variation).

Thanks in advance

Adel


-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] Fwd: How to make R automatic?

2010-06-05 Thread Adel ESSAFI
-- Forwarded message --
From: Adel ESSAFI adel.s...@imag.fr
Date: 2010/6/5
Subject: Re: [R] How to make R automatic?
To: zhangted001 zhen...@gmail.com


Well, I am new but i will give you an example of script that I run


cat exec2.sh
R --no-saveEOF
fl=list.files(pattern=*.dat)

for( j in 1:length(fl)){
   a=read.table(fl[j])
   debut=a[,1]
   fin=a[,2]
   duree=a[,3]
   u=matrix(ncol=1,nrow=length(fin)-1)
   for( i in 1:length(fin)-1) u[i]=debut[i+1]-fin[i]
   if (! (is.na(mean(duree)) || is.na(sd(duree)) || is.na(mean(u)) ||
is.na(sd(u)
) ) )  {
   cat (fl[j], ,mean(duree), ,sd(duree), ,mean(u), ,sd(u),
,trunc((mean(duree)/(mean(duree)+mean(u)))*100), ,length(debut),
\n,file=testlogsnavai,append=TRUE)
  }
}

This works perfect




2010/6/5 zhangted001 zhen...@gmail.com


 Thank you all for the information!  That is exactly what I was looking for.

 --
 View this message in context:
 http://r.789695.n4.nabble.com/How-to-make-R-automatic-tp2238541p2244132.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.




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166



-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


Re: [R] variation

2010-06-05 Thread Adel ESSAFI
2010/6/5 Jannis bt_jan...@yahoo.de

 What exactly do you mean by variation? As I understand it, this term is a
 broad term for all kinds of different spread measures (like quantile range
 or standard deviation). Do you mean the Coefficient of Variation? If you
 found out how to


Yes, that what I mean. But I looked for ready  function :)


 compute the mean and the std.dev., it is straightforward to calculate
 it.

 Adel ESSAFI schrieb:

 Hi list
 I am a new user of R. I ask for some beginner question

 I am searching if there is any function that computes the variation of
 some
 discrete values of a vector (mean() and sd() exists, but i have not find
 variation).

 Thanks in advance

 Adel


  


 __
 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.






-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


Re: [R] variation

2010-06-05 Thread Adel ESSAFI
2010/6/5 Adel ESSAFI adel.s...@imag.fr



 2010/6/5 Jannis bt_jan...@yahoo.de

 What exactly do you mean by variation? As I understand it, this term is a
 broad term for all kinds of different spread measures (like quantile range
 or standard deviation). Do you mean the Coefficient of Variation? If you
 found out how to


Yes, that what I mean. But I looked for ready  function :)




 Yes, that what I mean. But I looked for ready  function :)


 compute the mean and the std.dev., it is straightforward to calculate
 it.

 Adel ESSAFI schrieb:

 Hi list
 I am a new user of R. I ask for some beginner question

 I am searching if there is any function that computes the variation of
 some
 discrete values of a vector (mean() and sd() exists, but i have not find
 variation).

 Thanks in advance

 Adel


  


 __
 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.






 --
 PhD candidate in Computer Science
 Address
 3 avenue lamine, cité ezzahra, Sousse 4000
 Tunisia
 tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
 fax: +216 71 391 166




-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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.


[R] AIC score

2009-06-21 Thread Adel
Dear All,

I've been using step function to find me the best model.this basically works
by using AIC score fucntion that is implemented on step(). The problem I'm
facing with lots of variables on the model for example :


step(lm(x1~x2,x3,x4,..x13)) sometimes gives me a warning message which
is :

AIC=- inf

Coefficients:
   (Intercept) wnt3.values wnt6.values   wnt10b.values
wnt9a.values
2.3462 -0.4689  2.0730  1.2769
-0.2319
  sfrp1.valueswnt5b.values  sfrp1.1.valuessfrp5.values
fzd5.1.values
   -0.2597  0.3150  0.3811  0.5926
-1.5567
   fzd1.values fzd4.values fzd6.values fzd7.values
fzd7.1.values
0.6459 -2.3016  0.3636  NA
NA
   fzd8.values
NA

Warning message:
attempting model selection on an essentially perfect fit is nonsense .

which stops the search.

Does this means that  Residual Sum of Squares (RSS) equals to zero that
makes AIC goes to -inf .And how would I overcome this problem.Can I for
example find those that have strong correlation with x1 first and then use
AIC score to find me the best model among them,.

Regards
Adel,

[[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.