Re: [R] Minimum cutsets

2011-10-14 Thread R. Michael Weylandt
I don't know the specifics of this package, but generally the C code
is called internally by R: it, however, requires compilation before R
can talk to it. You wont need to learn C though.

Look at the link David suggested for a precompiled version, but it may
be older than the development-version functionality discussed up
thread. If you don't have access to a pre-compiled binary (the author
may be willing to send one to you), it is possible to compile one
yourself with not too much trouble. Theoretically, you won't have to
touch the C code other than to pass it through the package building
process, which is rather well documented. If the source is too
development-y, this might be a little tricky, so I'd ask the author
for a binary first.

Michael

On Thu, Oct 13, 2011 at 10:24 PM, David Winsemius
dwinsem...@comcast.net wrote:

 On Oct 13, 2011, at 7:47 PM, malhomidi wrote:

 Hi again,

        I've looked at the links above

 No links visible to the rest of us non-Nabble users. When will nabble-users
 ever learn to include context? (or to post with new Subject: lines when the
 topic changes?)


 and I see the development version of
 the igraph library. I see the src folder implemented in C. Are these
 source
 codes available in R or I just would have to use the C code?

 I'm guessing from context that you mean to ask: are their binary versions of
 the package? (There are always source versions of packages, especially so
 for development versions.)

 Here is one CRAN mirror's igraph (non-development) page. Look for something
 like:

  Package source: igraph_0.5.5-2.tar.gz

 http://lib.stat.cmu.edu/R/CRAN/web/packages/igraph/index.html

 The reason is
 that I just started learning R and I really want to stay away from C and
 C++.

 Regards,
 Mohammed Alhomidi

 --
 View this message in context:
 http://r.789695.n4.nabble.com/Minimum-cutsets-tp885346p3903287.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.

 David Winsemius, MD
 West Hartford, CT

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


__
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] Length of data.frame column

2011-10-14 Thread jawbonemurphy
I have a related question...I have a data frame similar with 74 rows that I
created with header=TRUE, but when I try to coerce one of the data frame
columns into a vector, it shows up as having length 1, even though when I
print it, it shows 74 elements:

 VAL - c(DailyDiary[1])
 VAL
 [1] 3 3 3 2 3 3 4 4 3 3 2 1 1 4 3 3 2 3 3 2 2 3 3 3 1 2 2
[28] 1 1 3 3 3 2 4 3 2 3 4 3 3 3 3 4 3 2 3 2 3 1 2 1 2 3 1
[55] 0 3 2 4 3 1 2 3 1 1 1 4 3 2 1 2 3 3 3 2
length(VAL)
[1] 1

On the other hand, I can easily coerce the row names to a vector of length
74

 partf - row.names(DailyDiary)
 length(partf)
[1] 74

What I would like to do is make VAL into a vector with length 74 instead of
length 1 so I can sort it using use partf as factors.  I tried
as.vector, but it doesn't let you specify the length.  Any ideas?  Thanks,
and sorry if I'm being unclear or stupid, I'm a newbie :)

Logan

--
View this message in context: 
http://r.789695.n4.nabble.com/Length-of-data-frame-column-tp864585p3903892.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] Question about GAMs

2011-10-14 Thread pigpigmeow
pre-predict(ozonea,groupA,type=terms,terms=NULL,newdata.guaranteed=FALSE,na.action=na.pass)

yeah!
but I don't know how to only show the value of s(ratio,bs=cr)

--
View this message in context: 
http://r.789695.n4.nabble.com/Question-about-GAMs-tp3900848p3903753.html
Sent from the R help mailing 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] Drop ALL Levels of a Data Frame Object

2011-10-14 Thread swonder03
I'm using the package 'gdata' and 'drop.levels' in the following code as a
simplified example of what I want to do, pinpointing the issue of isolating
variable in a data frame:

/dfNamesAndHeight - data.frame(Name = c('Bill','Bob','Bo'), Height =
c(73,68,83))
name_Bob - drop.levels(dfNamesAndHeight[2,1])
cat(name_Bob,  is a good guy.) 
/

The output is  1  is a good guy. Print instead of cat returns Error in
print.default(xx, quote = quote, ...) : invalid 'quote' argument. When you
just enter 'name_Bob' the output is:

  [1] Bob
Levels: Bob

Is there any way to isolate 'Bob' without the 'Levels: Bob'? 


--
View this message in context: 
http://r.789695.n4.nabble.com/Drop-ALL-Levels-of-a-Data-Frame-Object-tp3903788p3903788.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] Length of data.frame column

2011-10-14 Thread Jeff Newmiller
You haven't provided a reproducible example. You haven't even provided a subset 
of your data, or the commands you used to read it in.
I might guess that 

VAL - DailyDiary[[1]]

might be what you wanted, and the str function might help you understand why. 
Also, the c function does not coerce object types... it embeds the 
arguments into a new vector.
---
Jeff Newmiller The . . Go Live...
DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

jawbonemurphy jdurlands...@gmail.com wrote:

I have a related question...I have a data frame similar with 74 rows that I
created with header=TRUE, but when I try to coerce one of the data frame
columns into a vector, it shows up as having length 1, even though when I
print it, it shows 74 elements:

 VAL - c(DailyDiary[1])
 VAL
 [1] 3 3 3 2 3 3 4 4 3 3 2 1 1 4 3 3 2 3 3 2 2 3 3 3 1 2 2
[28] 1 1 3 3 3 2 4 3 2 3 4 3 3 3 3 4 3 2 3 2 3 1 2 1 2 3 1
[55] 0 3 2 4 3 1 2 3 1 1 1 4 3 2 1 2 3 3 3 2
length(VAL)
[1] 1

On the other hand, I can easily coerce the row names to a vector of length
74

 partf - row.names(DailyDiary)
 length(partf)
[1] 74

What I would like to do is make VAL into a vector with length 74 instead of
length 1 so I can sort it using use partf as factors. I tried
as.vector, but it doesn't let you specify the length. Any ideas? Thanks,
and sorry if I'm being unclear or stupid, I'm a newbie :)

Logan

--
View this message in context: 
http://r.789695.n4.nabble.com/Length-of-data-frame-column-tp864585p3903892.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.


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

2011-10-14 Thread Simon Wood
predict.gam is returning a matrix with a named column for each term. 
Select the appropriate column. Example below


library(mgcv)
n-200;sig - 2
dat - gamSim(1,n=n,scale=sig)
b - gam(y~s(x0)+s(I(x1^2))+s(x2)+offset(x3),data=dat)
newd - data.frame(x0=(0:30)/30,x1=(0:30)/30,x2=(0:30)/30,x3=(0:30)/30)
pred - predict.gam(b,newd,type=terms)

pred[,3] ## extracts s(x2)
pred[,s(x2)] ## same


On 14/10/11 04:54, pigpigmeow wrote:

pre-predict(ozonea,groupA,type=terms,terms=NULL,newdata.guaranteed=FALSE,na.action=na.pass)

yeah!
but I don't know how to only show the value of s(ratio,bs=cr)

--
View this message in context: 
http://r.789695.n4.nabble.com/Question-about-GAMs-tp3900848p3903753.html
Sent from the R help mailing 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.




--
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
+44 (0)1225 386603   http://people.bath.ac.uk/sw283

__
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] binding all elements of list (character vectors) to a matrix as rows

2011-10-14 Thread Marion Wenty
hello again,

i used the command


rbind(Mymatrix, t(as.data.frame(Z)))


and it works!

thanks very much for your replys!

marion



2011/10/11 David Winsemius dwinsem...@comcast.net


 On Oct 11, 2011, at 2:47 AM, Marion Wenty wrote:

  dear r-users,

 i have got a problem which i am trying to solve:

 i have got the following commands:

 Mymatrix - matrix(1:9,ncol=3)
 Z -
 list
 (V1
 =c(a,,),V2=c(b,,**),V3=c(c,,),V4=c(**d,,))


 rbind(Mymatrix, t(as.data.frame(Z)))

 The next method could be used if you had more lists:

 do.call(rbind, list(Mymatrix, t(as.data.frame(Z



  Mymatrix - rbind(Mymatrix,Z[[1]],Z[[2]],**Z[[3]],Z[[4]])

 now this is working, but i would like to substitute

 Z[[1]],Z[[2]],Z[[3]],Z[[4]]

 for a command with which i could also use another list with a different
 number of elements, e.g. 5 or 6 elements.

 --

 David Winsemius


[[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] Drop ALL Levels of a Data Frame Object

2011-10-14 Thread Jeff Newmiller
Why aren't you using as.character instead of drop.levels?
---
Jeff Newmiller The . . Go Live...
DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

swonder03 ramey.ste...@gmail.com wrote:

I'm using the package 'gdata' and 'drop.levels' in the following code as a
simplified example of what I want to do, pinpointing the issue of isolating
variable in a data frame:

/dfNamesAndHeight - data.frame(Name = c('Bill','Bob','Bo'), Height =
c(73,68,83))
name_Bob - drop.levels(dfNamesAndHeight[2,1])
cat(name_Bob,  is a good guy.) 
/

The output is  1 is a good guy. Print instead of cat returns Error in
print.default(xx, quote = quote, ...) : invalid 'quote' argument. When you
just enter 'name_Bob' the output is:

 [1] Bob
Levels: Bob

Is there any way to isolate 'Bob' without the 'Levels: Bob'? 


--
View this message in context: 
http://r.789695.n4.nabble.com/Drop-ALL-Levels-of-a-Data-Frame-Object-tp3903788p3903788.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.


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

2011-10-14 Thread Peter Kaiga
i'm actually new at R, but to me its going to be big time, i want to do an
analysis for the attached data, like define variables and then analyse get
means, variances, histogram, and other important attributes including cross
tabs

Regards,
Peter
Countycode,Provincecode,Interviewercode,Locationoftowncentre:Latitude,Locationoftowncentre:Longitude,Locationoftowncentre:Altitude,Locationoftowncentre:Accuracy,Dateofstudy,Durationofbusinessoperation,Levelofeducation,Equitybankaccount,Anotherbankaccount,Visittobranch,Monthlyaveragedeposit,Distancetobranch,Preferredbranchcode,Meanoftransport,Durationtobranch,DistancetoChiefcamp,Distancetoapcamporpolicestation,Walkingdurationtochiefaporpolicestation,Drivingdurationchiefsaporpolicestation,Outletpowersource,Timesforpoweruse,Lackedelectricity,Powersourcefunding,Whentotakethefunding,Cellphonenetworks,Mostreliablenetwork,Monthlyincome,Agencyadverteffectiveness,Oralorverbalinformation,CTOVCview,viewsondistribution,Viewtowardpatneringwithbank,Equityagentoroutlet,Districtname,Towncentre
1,4,7,-1.5187021000,37.2623512000,0E-10,2804.00,Thu Oct 
06 00:00:00 UTC 
2011,5,2,1,,3,7,7,3,1,45,6,5,4,73,1,30,3,3,4,1
 2,1 2,1,1,1,They deserve,New business,Banking and 
savings,1,Machakos,Kathiani
29,8,7,null,null,null,null,Fri Oct 07 00:00:00 UTC 
2011,3,5,1,,9,5,17,49,3,30,2,5,10,15,1,30,3,1,2,1
 2 3 4,1,2,2,2,Discrimination, lack information, lack exposure,Good 
idea to transfer through equity agents,Would love to do the 
transfers,1,Nandi east,Himaki
29,8,7,null,null,null,null,Mon Oct 10 00:00:00 UTC 
2011,6,3,1,,25,35000,10,49,3,30,3,300,30,5,1,30,2,1,2,1
 3 4,1 4,3,2,1,Necessary because the people are poor,Will promote 
business attract more customers,Excellent idea take service closer to 
people,1,Central nandi,Baraton
27,8,7,null,null,null,null,Mon Oct 10 00:00:00 UTC 
2011,7,5,1,,5,1,1,30,1,5,1,300,20,5,1,30,2,1,2,1
 2,1,3,2,1,They need financial literacy,Equity will do well in 
that,Would love that since more income,1,Wareng,Eldoret town
41,5,8,-0.0963076000,34.2857898000,0E-10,3837.00,Thu Oct 
06 00:00:00 UTC 
2011,20,3,1,,30,10,1,75,1,3,1,1,30,1,1,30,4,2,null,1
 2 3 4,1,5,3,null,It is good,There is no problem,It is 
okay,1,Bondo,Bondo
41,5,8,-0.0724487000,34.2750895000,0E-10,5000.00,Thu Oct 
06 00:00:00 UTC 2011,23,3,1,,5,2,20,75,2 
3,30,3,3,60,60,5,1,30,1,1,1 2,1,5,3,1,Na,It 
will give us more customers and save time for them,It will give us more 
revenue,1,41,Got' Agulu mkt
41,5,8,-0.2684695000,34.348734,0E-10,4019.00,Thu Oct 
06 00:00:00 UTC 2011,16,2,1,2,15,15,40,75,2 
3,60,1,15,15,30,1,30,30,1,1,1 2 3 4 
5,2,5,3,null,It helps them,It will increase our customer base,It 
is good for marketing,1,Rarieda,Ragengni
42,5,8,-0.0890969000,34.6036899000,0E-10,4064.00,Fri Oct 
07 00:00:00 UTC 2011,5,3,1,2,8,20,23,29,3 
4,25,1,3,5,5,1,1,4,2,null,1 2 3 4,1 
2,5,2,1,N/a,It will bring services closer to the people,It is a 
source of income for agents,1,Kisumu  west,Holo
42,5,8,-0.0715916000,34.6584807000,0E-10,2811.00,Fri Oct 
07 00:00:00 UTC 
2011,7,3,1,,15,5,12,29,3,30,12,30,120,30,1,1,4,1,1,1
 2 3 4,1 2 3,4,2,1,No comment,It will promote local business.,It 
will make agents have more customers,1,Kisumu west,Kisian
1,4,1,-0.3277709800,36.9052373600,1953.1999511719,7.00,Thu
 Oct 06 00:00:00 UTC 
2011,null,4,1,,30,50,15,11,4,15,5,5,2,2,1,30,null,2,4,1
 2 3 4,1,null,3,1,None,None,Okay,1,Nyeri,Mweiga
null,2,1,-0.3527577000,36.9052095000,0E-10,4109.00,Fri 
Oct 07 00:00:00 UTC 
2011,null,3,1,1,30,50,5,41,1,10,3,2,2,30,1 
2,30,4,2,4,1 2 
4,1,null,3,1,null,null,Okay,1,Isiolo,Isiolo
1,2,1,-0.3527577000,36.9052095000,0E-10,4109.00,Fri Oct 
07 00:00:00 UTC 
2011,null,3,1,1,24,2,3,41,1,3,2,2,10,15,1,30,4,1,1,1
 2 3 4,1,null,2,1,null,null,Okay,1,Isiolo,Isiolo
3,6,2,-3.953335,39.7436864000,0E-10,1873.00,Fri Oct 
07 00:00:00 UTC 2011,4,3,1,2,40,120,2,119,1 
2,10,2,1,15,4,1,24,2,1,1,1 2 3 4,1,2,3,1,A 
great idea,Will ensure trust is build and work diligently,A continuity 
since they already support children,1,Kilifi,Mtwapa
3,6,2,-3.6339741000,39.8550807000,0E-10,1625.00,Thu Oct 
06 00:00:00 UTC 
2011,4,3,1,6,3,900,70,106,3,90,5,5,45,10,1,30,3,1,1,1
 2,1,5,1,1,Vulnerable and no dependants,It is okay,Nice 
idea,1,Bomba,Bomba
3,6,2,-3.9485545000,39.745171,0E-10,75.00,Fri Oct 07 
00:00:00 UTC 
2011,3,4,1,1,90,180,1,119,1,10,5,2,20,5,1,30,3,1,3,1
 2 3 4,1,3,3,1,No view,A good idea reach to people,Give 
thanks,2,Mtwapa,Mtwapa
__
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] ctest package

2011-10-14 Thread Khalek
Please send me the r package : ctest to the following e-mail

mak.sta...@gmail.com

 

Thank you.

 

 

Best regards 

MAK


[[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] Length of data.frame column

2011-10-14 Thread jawbonemurphy
Yup, DailyDiary[[1]] did it, thanks!

On Thu, Oct 13, 2011 at 11:43 PM, Jeff Newmiller [via R] 
ml-node+s789695n3903955...@n4.nabble.com wrote:

 You haven't provided a reproducible example. You haven't even provided a
 subset of your data, or the commands you used to read it in.
 I might guess that

 VAL - DailyDiary[[1]]

 might be what you wanted, and the str function might help you understand
 why. Also, the c function does not coerce object types... it embeds the
 arguments into a new vector.
 ---

 Jeff Newmiller The . . Go Live...
 DCN:[hidden email] http://user/SendEmail.jtp?type=nodenode=3903955i=0
 Basics: ##.#. ##.#. Live Go...
 Live: OO#.. Dead: OO#.. Playing
 Research Engineer (Solar/Batteries O.O#. #.O#. with
 /Software/Embedded Controllers) .OO#. .OO#. rocks...1k
 ---

 Sent from my phone. Please excuse my brevity.

 jawbonemurphy [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=3903955i=1
 wrote:

 I have a related question...I have a data frame similar with 74 rows that I

 created with header=TRUE, but when I try to coerce one of the data frame
 columns into a vector, it shows up as having length 1, even though when I
 print it, it shows 74 elements:

  VAL - c(DailyDiary[1])
  VAL
  [1] 3 3 3 2 3 3 4 4 3 3 2 1 1 4 3 3 2 3 3 2 2 3 3 3 1 2 2
 [28] 1 1 3 3 3 2 4 3 2 3 4 3 3 3 3 4 3 2 3 2 3 1 2 1 2 3 1
 [55] 0 3 2 4 3 1 2 3 1 1 1 4 3 2 1 2 3 3 3 2
 length(VAL)
 [1] 1

 On the other hand, I can easily coerce the row names to a vector of length
 74

  partf - row.names(DailyDiary)
  length(partf)
 [1] 74

 What I would like to do is make VAL into a vector with length 74 instead of

 length 1 so I can sort it using use partf as factors. I tried
 as.vector, but it doesn't let you specify the length. Any ideas? Thanks,
 and sorry if I'm being unclear or stupid, I'm a newbie :)

 Logan

 --
 View this message in context:
 http://r.789695.n4.nabble.com/Length-of-data-frame-column-tp864585p3903892.html
 Sent from the R help mailing list archive at Nabble.com.

 _

 [hidden email] http://user/SendEmail.jtp?type=nodenode=3903955i=2mailing 
 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]]

 __
 [hidden email] http://user/SendEmail.jtp?type=nodenode=3903955i=3mailing 
 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.


 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://r.789695.n4.nabble.com/Length-of-data-frame-column-tp864585p3903955.html
  To unsubscribe from Length of data.frame column, click 
 herehttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=864585code=amR1cmxhbmRzdGVyQGdtYWlsLmNvbXw4NjQ1ODV8MTg1MjIxNzE3OQ==.




--
View this message in context: 
http://r.789695.n4.nabble.com/Length-of-data-frame-column-tp864585p3903963.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] ctest package

2011-10-14 Thread Achim Zeileis

On Fri, 14 Oct 2011, Khalek wrote:


Please send me the r package : ctest to the following e-mail
mak.sta...@gmail.com


The package is in the CRAN archives, check out

  http://CRAN.R-project.org/package=ctest

Do note however the time stamps. You may also want to read FAQ 5.1.1

  http://CRAN.R-project.org/doc/FAQ/R-FAQ.html#Add_002don-packages-in-R




Thank you.





Best regards

MAK


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


Re: [R] Analysis

2011-10-14 Thread Paul Hiemstra
On 10/14/2011 06:29 AM, Peter Kaiga wrote:
 i'm actually new at R, but to me its going to be big time, i want to do an
 analysis for the attached data, like define variables and then analyse get
 means, variances, histogram, and other important attributes including cross
 tabs

Hi,

Thanks for sharing your enthousiasm for R, this is definitely the right
mailing list for that ;). But do you have a question? Before sending
one, please do check out the posting guide:


PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

regards,
Paul

 Regards,
 Peter


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


-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494

http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770


[[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] is there an option to turn off scientific notation in write.csv

2011-10-14 Thread Paul Hiemstra
On 10/14/2011 05:25 AM, Chris Conner wrote:
 Dear Help-Rs,
  
 I'm working with a file that contains large numbers and I need to export them 
 as is.  for example take:
  

 x - 
 c(27104010002005,27104020001805,27104090001810,90050013000140,90050013000120)
 y - c(1:5)
 df - data.frame(cbind(x,y))
  
 When I then try a simple:
 write.csv(df,file=df.csv)
  
 I get:
  x y
 1 2.7104E+13 1
 2 2.7104E+13 2
 3 2.71041E+13 3
 4 9.005E+13 4
 5 9.005E+13 5
  
 Then I tried:
 options(scipen=999)
 df$x - as.character(df$x)

Hi,

You can use format in this case:

df$x -format(df$x, scientific = FALSE)
write.csv(df,file=df.csv)

regards,
Paul


 write.csv(df,file=df.csv)
  
 and I still get:
  x y
 1 2.7104E+13 1
 2 2.7104E+13 2
 3 2.71041E+13 3
 4 9.005E+13 4
 5 9.005E+13 5
  
 How can I have R write the file so it looks like this:
  x y
 1 27104010002005
 2 27104020001805
 3 27104090001810
 4 90050013000140
 5 90050013000120
   [[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.


-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494

http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770


[[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] Wilcoxon and the use of simulation

2011-10-14 Thread shl2a
Dear forum users,

It's 3:35am and I am swamped with statistics homework lol
I'm terrible with R and this time I have no idea what the prof wants. Here
is the question:

Consider the (two-­‐sample) Wilcoxon rank statistic T = Σrank(Xi). For
n1=106 and n2=192, determine by simulation the α=.05 critical point for
testing H0: θ=0, H1:θ0.
We can do this as follows: 

For m=1 (no wimpy m=200 or 500 as in the book), 
draw m=1 subsets of size 106 from the integers 1:298 
using repeatedly the command 

xdat = sample(1:298, size=106). 

For each such subset, the value of the Wilcoxon is sum(xdat). Be sure to
answer the following question: why is it unnecessary to calculate ranks?

Any help would be greatly appreciately at this time.

--
View this message in context: 
http://r.789695.n4.nabble.com/Wilcoxon-and-the-use-of-simulation-tp3904036p3904036.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] Length of data.frame column

2011-10-14 Thread Petr PIKAL
Hi

 
 I have a related question...I have a data frame similar with 74 rows 
that I
 created with header=TRUE, but when I try to coerce one of the data 
frame
 columns into a vector, it shows up as having length 1, even though when 
I
 print it, it shows 74 elements:
 
  VAL - c(DailyDiary[1])
  VAL
  [1] 3 3 3 2 3 3 4 4 3 3 2 1 1 4 3 3 2 3 3 2 2 3 3 3 1 2 2
 [28] 1 1 3 3 3 2 4 3 2 3 4 3 3 3 3 4 3 2 3 2 3 1 2 1 2 3 1
 [55] 0 3 2 4 3 1 2 3 1 1 1 4 3 2 1 2 3 3 3 2
 length(VAL)
 [1] 1

your VAL is still data frame. See ?[ and link to data.frame method. Use 

str(object) 

to see the structure of your object not just printing it to console as 
print is a function which has also different methods for different objects 
and does not inform you about nature of your object.

You shall profit from reading R-intro which I believe you have overlooked. 
It shall be installed in doc/manual directory of your R installation.

Regards
Petr

 
 On the other hand, I can easily coerce the row names to a vector of 
length
 74
 
  partf - row.names(DailyDiary)
  length(partf)
 [1] 74
 
 What I would like to do is make VAL into a vector with length 74 instead 
of
 length 1 so I can sort it using use partf as factors.  I tried
 as.vector, but it doesn't let you specify the length.  Any ideas? 
Thanks,
 and sorry if I'm being unclear or stupid, I'm a newbie :)
 
 Logan
 
 --
 View this message in context: http://r.789695.n4.nabble.com/Length-of-
 data-frame-column-tp864585p3903892.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-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] verbose source command?

2011-10-14 Thread Duncan Murdoch

On 11-10-13 10:16 PM, R. Michael Weylandt wrote:

source(FILE, print.eval = TRUE)


or

source(FILE, echo = TRUE)

which will also echo the inputs - the students will find this helpful.

Duncan Murdoch



Hope this helps  good work on getting the next round of R enthusiasts
up and going!

Michael

On Thu, Oct 13, 2011 at 8:59 PM, Stephen Daviesstep...@umw.edu  wrote:

(Apologies for the n00b question.)

Hello, I'm teaching R in an introductory programming course and am walking
the students through the baby steps. One thing I'd like to be able to do is
have them copy the commands they type at the R console into a text file,
and then execute the text file to see the results. For instance, if their
session looks like this:

3+4
[1] 7
factorial(10)
[1] 3628800

I'd like for them to create a text file called myCommands.R with contents:

3+4
factorial(10)

and then run it at the R console using source(myCommands.R), and see this
output:

[1] 7
[1] 3628800

This would help with many things, including my grading their lab work.

Unfortunately, if I/they do this using the source() command as it stands,
the result is of course no output at all, because nothing is being
explicitly printed (with print() or cat() command, for example).

My question is: is there a command to do what I'm trying to do here? Is
there some kind of verbose source command (or mode) that will run a .R
script/program/file and print all the results from it exactly as if those
commands had been entered at the console?

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


__
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] binomial GLM quasi separation

2011-10-14 Thread Uwe Ligges



On 13.10.2011 21:46, Ben Bolker wrote:

lincolnmiseno77at  hotmail.com  writes:



Hi all,

I have run a (glm) analysis where the dependent variable is the gender
(family=binomial) and the predictors are percentages.
I get a warning saying fitted probabilities numerically 0 or 1 occurred
that is indicating that quasi-separation or separation is occurring.
This makes sense given that one of these predictors have a very influential
effect that is depending on a specific threshold separating these effects,
in other words in my analysis one of these variables predicts males about
the 80% of times when its values are less or equal to zero and females about
the 80% when its values are greater than zero.
I have been looking at other posts about this but I haven’t understood how I
should act when the separation (or quasi separation) is not a statistical
artifact but it is something real.
As suggested in
http://r.789695.n4.nabble.com/
  OT-quasi-separation-in-a-logistic-GLM-td875726.html#a3850331
http://r.789695.n4.nabble.com/
  OT-quasi-separation-in-a-logistic-GLM-td875726.html#a3850331


   [warning, broke URLs to make gmane happy]


(the last post is mine) I tried to use brglm procedure that uses a penalized
maximum likelihood but it made no difference.



   I'm not sure what's going on here, and I don't know why brglm()
shouldn't work ... from a squint at your Nabble post (I can't
really see the figure very well), I agree that
the hcp profile is funky, but I wouldn't immediately conclude that
the profile is bad -- in particular, it seems that the x-axis range
is -45 to -15, rather than something like (-600,-300) as I would expect
from the estimated parameter (ca. -400) and standard error (ca. 60).
I would start by setting which=3 (to confine your attention to the
hcp parameter) and messing around with the gridsize, stepsize, stdn
parameters in profileModel to see what's going on.

  If that doesn't work you might have to post data, or a subset of
data, in order to get any more help ...



Or if just the separating hyperplane is to be found (and no tests have 
to be considered), I'd use an lda rather than logistic regression in 
such a case.


Uwe Ligges



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


Re: [R] Wilcoxon and the use of simulation

2011-10-14 Thread peter dalgaard

On Oct 14, 2011, at 09:39 , shl2a wrote:

 Dear forum users,
 
 It's 3:35am and I am swamped with statistics homework lol
 I'm terrible with R and this time I have no idea what the prof wants. Here
 is the question:
 
 Consider the (two-­‐sample) Wilcoxon rank statistic T = Σrank(Xi). For
 n1=106 and n2=192, determine by simulation the α=.05 critical point for
 testing H0: θ=0, H1:θ0.
 We can do this as follows: 
 
 For m=1 (no wimpy m=200 or 500 as in the book), 
 draw m=1 subsets of size 106 from the integers 1:298 
 using repeatedly the command 
 
 xdat = sample(1:298, size=106). 
 
 For each such subset, the value of the Wilcoxon is sum(xdat). Be sure to
 answer the following question: why is it unnecessary to calculate ranks?
 
 Any help would be greatly appreciately at this time.

Well, he wants you to use your brain, not ours... This is not a list for 
helping people with their homework. Look through your teaching materials and 
notes and see if your friendly prof hasn't already provided an example of doing 
replicated simulations, drawing a histogram of the results, etc. 


-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.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] ctest package

2011-10-14 Thread Uwe Ligges



On 14.10.2011 09:26, Achim Zeileis wrote:

On Fri, 14 Oct 2011, Khalek wrote:


Please send me the r package : ctest to the following e-mail
mak.sta...@gmail.com


The package is in the CRAN archives, check out

http://CRAN.R-project.org/package=ctest

Do note however the time stamps. You may also want to read FAQ 5.1.1

http://CRAN.R-project.org/doc/FAQ/R-FAQ.html#Add_002don-packages-in-R



... and note that there was certainly a reason to remove the package 
from CRAN.


Best,
Uwe Ligges




Thank you.





Best regards

MAK


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


__
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 plot two surfaces with lattice::wireframe

2011-10-14 Thread Eik Vettorazzi
Hi Carl,
I have no idea what z or f(z) are, but maybe outer will help you:

wireframe(outer(seq(0,5,length.out=50),seq(2,4,length.out=40),function(x,y)sin(x*y)))

cheers.

Am 13.10.2011 23:37, schrieb Carl Witthoft:
 Hi all,
 I'd like to plot the Real and Imaginary parts of some f(z) as two
 different surfaces in wireframe (the row/column axes are the real and
 imag axes).  I know I can do it by, roughly speaking, something like
 
 plotz - expand.grid(x={range of Re(z)}, y={range of Im(z), groups=1:2)
 plotz$func-c(Re(f(z),Im(f(z))
 wireframe(func~x*y,data=plotz,groups=groups)
 
 But that seems like a clunky way to go, especially if I happen to have
 started out with a nice matrix of the f(z) values.
 
 So, is there some simpler way to write the formula in wireframe?  I
 envision, for a matrix of complex values zmat,  pseudocode:
 
 wireframe(c(Re(zmat),Im(zmat), groups=1:2)
 
  -- and yes, I'm fully aware that without a connection between the
 'groups' variable and zmat, this won't work as written.
 
 All suggestions (including read the help file for {some lattice func I
 didn't know about} ) greatfully accepted.
 
 Carl


-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790

--
Pflichtangaben gemäß Gesetz über elektronische Handelsregister und 
Genossenschaftsregister sowie das Unternehmensregister (EHUG):

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; 
Gerichtsstand: Hamburg

Vorstandsmitglieder: Prof. Dr. Guido Sauter (Vertreter des Vorsitzenden), Dr. 
Alexander Kirstein, Joachim Prölß, Prof. Dr. Dr. Uwe Koch-Gromus 

__
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] binomial GLM quasi separation

2011-10-14 Thread lincoln
As you suggested I had a further look at the profile by changing default
values of stepsize (I tried to modify the others but apparently there was
any change).
Here they go the scripts I have used:

 dati-read.table(simone.txt,header=T,sep=\t,as.is=T)
 glm.sat-glm(sex~twp+hwp+hcp+hnp,binomial,data=dati)
Mensajes de aviso perdidos
glm.fit: fitted probabilities numerically 0 or 1 occurred 
pp-profileModel(glm.sat,quantile=qchisq(0.95,1),objective=ordinaryDeviance,which=4)
Preliminary iteration . Done

Profiling for parameter hcp ... Done
pp1-profileModel(glm.sat,quantile=qchisq(0.95,1),objective=ordinaryDeviance,which=4,stepsize=20)
Preliminary iteration . Done

Profiling for parameter hcp ... Done
pp2-profileModel(glm.sat,quantile=qchisq(0.95,1),objective=ordinaryDeviance,which=4,stepsize=100)
Preliminary iteration . Done

Profiling for parameter hcp ... Done
plot(pp)
mtext(Default stepsize,adj=0,cex=2,line=1)
dev.new()
plot(pp)
mtext(Stepsize=20,adj=0,cex=2,line=1)
dev.new()
plot(pp)
mtext(Stepsize=100,adj=0,cex=2,line=1)

And these are the plots as they look like:
http://r.789695.n4.nabble.com/file/n3904261/plot1.png 
http://r.789695.n4.nabble.com/file/n3904261/plot2.png 
http://r.789695.n4.nabble.com/file/n3904261/plot3.png 

I have tried to understand what is going on but I don't know how to
interpret this.
It's quite a long time that I am trying to solve this but I have not been
able to. Here (  http://r.789695.n4.nabble.com/file/n3904261/simone.txt
simone.txt  ) I attach a subset of the data I am working with that comprises
the variables specified in the above glm model and by the way the funky
variable called hcp.
Thank you for take your time to help me in this.

--
View this message in context: 
http://r.789695.n4.nabble.com/binomial-GLM-quasi-separation-tp3901687p3904261.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] Generating Data

2011-10-14 Thread Muhammed Rauf Ahmad
Dear All

I need to generate multivariate NON-NORMAL data in R, which follows a
given mean vector and covariance matrix, say multivariate exponential
data. How can I do that?

Best regards
mra

__
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] [Related Topic] need help on read.spss

2011-10-14 Thread Uwe Ligges

On 13.10.2011 18:28, Matt Shotwell wrote:

Would it be worthwhile to update the read.spss implementation using the
more recent discoveries from the PSPP group?


If there are important features, I think so. Getting code into foreign 
is not too trivial. Smaller changes are more likely to be accepted than 
a re-implementation which would need really careful and extensive tests.
Note also this won't resolve the underlying problem I described in my 
last message.


 I don't mean to copy their code;

Iff the code is reasonable, why not talk to the PSPP people, take the 
code and adapt it, given it is GPL'ed.




but to use the ideas in their code. Is anyone working on this? I
wouldn't want the effort to be duplicated.


Not that I know, at least.

Best,
Uwe Ligges





On Thu, 2011-10-13 at 16:22 +0200, Uwe Ligges wrote:


On 11.10.2011 12:07, Smart Guy wrote:

Hi,
I have one doubt about one of the parameter of 'read.spss()' from
'foreign' package.
Here is the syntax :-

read.spss ( file,
  use.value.labels = TRUE,
  to.data.frame = FALSE,
  max.value.labels = Inf,
  trim.factor.names = FALSE,
  trim_values = TRUE,
  reencode = NA,
  use.missings = to.data.frame )


In above syntax when I pass *'to.data.frame= FALSE*' it gives me missing
values from SPSS file (that I try to read using read.spss() ). But when I
pass '*to.data.frame = TRUE*' then its not giving me missing values. And
need to get missing values.

According to read.spss() documentation

*to.data.frame :  return a data frame?*

I am curious to know, if we pass *'to.data.frame = TRUE*' , is it going to
cause some issue or effect something? I didn't understand the read.spss()
documentation correctly.
Please explain.

Thanks in Advance



An R data.frame cannot represent different kinds of missing values,
since R just has NA. Therefore, there are two way to import data:

to.data.frame=FALSE  will read all the information, but into a format
you will likely have to postprocess to make it conveniently usable.

to.data.frame=TRUE   will import into a data.frame, but that cannot
represent all the nuances known from the SPSS representation.

Uwe Ligges

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


Re: [R] Fitting a Harmonic Function to Time Series Data

2011-10-14 Thread David Scott

On 14/10/2011 1:00 a.m., ashz wrote:

Dear All,

I have some time series data where X=month and Y=nutrient concentration (I
can have several concentration data for one month). Is there a way to fit
for it an Harmonic Function. Is there a package, script,etc which I can use?

Thx




Possibly there is this functionality in Rob Hyndman's forecast package. 
See this post by him:

http://robjhyndman.com/researchtips/longseasonality/
which has some code which should also be of use.

David Scott


_
David Scott Department of Statistics
The University of Auckland, PB 92019
Auckland 1142,NEW ZEALAND
Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055
Email:  d.sc...@auckland.ac.nz,  Fax: +64 9 373 7018

__
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 symbols (line, points) in one column.

2011-10-14 Thread Kenneth Roy Cabrera Torres
Hi David:

Thank you for your answer.

El vie, 14-10-2011 a las 00:32 -0400, David Winsemius escribió:
 Legends are built in columns. You need to find a graphics symbol to  
 put in the points column or you need to find something that the  
 lines paramater will turn into a dot (and I'm not sure what that might  
 be.) My suggestion would be to change the line type to dashed and use  
  - - - for the pch argument.

No, because I want a continous line for the model.
But the data as points, and in the legend to identify each one
as the example shows but in only in one column in the legend!.

 
 This is what I came up with using the panel.lmline rather than  
 building it outside the plotting function:

If the model is a linear one, it is fine, but the model could 
be a complex one that it is not programmed as panel.xxmodel, or else.

Thank you very much for your interest in finding the solution.


 x-1:5
 y-1*x+rnorm(10)
 data1-data.frame(x,y,type=rep(data,length(x)))
 
 require(lattice)
 
 xyplot(y~x,group=type,
   type=c(p,l), lty=3, lwd=2, cex=4,
   key=list(space=right,text=list(c(Data,Model)),
 points=list(pch = c(., -),cex=c(4,1.5))  ),
   par.settings=confMisc1,
   panel=function(x,y,...){panel.xyplot(x,y,...)
   panel.lmline(x,y,...)},
   distribute.type=TRUE,
   data=data1)


__
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] Minimum cutsets

2011-10-14 Thread malhomidi

Hi,

   Thank you David and Michael for your suggestions and comments. I'll try
to get the binary version of the package. I'm just waiting for Gabor to let
me know about the development package which works on Windows.

Regards,
Mohammed 

--
View this message in context: 
http://r.789695.n4.nabble.com/Minimum-cutsets-tp885346p3904424.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] binomial GLM quasi separation

2011-10-14 Thread Gavin Simpson
On Fri, 2011-10-14 at 02:32 -0700, lincoln wrote:
 As you suggested I had a further look at the profile by changing default
 values of stepsize (I tried to modify the others but apparently there was
 any change).

Have you read ?glm, specifically this bit:

Details:



 For the background to warning messages about ‘fitted probabilities
 numerically 0 or 1 occurred’ for binomial GLMs, see Venables 
 Ripley (2002, pp. 197-8).

There, VR say (me paraphrasing) that if there are some large fitted
\beta_i the curvature of the log-likelihood at the fitted \beta can be
much less than at \beta_i = 0. The Wald approximation underestimates the
change in the LL on setting \beta_i = 0. As the absolute value of the
fitted \beta_i becomes large (tends to infinity) the t statistic tends
to 0. This is the Hauck Donner effect.

Whilst I am (so very) far from being an expert here - this does seem to
fit the results you showed.

Furthermore, did you follow the steps Ioannis Kosmidis took me through
with my data in that email thread? I have with your data and everything
seems to follow the explanation/situation given by Ioannis. Namely, if
you increase the number of iterations and tolerance in the glm() call
you get the same fit as with a standard glm() call:

 ## normal glm()
 summary(mod)

Call:
glm(formula = sex ~ twp + hwp + hcp + hnp, family = binomial, 
data = dat)

Deviance Residuals: 
Min   1Q   Median   3Q  Max  
-2.9703  -0.1760   0.3181   0.6061   3.5235  

Coefficients:
 Estimate Std. Error z value Pr(|z|)
(Intercept)1.4362 0.2687   5.345 9.02e-08 ***
twp5.5673 1.3602   4.093 4.26e-05 ***
hwp   -4.2793 2.3781  -1.799   0.0719 .  
hcp -450.191856.6823  -7.942 1.98e-15 ***
hnp   -4.5302 3.2825  -1.380   0.1676
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 581.51  on 425  degrees of freedom
Residual deviance: 294.00  on 421  degrees of freedom
  (41 observations deleted due to missingness)
AIC: 304

Number of Fisher Scoring iterations: 8

 ## now with control = glm.control(epsilon = 1e-16, maxit = 1000)
 ## in the call
 summary(mod3)

Call:
glm(formula = sex ~ twp + hwp + hcp + hnp, family = binomial, 
data = dat, control = glm.control(epsilon = 1e-16, maxit = 1000))

Deviance Residuals: 
Min   1Q   Median   3Q  Max  
-2.9703  -0.1760   0.3181   0.6061   3.5235  

Coefficients:
 Estimate Std. Error z value Pr(|z|)
(Intercept)1.4362 0.2687   5.345 9.02e-08 ***
twp5.5673 1.3602   4.093 4.26e-05 ***
hwp   -4.2793 2.3781  -1.799   0.0719 .  
hcp -450.191856.6823  -7.942 1.98e-15 ***
hnp   -4.5302 3.2825  -1.380   0.1676
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 581.51  on 425  degrees of freedom
Residual deviance: 294.00  on 421  degrees of freedom
  (41 observations deleted due to missingness)
AIC: 304

Number of Fisher Scoring iterations: 9

From the thread you link to, we would expect the effects to diverge.

Profiling the model shows that the LL starts to increase again at low
values, but does so slowly. The LL is very flat around the estimates and
is far from 0, which seems to correspond with the description of the
Hauck Donner effect given By Venables and Ripley in their book. In your
case however, the statistic is still sufficiently large for it to be
identified as significant via the Wald test.

If we fit the model via brglm() we get essentially the same result as
fitted by glm():

 summary(mod2)

Call:
brglm(formula = sex ~ twp + hwp + hcp + hnp, family = binomial, 
data = dat)


Coefficients:
 Estimate Std. Error z value Pr(|z|)
(Intercept)1.4262 0.2662   5.357 8.47e-08 ***
twp5.3696 1.3323   4.030 5.57e-05 ***
hwp   -4.2813 2.3504  -1.821   0.0685 .  
hcp -435.921255.0566  -7.918 2.42e-15 ***
hnp   -4.6295 3.2459  -1.426   0.1538
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 560.48  on 425  degrees of freedom
Residual deviance: 294.08  on 421  degrees of freedom
Penalized deviance: 302.8212 
  (41 observations deleted due to missingness)
AIC:  304.08

Ioannis points out that if there were separation, the brglm results
would differ markedly from the glm() ones, and they don't.

As Ioannis mentioned in that thread, you can get the warning about the
fitted probabilities without a separation problem - In my case it was
because there were some very small fitted probabilities, which R was
just warning about.

HTH

G

 Here they go the scripts I have used:
 
  dati-read.table(simone.txt,header=T,sep=\t,as.is=T)
  

Re: [R] getting data associated with coordinates in a spatial data frame

2011-10-14 Thread jon . skoien

On 13-Oct-11 20:33, Sarah Goslee wrote:

Hi,

On Thu, Oct 13, 2011 at 2:05 PM, Bailey, Danielbai...@spu.edu  wrote:

Thank you Sarah. I tried your suggestion, and if I coerce it into a normal data.frame, that method works. But if you've 
already made the data into a SpatialPixelsDataFrame and run coordinates (both from the package sp) so that 
the columns x and y become a single column coordinates with the format (0, 17) for 
x and y, how do you then call or manipulate data at a specific location?

The following:
e[e$coordinates==(0,17),]
Doesn't work.

They don't become a single column but rather a single matrix with
two columns, and (0, 17) isn't the correct way to specify a vector.
You can identify particular coordinates using the form I offered
earlier, and then use that to subset the data slot of your SGPF.

Using built-in data:

library(sp)
data(meuse.grid)
m = SpatialPixelsDataFrame(points = meuse.grid[c(x, y)], data = meuse.grid)
m@data[coordinates(m)[,x] == 181100  coordinates(m)[,y] == 333660,]

There ought to be a more elegant way to match coordinates (other than
the do.call() and paste() approach), but I'm not sure what it is.


Not sure if it is nicer, but another possibility is:
data(meuse.grid)
coordinates(meuse.grid) = ~x+y
meuse.grid@data[which(duplicated(rbind(c(181100, 333660), 
coordinates(meuse.grid-1,]  = factor(c(1,2,3,4,1))


To avoid numerical problems, you can also find the data of the location 
closest to the point you are interested in:
meuse.grid@data[which.min(spDistsN1(meuse.grid, c(181100, 333660))),] = 
factor(c(1,1,1,1,1))


For questions about spatial data you can also use the mailing-list 
r-sig-geo.


Cheers,
Jon

__
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] Compiling R extension: undefined reference to `__mingw_vsprintf'

2011-10-14 Thread Gavan McGrath
I'm trying to link a hydrological model in FORTRAN with R.
I have a subroutine inside wetall.f90 which calls two contained functions.
When I try
rcmd SHLIB -o wetall.dll wetall.f90
I get a bunch of errors stating undefined reference to `__mingw_vsprintf' from 
dos (see below).
When the same is run from cygwin the dll is compiled but hangs R when 
dyn.load(ed)

The code does not do any I/O so the errors seem unusual.  Any suggestions?


Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C: \wetland_testrcmd SHLIB -o wetall2.dll wetall.f90
gfortran -shared -s -static-libgcc -o wetall2.dll tmp.def wetall.o 
-LC:/PROGRA~1/R/R-212~1.1/bin/i386 -lR
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(unix.o):(.text$sprintf+0x1b):
 undefined reference to `__mingw_vsprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(main.o):(.text$sprintf+0x1b):
 undefined reference to `__mingw_vsprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(format.o):(.text$sprintf+0x1b):
 undefined reference to `__mingw_vsprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(transfer.o):(.text$sprintf+0x1b):
 undefined reference to `__mingw_vsprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$sprintf+0x1b):
 undefined reference to `__mingw_vsprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$nml_read_obj.clone.1+0x199):
 undefined reference to `__mingw_snprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$nml_read_obj.clone.1+0x345):
 undefined reference to `__mingw_snprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$nml_get_obj_data.clone.0+0x4ab):
 undefined reference to `__mingw_snprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$nml_get_obj_data.clone.0+0x56b):
 undefined reference to `__mingw_snprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$nml_get_obj_data.clone.0+0x602):
 undefined reference to `__mingw_snprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(list_read.o):(.text$nml_get_obj_data.clone.0+0x69c):
 more undefined references to `__mingw_snprintf' follow
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(write.o):(.text$sprintf+0x1b):
 undefined reference to `__mingw_vsprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(write.o):(.text$output_float.clone.5+0x536):
 undefined reference to `__mingw_snprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(write.o):(.text$write_float+0xf9):
 undefined reference to `__mingw_snprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(write.o):(.text$write_float+0x18d):
 undefined reference to `__mingw_snprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(write.o):(.text$write_float+0x36e):
 undefined reference to `__mingw_snprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(open.o):(.text$sprintf+0x1b):
 undefined reference to `__mingw_vsprintf'
c:/rtools/mingw/bin/../lib/gcc/mingw32/4.5.0/libgfortran.a(open.o):(.text$__gfortrani_new_unit+0x560):
 undefined reference to `__mingw_snprintf'
collect2: ld returned 1 exit status


[[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] Length of data.frame column

2011-10-14 Thread David Winsemius


On Oct 14, 2011, at 5:11 AM, Petr PIKAL wrote:


Hi



I have a related question...I have a data frame similar with 74 rows

that I

created with header=TRUE, but when I try to coerce one of the data

frame
columns into a vector, it shows up as having length 1, even though  
when

I

print it, it shows 74 elements:


VAL - c(DailyDiary[1])
VAL
[1] 3 3 3 2 3 3 4 4 3 3 2 1 1 4 3 3 2 3 3 2 2 3 3 3 1 2 2

[28] 1 1 3 3 3 2 4 3 2 3 4 3 3 3 3 4 3 2 3 2 3 1 2 1 2 3 1
[55] 0 3 2 4 3 1 2 3 1 1 1 4 3 2 1 2 3 3 3 2

length(VAL)

[1] 1


your VAL is still data frame. See ?[ and link to data.frame  
method. Use


str(object)


Or at least a list. The c function stripped its attributes:

 str( c( data.frame(a=1:10) ) )
List of 1
 $ a: int [1:10] 1 2 3 4 5 6 7 8 9 10

Which also is an explanation for why its length is still reported as 1.



to see the structure of your object not just printing it to console as
print is a function which has also different methods for different  
objects

and does not inform you about nature of your object.

You shall profit from reading R-intro which I believe you have  
overlooked.

It shall be installed in doc/manual directory of your R installation.

Regards
Petr



On the other hand, I can easily coerce the row names to a vector of

length

74


partf - row.names(DailyDiary)
length(partf)

[1] 74

What I would like to do is make VAL into a vector with length 74  
instead

of

length 1 so I can sort it using use partf as factors.  I tried
as.vector, but it doesn't let you specify the length.  Any ideas?


One might think that as.vector might be able to extract a vector from  
a list if length 1 but one would be wrong and should then got to :


?unlist




Thanks,

and sorry if I'm being unclear or stupid, I'm a newbie :)

Logan


David Winsemius, MD
West Hartford, CT

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


[R] quantile function nonlinear in parameters.

2011-10-14 Thread Julia Lira






Dear all,

I need to run a quantile regression to estimate the coefficients of the 
following model: Q_{Y}(τ|X)=exp(β₀(τ)+X′β₁(τ)).
Since the model is nonlinear, I need to use nlrq(.). However, if I try 
nlrq(Y~exp(X), tau=τ), the software does not accept and also does not 
understand that my coefficients are inside the exponential. The software would 
allow me to run rq(Y~exp(X), tau=τ) since it would understand that beta is 
outside exp(X).

I could not find one way to write my model in a proper way in the software. Can 
someone help me? Sorry if this is too stupid and I haven't see it yet.

Thanks a lot,

Julia

  
[[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 plot two surfaces with lattice::wireframe

2011-10-14 Thread Carl Witthoft
No, the point of my question is how to plot the Re and Im parts as two 
separate surfaces in one chart.


On 10/14/11 5:46 AM, Eik Vettorazzi wrote:

Hi Carl,
I have no idea what z or f(z) are, but maybe outer will help you:

wireframe(outer(seq(0,5,length.out=50),seq(2,4,length.out=40),function(x,y)sin(x*y)))

cheers.

Am 13.10.2011 23:37, schrieb Carl Witthoft:

Hi all,
I'd like to plot the Real and Imaginary parts of some f(z) as two
different surfaces in wireframe (the row/column axes are the real and
imag axes).  I know I can do it by, roughly speaking, something like

plotz- expand.grid(x={range of Re(z)}, y={range of Im(z), groups=1:2)
plotz$func-c(Re(f(z),Im(f(z))
wireframe(func~x*y,data=plotz,groups=groups)

But that seems like a clunky way to go, especially if I happen to have
started out with a nice matrix of the f(z) values.

So, is there some simpler way to write the formula in wireframe?  I
envision, for a matrix of complex values zmat,  pseudocode:

wireframe(c(Re(zmat),Im(zmat), groups=1:2)

  -- and yes, I'm fully aware that without a connection between the
'groups' variable and zmat, this won't work as written.

All suggestions (including read the help file for {some lattice func I
didn't know about} ) greatfully accepted.

Carl





--
-
Sent from my Cray XK6

__
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] Split a list

2011-10-14 Thread Juliet Ndukum
I have a list of dataframes i.e. each list element is a dataframe with three 
columns and differing number of rows. The third column takes on only two 
values. I wish to split the list into two sublists based on the value of the 
third column of the list element. 
Second issue with lists as well. I would like to reduce each of the sublist 
based on the range of the second column, i.e. if the range of the second column 
is greater than twenty for example keep the list element.

Could someone help me with a code to implement these two issues. Thanks in 
advance for your help,
JN
[[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] Split a list

2011-10-14 Thread Weidong Gu
It would be nice if you could provide a sample. However, if the data
in the list have the same colnames, you can combine them by

df-do.call('rbind',your_list_data_frame)

Then you can do what you want on the dataframe instead of a list

HTH

Weidong Gu


On Fri, Oct 14, 2011 at 9:06 AM, Juliet Ndukum jpnts...@yahoo.com wrote:
 I have a list of dataframes i.e. each list element is a dataframe with three 
 columns and differing number of rows. The third column takes on only two 
 values. I wish to split the list into two sublists based on the value of the 
 third column of the list element.
 Second issue with lists as well. I would like to reduce each of the sublist 
 based on the range of the second column, i.e. if the range of the second 
 column is greater than twenty for example keep the list element.

 Could someone help me with a code to implement these two issues. Thanks in 
 advance for your help,
 JN
        [[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.


Re: [R] Split a list

2011-10-14 Thread R. Michael Weylandt
Comments inline:

On Fri, Oct 14, 2011 at 9:06 AM, Juliet Ndukum jpnts...@yahoo.com wrote:
 I have a list of dataframes i.e. each list element is a dataframe with three 
 columns and differing number of rows. The third column takes on only two 
 values. I wish to split the list into two sublists based on the value of the 
 third column of the list element.

Assuming the third column always takes a constant value for each
data.frame, something this will work:

lst - list(a = data.frame(1:3, 4:6, 7), b = data.frame(1:3, 4:6, 8),
c = data.frame(1:3, 4:6, 7))
idx - sapply(lst, function(x) x[1,3] == 7)

lst1 = lst[idx]
lst2 = lst[!idx]


 Second issue with lists as well. I would like to reduce each of the sublist 
 based on the range of the second column, i.e. if the range of the second 
 column is greater than twenty for example keep the list element.

Similar line of argument:

idx - sapply(lst, function(x) range(x[,2])  20)
lst1 = lst[idx]


 Could someone help me with a code to implement these two issues. Thanks in 
 advance for your help,
 JN
        [[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.


Re: [R] Split a list

2011-10-14 Thread David Winsemius


On Oct 14, 2011, at 9:26 AM, Weidong Gu wrote:


It would be nice if you could provide a sample.


That is certainly true.


However, if the data
in the list have the same colnames, you can combine them by

df-do.call('rbind',your_list_data_frame)

Then you can do what you want on the dataframe instead of a list

HTH

Weidong Gu


On Fri, Oct 14, 2011 at 9:06 AM, Juliet Ndukum jpnts...@yahoo.com  
wrote:
I have a list of dataframes i.e. each list element is a dataframe  
with three columns and differing number of rows. The third column  
takes on only two values. I wish to split the list into two  
sublists based on the value of the third column of the list element.


Perhaps something like:
list_of_firsts - lapply(dflist, function(x) X[ , X[,3]==first] )
list_of_seconds - lapply( dflist, function(x) X[ , X[,3]==second])

Ow with subset (but without that missing example it is more difficult  
to show the true value of subset:


subset(X, select= X[,3]==first)


Second issue with lists as well. I would like to reduce each of the  
sublist based on the range of the second column, i.e. if the range  
of the second column is greater than twenty for example keep the  
list element.


Same as above with an inequality sign.



Could someone help me with a code to implement these two issues.  
Thanks in advance for your help,

JN
   [[alternative HTML version deleted]]





David Winsemius, MD
West Hartford, CT

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


Re: [R] Generating Data

2011-10-14 Thread R. Michael Weylandt
See Duncan Murdoch's post here for some pointers as well as an
explanation of why this isn't a totally well-formed question:

http://r.789695.n4.nabble.com/generate-two-sets-of-random-numbers-that-are-correlated-td3736161.html

(Specifically, the post at 1:33, but it may be worthwhile to read the
whole thread)

Michael

On Fri, Oct 14, 2011 at 5:51 AM, Muhammed Rauf Ahmad mu...@mai.liu.se wrote:
 Dear All

 I need to generate multivariate NON-NORMAL data in R, which follows a
 given mean vector and covariance matrix, say multivariate exponential
 data. How can I do that?

 Best regards
 mra

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


Re: [R] pgfSweave-example not compiling

2011-10-14 Thread Yihui Xie
Yes, it is a little bit amazing to me too, so let's cc to the package
maintainer to see if he can do anything.

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



On Fri, Oct 14, 2011 at 12:06 AM, Peter Meilstrup
peter.meilst...@gmail.com wrote:
 Thanks, that lets me move to the next step in figuring out what's
 wrong with my document :) Funny enough that's not the first problem
 I've had with Sweave and non-ascii characters.

 Peter

 On Thu, Oct 13, 2011 at 7:30 PM, Yihui Xie x...@yihui.name wrote:
 OK, that is really helpful for diagnosis. In line 436 of your tex
 file, there is an NA, but it should really be this:

 }% this brace ends the effect of ‘include external’

 So the reason for LaTeX failure was this missing bracket }. And the
 reason for R to output NA here is most likely to be that in the LaTeX
 comment here, there are curly quotes, which are not ASCII characters.
 To solve the problem, you can either delete these non-ASCII
 characters, or tell Sweave that your encoding is not latin1, but UTF8.
 The latter way may not be directly possible, and this is why I brought
 up the issue to pgfSweave developers:
 https://github.com/cameronbracken/pgfSweave/issues/34

 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA



 On Thu, Oct 13, 2011 at 8:34 PM, Peter Meilstrup
 peter.meilst...@gmail.com wrote:
 Sure, here's the generated .tex file:
 http://pastebin.com/b9fTsr0h

 Peter

 On Thu, Oct 13, 2011 at 6:14 PM, Yihui Xie x...@yihui.name wrote:
 Seems to be weird. I can run the example smoothly under Ubuntu with R
 2.13.2. Could you also post your .tex file?

 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-2465 Web: http://yihui.name
 Department of Statistics, Iowa State University
 2215 Snedecor Hall, Ames, IA



 On Thu, Oct 13, 2011 at 7:01 PM, Peter Meilstrup
 peter.meilst...@gmail.com wrote:
 I'm trying to get pgfSweave up and running. Hopefully I can get it
 working from within LyX, but first I'm just trying to get the simplest
 possible thing (compiling one of the example files in the pgfSweave
 package) to work. I'm using the example that comes in the pgfSweave
 package unmodified, but for reference I copied it to:

 http://pastebin.com/tW4RL6fs

 Configuration:
 R version 2.13.1 on OS X (intel) 10.5.8
 pgfSweave package version 1.2.1
 tikzDevice version 0.6.1
 MacTeX 2011 installed
 tikz/pgf package version 2.10

 Here is what I tried; I copied the file pgfSweave-example.Rnw into my
 working directory, created a cache dir and ran:

 require(pgfSweave)
 pgfSweave(pgfSweave-example.Rnw)

 This did some computation and then complained about a missing bracket:

 ! Missing } inserted.
 inserted text
                 }
 l.439 \end{figure}

 After I dismissed this, it seemed to fail with various errors.

 make: *** [pgfSweave-example-boxplot.pdf] Error 1
 Error in tools::texi2dvi(paste(fn, tex, sep = .), pdf = pdf, ...) :
   Running 'texi2dvi' on 'pgfSweave-example.tex' failed.
 LaTeX errors:
 ! Package tikz Warning: Some images are not up-to-date and need to be 
 generated
 .  [1

 Rerunning pgfSweave led to the same errors.
 The process created a .pdf file, but in place of a figure it has the 
 notice:

 [[ Image Discarded Due To ‘/tikz/external/mode=list and make’ ]] NA  

 Upon inspecting the log file I found this notice:

 = mode=`list and make': Use 'make -f pgfSweave-example.makefile' to 
 generat
 e all images. Then, re-run (pdf)latex pgfSweave-example. =

 I tried following this instruction, but it also produced an error:

 bayanus-2:writing peter$ make -f pgfSweave-example.makefile
 pdflatex -halt-on-error -interaction=batchmode -jobname
 pgfSweave-example-boxplot
 \def\tikzexternalrealjob{pgfSweave-example}\input{pgfSweave-example}
 This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
  restricted \write18 enabled.
 entering extended mode
 make: *** [pgfSweave-example-boxplot.pdf] Error 1

 I put the full R transcript at http://pastebin.com/aZECxKyP in case
 that contains additional useful information.
 I also put the contents of pgfSweave-example.log at
 http://pastebin.com/LzZW1z3R .
 Also pgfSweave-example-boxplot.log at http://pastebin.com/AF3TCCEK .

 What's going wrong?
 Cheers,
 Peter

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

[R] qcc package

2011-10-14 Thread Li, Yan
Hi All,

I installed qcc package and the dependency packages. For the first time I can 
use the function : process.capability.sixpack(). But later when ran the code 
again I always got the following error: Error: could not find function 
process.capability.sixpack. I tried reinstalling the qcc package but didn't 
help. Does anyone have this kind of experience? Thank you!

Regards,
Yan


[[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] qcc package

2011-10-14 Thread R. Michael Weylandt
Did you reload the package for each new session? Sounds like you are
probably missing a line like library(qcc) or require(qcc)

Michael

On Fri, Oct 14, 2011 at 11:10 AM, Li, Yan yan...@ibi.com wrote:
 Hi All,

 I installed qcc package and the dependency packages. For the first time I can 
 use the function : process.capability.sixpack(). But later when ran the code 
 again I always got the following error: Error: could not find function 
 process.capability.sixpack. I tried reinstalling the qcc package but didn't 
 help. Does anyone have this kind of experience? Thank you!

 Regards,
 Yan


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


Re: [R] qcc package

2011-10-14 Thread R. Michael Weylandt
Apologies for my brief reply -- I didn't take the time to examine the
package closely.

On a fresh install, I don't see process.capability.sixpack() as an
available function and process.capability() isn't a generic so it's
not that sort of thing. Looking at the package index, there's no
indication such a thing exists, though perhaps it did in an older
version of the package.

Do you have a citation for this function? I don't see one in the
official CRAN description...

Michael

On Fri, Oct 14, 2011 at 11:25 AM, Li, Yan yan...@ibi.com wrote:
 Yes, I did everytime. And the other functions: qcc(), process.capability() 
 works. Thank you for your reply!

 -Original Message-
 From: R. Michael Weylandt [mailto:michael.weyla...@gmail.com]
 Sent: Friday, October 14, 2011 11:22 AM
 To: Li, Yan
 Cc: r-help@r-project.org
 Subject: Re: [R] qcc package

 Did you reload the package for each new session? Sounds like you are
 probably missing a line like library(qcc) or require(qcc)

 Michael

 On Fri, Oct 14, 2011 at 11:10 AM, Li, Yan yan...@ibi.com wrote:
 Hi All,

 I installed qcc package and the dependency packages. For the first time I 
 can use the function : process.capability.sixpack(). But later when ran the 
 code again I always got the following error: Error: could not find function 
 process.capability.sixpack. I tried reinstalling the qcc package but 
 didn't help. Does anyone have this kind of experience? Thank you!

 Regards,
 Yan


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


[R] non-parametric permutation and signed paired-difference distributions

2011-10-14 Thread Michael Friendly

Hi all
Consider the classic data below from Darwin on the heights of 15 pairs 
of zea mays (corn) plants
either cross-fertilized or self-fertilized, where the goal is to see if 
it makes a difference.


 head(ZeaMays)
  pair pot  cross   self   diff
11   1 23.500 17.375  6.125
22   1 12.000 20.375 -8.375
33   1 21.000 20.000  1.000
44   2 22.000 20.000  2.000
55   2 19.125 18.375  0.750
66   2 21.500 18.625  2.875
...

I'd like to illustrate two types of non-parametric tests of whether the 
mean(diff) = 0.


(a) Permutation test, where the values of, say self are permuted and 
diff=cross - self
is calculated for each permutation.  There are 15! permutations, but a 
reasonably

large number of random permutations would suffice.

(b) Test based on assigning each abs(diff) a + or - sign, and 
calculating the mean(diff).
There are 2^15 such possible values, but again, a reasonably large 
number of random

samples would do.

This is obviously a case for apply and friends, but I can't quite see 
how to set it up.


The complete data:

 dput(ZeaMays)
structure(list(pair = 1:15, pot = structure(c(1L, 1L, 1L, 2L,
2L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L), .Label = c(1,
2, 3, 4), class = factor), cross = c(23.5, 12, 21, 22,
19.125, 21.5, 22.125, 20.375, 18.25, 21.625, 23.25, 21, 22.125,
23, 12), self = c(17.375, 20.375, 20, 20, 18.375, 18.625, 18.625,
15.25, 16.5, 18, 16.25, 18, 12.75, 15.5, 18), diff = c(6.125,
-8.375, 1, 2, 0.75, 2.875, 3.5, 5.125, 1.75, 3.625, 7, 3, 9.375,
7.5, -6)), row.names = c(NA, -15L), .Names = c(pair, pot,
cross, self, diff), class = data.frame)



-- Michael Friendly Email: friendly AT yorku DOT ca Professor, 
Psychology Dept. York University Voice: 416 736-5115 x66249 Fax: 416 
736-5814 4700 Keele Street Web: http://www.datavis.ca Toronto, ONT M3J 
1P3 CANADA


__
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] boxplot

2011-10-14 Thread R. Michael Weylandt
A few things in play here:

1) I'm guessing you are new to R, so I'd advise you to take some time
to read some introductory materials at this point. If you type
help.start() into your R session, a good introductory manual will be
available.

2) You don't need any of this textConnection business, that's just
one way of reading in data from an email. If you are reading in your
data via read.table() you don't need anything else.

3) Your code should perhaps look something like this, but I can't be
certain without an actual sample of your data:

lista - read.table(lista.txt,header=T,dec=,)
vit-subset(lista, (lista$familia == Vittariaceae) ,
select=c(ingreso, familia,
genero,categoria,ira5,ira6,ira7,ira8,ira9,ira10,irah5,irah6,irah7,irah8,irah9,irah10,ed5))
boxplot( t(vit[grepl(ira,rownames(vit)),]), col =
ifelse(vit[,NCOL(vit)] == C, 2,3))

but at this point, I'd spend some a little more time learning how to
manipulate and subset in R before trying to handle this finer sort of
detail. I'll quickly parse that last line for you, though, just in
case this is a time sensitive project:

working from the inside out:

grepl(ira, rownames(vit)) # Identify those rows that have ira in the name
vit[grepl(ira, rownames(vit)),] # Select only those rows from vit
t( ) # transpose since boxplot takes in columns (see my above note)

vit[,NCOL(vit)] # isolate the last column
 ** == C # Test for being of type C
ifelse( **, 2, 3) ## assign either a two or a three depending whethere
it was a C or not
col = # color the boxplots

4) On another note, are you sure you want to do your boxplots rowwise?
It's pretty standard in R that columns represent similar data while
rows are independent measurements/observations.

5) And just for the record, the error you got is because you passed
boxplot something that wasn't a data object, but rather an empty
textConnection().

Hope this helps,

Michael

PS -- It's good form (and usually more helpful to you) to cc the whole
list on each step of the correspondance. It lets other voices chime in
if I start leading you astray as well as ensuring that there are
replies coming even at all hours of the day since R-help has a
world-wide readership. Also, it makes sure everything gets archived
nicely so someone can read them in the future.


On Fri, Oct 14, 2011 at 9:19 AM, Ruth Arias rueu...@yahoo.es wrote:
 thanks for answer me michel

 I made some modifications to your suggestion.
 I have tried this:
 lista - read.table(lista.txt,header=T,dec=,)
 vit-subset(lista, (lista$familia == Vittariaceae) , select=c(ingreso,
 familia,
 genero,categoria,ira5,ira6,ira7,ira8,ira9,ira10,irah5,irah6,irah7,irah8,irah9,irah10,ed5))
 vitbp-textConnection(vit)
 closeAllConnections()
 boxplot(vitbp[,1:5], col = ifelse(V[,6] == C, 2,3))
 and I have this answer:
 Error en plot.window(xlim = xlim, ylim = ylim, log = log, yaxs = pars$yaxs)
 :
   se necesitan valores finitos de 'ylim' = needs finite values
 Además: Mensajes de aviso perdidos = also: message
 1: In min(x) : ningún argumento finito para min; retornando Inf = no finite
 argument for minimun
 2: In max(x) : ningun argumento finito para max; retornando -Inf = no finite
 argument for maximun

 and what I want is to make a box plot to let me see the differences in
 different iras (ira5, ira6 ...) between the category C and E



 I'm not sure what the column to identify other the other columns
 maps to graphically, but perhaps something like this will get you
 started

 V - read.table(textConnection(
 4        5        6        7        8        site
 23    56        41      45    63        C

 21    89        42      10  63        E

 32    45        14      17    96        E

 45    74        13      63    41        C

 68    32        10      20    03        E

 95    10        84    45    96        C
 ),header=TRUE)
 closeAllConnections()

 boxplot(V[,1:5], col = ifelse(V[,6] == C, 2,3))


 Michael

 On Thu, Oct 13, 2011 at 5:54 PM, Ruth Arias rueu...@yahoo.es wrote:
 hello

 I want to make a boxplot with diferents rows and also include a column to
 sort into two groups to each of the other columns

 my  date set looks like this:

 4        5        6        7        8        site
 23    56        41      45    63         C

 21    89        42      10   63        E

 32    45        14  17    96        E

 45    74        13      63    41        C

 68    32        10  20    03        E

 95    10        84    45    96        C

 THANKS

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

[R] Party package: varimp(..., conditional=TRUE) error: term 1 would require 9e+12 columns

2011-10-14 Thread Jason Roberts
I would like to build a forest of regression trees to see how well some
covariates predict a response variable and to examine the importance of the
covariates. I have a small number of covariates (8) and large number of
records (27368). The response and all of the covariates are continuous
variables.

A cursory examination of the covariates does not suggest they are correlated
in a simple fashion (e.g. the variance inflation factors are all fairly low)
but common sense suggests there should be some relationship: one of them is
the day of the year and some of the others are environmental parameters such
as water temperature. For this reason I would like to follow the advice of
Strobl et al. (2008) and try the authors' conditional variable importance
measure. This is implemented in the party package by calling varimp(...,
conditional=TRUE). Unfortunately, when I call that on my forest I receive
the error:

 varimp(myforest, conditional=TRUE)
Error in model.matrix.default(as.formula(f), data = blocks) : 
  term 1 would require 9e+12 columns

Does anyone know what is wrong?

I noticed a post in June 2011 where a user reported this message and the
ultimate problem was that the importance measure was being conditioned on
too many variables (47). I have only a small number of variables here so I
guessed that was not the problem.

Another suggestion was that there could be a factor with too many levels. In
my case, all of the variables are continuous. Term 1 (x1 below) is the day
of the year, which does happen to be integers 1 ... 366. But the variable is
class numeric, not integer, so I don't believe cforest would treat it as a
factor, although I do not know how to tell whether cforest is treating
something as continuous or as a factor.

Thank you for any help you can provide. I am running R 2.13.1 with party
0.9-4. You can download the data from
http://www.duke.edu/~jjr8/data.rdata (512 KB). Here is the complete code:

 load(\\Temp\\data.rdata)
 nrow(df)
[1] 27368
 summary(df)
   y x1  x2   x3
x4 x5  x6  x7  x8

 Min.   :  0.000   Min.   :  1.0   Min.   :0.   Min.   :  1.00   Min.
:  52   Min.   : 0.008184   Min.   :16.71   Min.   :0.000   Min.   :
0.02727  
 1st Qu.:  0.000   1st Qu.:105.0   1st Qu.:0.   1st Qu.: 30.00   1st
Qu.:1290   1st Qu.: 6.747035   1st Qu.:23.92   1st Qu.:0.000   1st Qu.:
0.11850  
 Median :  1.282   Median :169.0   Median :0.2353   Median : 38.00   Median
:1857   Median :11.310277   Median :26.35   Median :0.0001569   Median :
0.14625  
 Mean   :  5.651   Mean   :178.7   Mean   :0.2555   Mean   : 55.03   Mean
:1907   Mean   :12.889021   Mean   :26.31   Mean   :0.0162043   Mean   :
0.20684  
 3rd Qu.:  5.353   3rd Qu.:262.0   3rd Qu.:0.4315   3rd Qu.: 47.00   3rd
Qu.:2594   3rd Qu.:18.427410   3rd Qu.:28.95   3rd Qu.:0.0144660   3rd Qu.:
0.20095  
 Max.   :195.238   Max.   :366.0   Max.   :1.   Max.   :400.00   Max.
:3832   Max.   :29.492380   Max.   :31.73   Max.   :0.3157486   Max.
:11.76877  
 library(HH)
output deleted
 vif(y ~ ., data=df)
  x1   x2   x3   x4   x5   x6   x7   x8 
1.374583 1.252250 1.021672 1.218801 1.015124 1.439868 1.075546 1.060580
 library(party)
output deleted
 mycontrols - cforest_unbiased(ntree=50, mtry=3)   # Small forest
but requires a few minutes
 myforest - cforest(y ~ ., data=df, controls=mycontrols)
 varimp(myforest)
x1 x2 x3 x4 x5 x6 x7
x8 
 11.924498 103.180195  16.228864  30.658946   5.053500  12.820551   2.113394
6.911377
 varimp(myforest, conditional=TRUE)
Error in model.matrix.default(as.formula(f), data = blocks) : 
  term 1 would require 9e+12 columns

__
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] change uppercase variables

2011-10-14 Thread Jose Bustos Melo


 Hello everyone, 

I'm trying to change the name variables of a big dataset. Here's more than 300 
variables. The point is that I have to match it with another dataset that have 
same variables, but in lowercase, the I can use rbind and do my work.

Is there any function for changing uppercase or lowercase variables?
Thank you in advance!
José

[[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] qcc package

2011-10-14 Thread R. Michael Weylandt
You'll note that the package version for which you are reading the
manual is not the version that you downloaded from CRAN.

As I suspected, this functionality seems to have existed in an older
version of the package, but seems to have since been deprecated (cf.
the current CRAN files). You can install an older version from the
CRAN archives (2.0.1) is still available if you wish, but I'd suggest
that you also look around the new package and see if there's an even
better version available. I don't know the package so I can't direct
you to whatever updated/improved versions there may be. I don't know
how widely used the package is, but if no one on this list can help,
it may be worth contacting the maintainer directly to see if he can
help.

If you do choose to reinstall the older version, there doesn't seem to
be any C/FORTRAN code in it, so something like

install.packages(qcc.tar.gz, type=source, repos=NULL)

*should* work directly (once you point R to the file), no promises though.

Hope this helps,

Michael

PS -- It's good form (and usually more helpful to you) to cc the whole
list on each step of the correspondance. It lets other voices chime in
if I start leading you astray as well as ensuring that there are
replies coming even at all hours of the day since R-help has a
world-wide readership. Also, it makes sure everything gets archived
nicely so someone can read them in the future.

On Fri, Oct 14, 2011 at 11:36 AM, Li, Yan yan...@ibi.com wrote:
 I attached the .pdf for qcc package. For process.capability.sixpack() the 
 reference is : Minitab (2000) Users's Guide 2: Data Analysis and Quality 
 Tools, rel. 13, Chapter 14. (I cannot find it in the web...)

 Thank you!

 -Original Message-
 From: R. Michael Weylandt [mailto:michael.weyla...@gmail.com]
 Sent: Friday, October 14, 2011 11:28 AM
 To: Li, Yan; r-help
 Subject: Re: [R] qcc package

 Apologies for my brief reply -- I didn't take the time to examine the
 package closely.

 On a fresh install, I don't see process.capability.sixpack() as an
 available function and process.capability() isn't a generic so it's
 not that sort of thing. Looking at the package index, there's no
 indication such a thing exists, though perhaps it did in an older
 version of the package.

 Do you have a citation for this function? I don't see one in the
 official CRAN description...

 Michael

 On Fri, Oct 14, 2011 at 11:25 AM, Li, Yan yan...@ibi.com wrote:
 Yes, I did everytime. And the other functions: qcc(), process.capability() 
 works. Thank you for your reply!

 -Original Message-
 From: R. Michael Weylandt [mailto:michael.weyla...@gmail.com]
 Sent: Friday, October 14, 2011 11:22 AM
 To: Li, Yan
 Cc: r-help@r-project.org
 Subject: Re: [R] qcc package

 Did you reload the package for each new session? Sounds like you are
 probably missing a line like library(qcc) or require(qcc)

 Michael

 On Fri, Oct 14, 2011 at 11:10 AM, Li, Yan yan...@ibi.com wrote:
 Hi All,

 I installed qcc package and the dependency packages. For the first time I 
 can use the function : process.capability.sixpack(). But later when ran the 
 code again I always got the following error: Error: could not find function 
 process.capability.sixpack. I tried reinstalling the qcc package but 
 didn't help. Does anyone have this kind of experience? Thank you!

 Regards,
 Yan


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


[R] heritability estimation

2011-10-14 Thread Moohbear
Hello,

I'm looking for a method to estimate narrow sense heritability of traits in
a RIL population. Papers I've checked either use either SAS or SPSS or do
not give any details at all. I've found some reference to using variance
components in ANOVA, using the kinship or wgaim packages, but I don't have a
clue as to how to do any of this.
Is there any way fro a very R illiterate user to do it?

Thanks

--
View this message in context: 
http://r.789695.n4.nabble.com/heritability-estimation-tp3904908p3904908.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] Selecting multiple vectors from a list of lists of matrices

2011-10-14 Thread Graaf, G de
Hi all,

I was unable to find a solution to my problem in the archives, but this might 
be due to a lack knowledge on the correct terminology on my part. Please 
forgive me if this has been explained before and please forgive me my probably 
clumsy way of explaining things.

This is what I want to do:

I have a list made up of 6 lists containing 7  4x4 matrices each.
My goal is to select a large number of rows from all those matrices (thus 
giving vectors of length 4), and stack them into a matrix or data frame.
Creating a single such vector is easy using the normal extract functionality, 
say I want the 2nd row of the 5th matrix in the 3rd list, I use:
my.list[[3]] [[5]] [2, ]

Problem is, I need to get a matrix or data frame of about 8000 of these rows...

My idea was to create three vectors for each of the three indices, and put 
those vector names where the 3, 5 and 2 are in my example. I did something 
similar before with a 3-dimensional array, where you can use a matrix with 
dimensions [n,3] as an index to create a vector of length n. This, however, 
does not work with lists. I created a workaround using the lapply function 
(shown below) which works but is incredibly slow.

extract - function (selector) {
matrix.list[[selector[1]]][[selector[2]]][selector[3],]
}

output - function(var1,var2,var3) {
selector -  as.data.frame(rbind(var1,var2,var3))
stack - do.call('rbind',lapply(selector,FUN=extract))
stack
}


The object matix.list is the said object consisting of 6 lists containing 7 4x4 
matrices each. Var 1 2 and 3 are three vectors of length 8000.

My problem that, although this is working, it is really slow. The output is 
used in a monte carlo simulation with many iterations, so the function is 
called over and over again. What parts of this code are slowing it down the 
most, and how can I speed things up?

Thanks for all the help!

Cheers,
Gimon

  
De inhoud van dit bericht is vertrouwelijk en alleen bes...{{dropped:15}}

__
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] Multi t tests

2011-10-14 Thread Imri
hi all

I have R object look like this:
 spl
$SB012XSB044
DPW   Cross
1  66.6 SB012XSB044
2  96.5 SB012XSB044
3  78.8 SB012XSB044
4  68.6 SB012XSB044
5  62.0 SB012XSB044
6  72.1 SB044XSB012
7  72.2 SB044XSB012
8  69.6 SB044XSB012
9  87.9 SB044XSB012
10 84.4 SB044XSB012
11 51.9 SB044XSB012
12 65.5 SB044XSB012

$SB012XSB099
 DPW   Cross
13 100.9 SB012XSB099
14  44.4 SB012XSB099
15  83.5 SB012XSB099
16  89.9 SB012XSB099
17  78.0 SB012XSB099
18  83.0 SB012XSB099
19 114.3 SB099XSB012
20 173.1 SB099XSB012
21 114.3 SB099XSB012
22  58.8 SB099XSB012
23  98.1 SB099XSB012
24  12.8 SB099XSB012

I want to do a t test for DPW values by the 2 different Cross types for each
of spl components. 
Any suggestions? I just got errors till now

Thanks,
Imri.

--
View this message in context: 
http://r.789695.n4.nabble.com/Multi-t-tests-tp3905075p3905075.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] change uppercase variables

2011-10-14 Thread R. Michael Weylandt
What sort of variables are these? generally toupper() or tolower()
would do the trick, but it can be little trickier if things are stored
as factors.

Michael

On Fri, Oct 14, 2011 at 12:12 PM, Jose Bustos Melo jbustosm...@yahoo.es wrote:


  Hello everyone,

 I'm trying to change the name variables of a big dataset. Here's more than 
 300 variables. The point is that I have to match it with another dataset that 
 have same variables, but in lowercase, the I can use rbind and do my work.

 Is there any function for changing uppercase or lowercase variables?
 Thank you in advance!
 José

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


Re: [R] Minimization/Optimization under functional constraints

2011-10-14 Thread forget_f1
Thanks for your help...actually there is monotonicity in beta so minimizing
the square of the functional constraint works.  I verified it with a brute
force search  (while loop).

For the sake of knowledge this is what someone else suggested (but didn't
work in my case)

Since x is fixed (given the data), you are really just trying to find

  inf{beta0 | g(beta) = 0}

where g() is defined in the obvious way.

If you can be sure that the infimum is not 0, then you can get rid of
the constraint beta0 to transforming the problem to

  inf{gamma | h(gamma) = 0}

where, e.g., h(gamma) = g(exp(gamma)).

Now, if your original f is continuous and isn't constant over any
interval, say, then you could try to solve for the zeros of h, and the
smallest one should be what you're looking for.  Finding all the zeros
of h could still be hard of course, and I suspect your problem isn't
that nice anyway or you wouldn't be asking me.

--
View this message in context: 
http://r.789695.n4.nabble.com/Minimization-Optimization-under-functional-constraints-tp3899020p3905137.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] help to ... import the data from Excel

2011-10-14 Thread Sarah_R_edu
   

I am tried

z - read.xls(file=C:\\Users\\user\\Desktop\\LTS.xls, colNames=FALSE, 
rowNames=FALSE)


and the following massege is appeared:

Error in .Call(ReadXls, file, colNames, sheet, type, from, rowNames,  : 
  Incorrect number of arguments (11), expecting 10 for 'ReadXls'


My dear , Jean

thanks a lot ( Flower)



.


*/My best wishes/*

-
We are all like the bright moon, we still have our darker side 

--
View this message in context: 
http://r.789695.n4.nabble.com/help-to-import-the-data-from-Excel-tp3893382p3905334.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] date and time

2011-10-14 Thread threshold
Dear R users, 

I got date and time as two separate characters 
[1] 2008-04-11
[1] 22:00:00

which correspond to my starting point in time domain.

Now I need to produce series over, 5 sec epochs up to end point, say:
[1] 2008-04-12
[1] 23:00:00

So something like
2008-04-11 22:00:00
2008-04-11 22:00:05
2008-04-11 22:00:10
.
.
.
2008-04-12 23:00:00

Is there any strightforward way to do it? Any suggestions?

Best, robert


--
View this message in context: 
http://r.789695.n4.nabble.com/date-and-time-tp3905358p3905358.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] aov(variable~group*(speed*person)) but How to get 95% confidence intervals ?

2011-10-14 Thread Jebb Remelius
Greetings and gratitude,

I have 19 persons in each group, and each person walks at 3 different speeds.  
I can do a nice p value and f value with summary command
Please help me learn how to report the 95% confidence interval for this anova?
This is easier for my fourth, separate condition: preferred walking speed, 
where there is no speed factor in the model:
aov(variable~group)
although I compute the 95%CI in SPSS for this model :(
Any advice on how to do this for the single speed anova in R, because it is 
really nice!
Thank you
Jebb


Jebb Remelius PhDc
j...@kin.umass.edu
413-545-4959 office
224-645-3490 mobile

__
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] help to ... import the data from Excel

2011-10-14 Thread R. Michael Weylandt
I can't remember the specifics right now, but when you load the
package used to provide read.xls() you probably get a long warning
message saying you need to run

xls.getshlib()

before using the package. If I remember right, this solves your problem.

Michael
On Fri, Oct 14, 2011 at 11:54 AM, Sarah_R_edu sarah_r_...@hotmail.com wrote:


 I am tried

 z - read.xls(file=C:\\Users\\user\\Desktop\\LTS.xls, colNames=FALSE,
 rowNames=FALSE)


 and the following massege is appeared:

 Error in .Call(ReadXls, file, colNames, sheet, type, from, rowNames,  :
  Incorrect number of arguments (11), expecting 10 for 'ReadXls'


 My dear , Jean

 thanks a lot ( Flower)



 .


 */My best wishes/*

 -
 We are all like the bright moon, we still have our darker side

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/help-to-import-the-data-from-Excel-tp3893382p3905334.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-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] change uppercase variables

2011-10-14 Thread Uwe Ligges



On 14.10.2011 18:12, Jose Bustos Melo wrote:



  Hello everyone,

I'm trying to change the name variables of a big dataset. Here's more than 300 
variables. The point is that I have to match it with another dataset that have 
same variables, but in lowercase, the I can use rbind and do my work.

Is there any function for changing uppercase or lowercase variables?


See ?tolower

Uwe Ligges



Thank you in advance!
José

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


Re: [R] change uppercase variables

2011-10-14 Thread Weidong Gu
?tolower

Weidong Gu

On Fri, Oct 14, 2011 at 12:12 PM, Jose Bustos Melo jbustosm...@yahoo.es wrote:


  Hello everyone,

 I'm trying to change the name variables of a big dataset. Here's more than 
 300 variables. The point is that I have to match it with another dataset that 
 have same variables, but in lowercase, the I can use rbind and do my work.

 Is there any function for changing uppercase or lowercase variables?
 Thank you in advance!
 José

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


Re: [R] heritability estimation

2011-10-14 Thread David Winsemius


On Oct 14, 2011, at 9:49 AM, Moohbear wrote:


Hello,

I'm looking for a method to estimate narrow sense heritability of  
traits in

a RIL population.


I admit to not knowing that TLA.


Papers I've checked either use either SAS or SPSS or do
not give any details at all. I've found some reference to using  
variance
components in ANOVA, using the kinship or wgaim packages, but I  
don't have a

clue as to how to do any of this.
Is there any way fro a very R illiterate user to do it?


(I will also admit to at first reading that as illegitimate.   
Apologies.)


To become less illiterate (and also less illegitimate in the r-help  
context) you should consider first using one of the many search  
facilities. For instance, at an r-console session, try this:


install.packages(sos)
require(sos)
findFn(heritability)
# found 60 matches;  retrieving 3 pages
2 3

I don't have the knowledge or experience to pick through all those  
candidates ... but you presumably do.




Thanks

--
View this message in context: 
http://r.789695.n4.nabble.com/heritability-estimation-tp3904908p3904908.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.


David Winsemius, MD
West Hartford, CT

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


Re: [R] Multi t tests

2011-10-14 Thread R. Michael Weylandt
It's usually standard to provide an example of what code you've tried
and also to put your data in a form that can be more easily
cut-and-pasted into R.

That said, would something like this work if you know you only have
two sorts of cross in each level?

lapply(spl, function(x) {x - split(x[,1],x[,2]); t.test(x[[1]], x[[2]])})

Michael

On Fri, Oct 14, 2011 at 10:38 AM, Imri bisr...@agri.huji.ac.il wrote:
 hi all

 I have R object look like this:
 spl
 $SB012XSB044
    DPW       Cross
 1  66.6 SB012XSB044
 2  96.5 SB012XSB044
 3  78.8 SB012XSB044
 4  68.6 SB012XSB044
 5  62.0 SB012XSB044
 6  72.1 SB044XSB012
 7  72.2 SB044XSB012
 8  69.6 SB044XSB012
 9  87.9 SB044XSB012
 10 84.4 SB044XSB012
 11 51.9 SB044XSB012
 12 65.5 SB044XSB012

 $SB012XSB099
     DPW       Cross
 13 100.9 SB012XSB099
 14  44.4 SB012XSB099
 15  83.5 SB012XSB099
 16  89.9 SB012XSB099
 17  78.0 SB012XSB099
 18  83.0 SB012XSB099
 19 114.3 SB099XSB012
 20 173.1 SB099XSB012
 21 114.3 SB099XSB012
 22  58.8 SB099XSB012
 23  98.1 SB099XSB012
 24  12.8 SB099XSB012

 I want to do a t test for DPW values by the 2 different Cross types for each
 of spl components.
 Any suggestions? I just got errors till now

 Thanks,
 Imri.

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Multi-t-tests-tp3905075p3905075.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-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] help to ... import the data from Excel

2011-10-14 Thread Sarah_R_edu
eyildiz

...

if i installed the package (getshlib) appeared to me to selecting a CRAN
mirror ... Any one to be selected ?
Note:   i am beginner to used the languge R


/thanks eyildiz ( my prayers to you)/



http://r.789695.n4.nabble.com/file/n3905447/47756_429620173219_788668219_5025394_743078_n.jpg
 


-
We are all like the bright moon, we still have our darker side 

--
View this message in context: 
http://r.789695.n4.nabble.com/help-to-import-the-data-from-Excel-tp3893382p3905447.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] help to ... import the data from Excel

2011-10-14 Thread David Winsemius


On Oct 14, 2011, at 11:54 AM, Sarah_R_edu wrote:




I am tried

z - read.xls(file=C:\\Users\\user\\Desktop\\LTS.xls,  
colNames=FALSE,

rowNames=FALSE)


The read.xls that I have (from pkg:gdata) does not have arguments  
named colNames or rowNames, and those do not look correct to be passed  
to read.table, so maybe you are using a different package or version?




and the following massege is appeared:

Error in .Call(ReadXls, file, colNames, sheet, type, from,  
rowNames,  :

 Incorrect number of arguments (11), expecting 10 for 'ReadXls'




--
David Winsemius, MD
West Hartford, CT

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


Re: [R] non-parametric permutation and signed paired-difference distributions

2011-10-14 Thread Weidong Gu
On Fri, Oct 14, 2011 at 11:38 AM, Michael Friendly frien...@yorku.ca wrote:
 Hi all
 Consider the classic data below from Darwin on the heights of 15 pairs of
 zea mays (corn) plants
 either cross-fertilized or self-fertilized, where the goal is to see if it
 makes a difference.

 head(ZeaMays)
  pair pot  cross   self   diff
 1    1   1 23.500 17.375  6.125
 2    2   1 12.000 20.375 -8.375
 3    3   1 21.000 20.000  1.000
 4    4   2 22.000 20.000  2.000
 5    5   2 19.125 18.375  0.750
 6    6   2 21.500 18.625  2.875
 ...

 I'd like to illustrate two types of non-parametric tests of whether the
 mean(diff) = 0.

 (a) Permutation test, where the values of, say self are permuted and
 diff=cross - self
 is calculated for each permutation.  There are 15! permutations, but a
 reasonably
 large number of random permutations would suffice.

 (b) Test based on assigning each abs(diff) a + or - sign, and calculating
 the mean(diff).
 There are 2^15 such possible values, but again, a reasonably large number of
 random
 samples would do.


What do you mean by 'assigning each abs(diff) a + or - sign, and
calculating the mean(diff)'?
abs(diff) should be all positive, right?

 This is obviously a case for apply and friends, but I can't quite see how to
 set it up.

 The complete data:

 dput(ZeaMays)
 structure(list(pair = 1:15, pot = structure(c(1L, 1L, 1L, 2L,
 2L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L), .Label = c(1,
 2, 3, 4), class = factor), cross = c(23.5, 12, 21, 22,
 19.125, 21.5, 22.125, 20.375, 18.25, 21.625, 23.25, 21, 22.125,
 23, 12), self = c(17.375, 20.375, 20, 20, 18.375, 18.625, 18.625,
 15.25, 16.5, 18, 16.25, 18, 12.75, 15.5, 18), diff = c(6.125,
 -8.375, 1, 2, 0.75, 2.875, 3.5, 5.125, 1.75, 3.625, 7, 3, 9.375,
 7.5, -6)), row.names = c(NA, -15L), .Names = c(pair, pot,
 cross, self, diff), class = data.frame)



 -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology
 Dept. York University Voice: 416 736-5115 x66249 Fax: 416 736-5814 4700
 Keele Street Web: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA

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


Re: [R] is there an option to turn off scientific notation in write.csv

2011-10-14 Thread Chris Conner
Paul,
 
Many thanks for your help! I tried the suggestions below and, unfortunately, 
they didn't work for me.  I actually tried a tweak even:
 
Here is what I tried (might I be missing something?): 
 
df$x -format(df$x, scientific = FALSE)
write.csv(df ,file=df.csv)
df$x -format(df$x, scientific = FALSE)
write.csv(format(df, scientific = FALSE) ,file=df.csv)
 
For some reason write.csv still wants to coerce the long numeric into 
scientific notation prior to writing the .csv file...
 
I'm running 2.13.1 on a Win 7 machine... I wonder if this is a bug?
 
One work around I've figured out is to paste a character to df$x before 
exporting, then trimming the character after export... but there has to be a 
more elegant solution?



From: Paul Hiemstra paul.hiems...@knmi.nl

Cc: r-help@r-project.org r-help@r-project.org
Sent: Friday, October 14, 2011 12:39 AM
Subject: Re: [R] is there an option to turn off scientific notation in 
write.csv



On 10/14/2011 05:25 AM, Chris Conner wrote: 
Dear Help-Rs,
 
I'm working with a file that contains large numbers and I need to export them 
as is.  for example take:
  x - 
c(27104010002005,27104020001805,27104090001810,90050013000140,90050013000120)
y - c(1:5)
df - data.frame(cbind(x,y))
 
When I then try a simple:
write.csv(df,file=df.csv)
 
I get:
 x y
1 2.7104E+13 1
2 2.7104E+13 2
3 2.71041E+13 3
4 9.005E+13 4
5 9.005E+13 5
 
Then I tried:
options(scipen=999)
df$x - as.character(df$x)   
Hi,

You can use format in this case:

df$x -format(df$x, scientific = FALSE)
write.csv(df,file=df.csv)

regards,
Paul



write.csv(df,file=df.csv)
 
and I still get:
 x y
1 2.7104E+13 1
2 2.7104E+13 2
3 2.71041E+13 3
4 9.005E+13 4
5 9.005E+13 5
 
How can I have R write the file so it looks like this:
 x y
1 27104010002005
2 27104020001805
3 27104090001810
4 90050013000140
5 90050013000120 [[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.   


-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770  
[[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] heritability estimation

2011-10-14 Thread Moohbear
Thanks for the sos function, I didn't know about it. Unfortunately, almost
all the entries listed are not relevant to my problem.
qgen seems to be doing what I want, but gives error message when I type
library(qgen): Error: package 'qgen' was built before R 2.10.0: please
re-install it. I've tried and succeeded (I think) to install it from the
source, but I get the same error.
rrBLUP should in theory do, but the I don't really understand the sample
code and it doesn't work either anyway (the sample code for mixed.solve).

 G - matrix(rep(0,200*1000),200,1000)
 for (i in 1:200) {
+ G[i,] - ifelse(runif(1000)0.5,-1,1)
+ }
 u - rnorm(1000)
 g - as.vector(crossprod(t(G),u))
 h2 - 0.5
 y - g + rnorm(200,mean=0,sd=sqrt((1-h2)/h2*var(g)))
 ans - mixed.solve(y,Z=G)
Error in dim(x) : 'x' is missing



--
View this message in context: 
http://r.789695.n4.nabble.com/heritability-estimation-tp3904908p3905689.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] Selecting multiple vectors from a list of lists of matrices

2011-10-14 Thread Jean V Adams
This is somewhat faster on my machine:

t(sapply(seq(var1), function(i) my.list[[var1[i]]] [[var2[i]]] [var3[i], 
]))

Jean


Graaf, G de wrote on 10/14/2011 09:23:24 AM:
 
 Hi all,
 
 I was unable to find a solution to my problem in the archives, but 
 this might be due to a lack knowledge on the correct terminology on 
 my part. Please forgive me if this has been explained before and 
 please forgive me my probably clumsy way of explaining things.
 
 This is what I want to do:
 
 I have a list made up of 6 lists containing 7  4x4 matrices each.
 My goal is to select a large number of rows from all those matrices 
 (thus giving vectors of length 4), and stack them into a matrix or data 
frame.
 Creating a single such vector is easy using the normal extract 
 functionality, say I want the 2nd row of the 5th matrix in the 3rd 
 list, I use:
 my.list[[3]] [[5]] [2, ]
 
 Problem is, I need to get a matrix or data frame of about 8000 of 
 these rows...
 
 My idea was to create three vectors for each of the three indices, 
 and put those vector names where the 3, 5 and 2 are in my example. I
 did something similar before with a 3-dimensional array, where you 
 can use a matrix with dimensions [n,3] as an index to create a 
 vector of length n. This, however, does not work with lists. I 
 created a workaround using the lapply function (shown below) which 
 works but is incredibly slow.
 
 extract - function (selector) {
 matrix.list[[selector[1]]][[selector[2]]][selector[3],]
 }
 
 output - function(var1,var2,var3) {
 selector -  as.data.frame(rbind(var1,var2,var3))
 stack - do.call('rbind',lapply(selector,FUN=extract))
 stack
 }
 
 
 The object matix.list is the said object consisting of 6 lists 
 containing 7 4x4 matrices each. Var 1 2 and 3 are three vectors of 
 length 8000.
 
 My problem that, although this is working, it is really slow. The 
 output is used in a monte carlo simulation with many iterations, so 
 the function is called over and over again. What parts of this code 
 are slowing it down the most, and how can I speed things up?
 
 Thanks for all the help!
 
 Cheers,
 Gimon

[[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] is there an option to turn off scientific notation in write.csv

2011-10-14 Thread William Dunlap
Have you tried setting
   options(scipen=500) # big number of digits
?  E.g.,

 df - data.frame(x=pi*10^seq(-30,30,by=10), d=seq(-30,30,by=10), 
 s=state.name[31:37])
 getOption(scipen)
[1] 0
 write.csv(df, stdout())
,x,d,s
1,3.14159265358979e-30,-30,New Mexico
2,3.14159265358979e-20,-20,New York
3,3.14159265358979e-10,-10,North Carolina
4,3.14159265358979,0,North Dakota
5,31415926535.8979,10,Ohio
6,3.14159265358979e+20,20,Oklahoma
7,3.14159265358979e+30,30,Oregon
 oldScipen - options(scipen=500)
 write.csv(df, stdout())
,x,d,s
1,0.0314159265358979,-30,New Mexico
2,0.000314159265358979,-20,New York
3,0.0314159265358979,-10,North Carolina
4,3.14159265358979,0,North Dakota
5,31415926535.8979,10,Ohio
6,314159265358979334144,20,Oklahoma
7,3141592653589793216422042866402,30,Oregon
 options(oldScipen) # reset to the previous value

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf Of Chris Conner
 Sent: Friday, October 14, 2011 10:31 AM
 To: Paul Hiemstra
 Cc: r-help@r-project.org
 Subject: Re: [R] is there an option to turn off scientific notation in 
 write.csv
 
 Paul,
 
 Many thanks for your help! I tried the suggestions below and, unfortunately, 
 they didn't work for
 me.  I actually tried a tweak even:
 
 Here is what I tried (might I be missing something?):
 
 df$x -format(df$x, scientific = FALSE)
 write.csv(df ,file=df.csv)
 df$x -format(df$x, scientific = FALSE)
 write.csv(format(df, scientific = FALSE) ,file=df.csv)
 
 For some reason write.csv still wants to coerce the long numeric into 
 scientific notation prior to
 writing the .csv file...
 
 I'm running 2.13.1 on a Win 7 machine... I wonder if this is a bug?
 
 One work around I've figured out is to paste a character to df$x before 
 exporting, then trimming the
 character after export... but there has to be a more elegant solution?
 
 
 
 From: Paul Hiemstra paul.hiems...@knmi.nl
 
 Cc: r-help@r-project.org r-help@r-project.org
 Sent: Friday, October 14, 2011 12:39 AM
 Subject: Re: [R] is there an option to turn off scientific notation in 
 write.csv
 
 
 
 On 10/14/2011 05:25 AM, Chris Conner wrote:
 Dear Help-Rs,
 
 I'm working with a file that contains large numbers and I need to export them 
 as is.  for example
 take:
   x - 
 c(27104010002005,27104020001805,27104090001810,90050013000140,90050013000120)
 y - c(1:5)
 df - data.frame(cbind(x,y))
 
 When I then try a simple:
 write.csv(df,file=df.csv)
 
 I get:
  x y
 1 2.7104E+13 1
 2 2.7104E+13 2
 3 2.71041E+13 3
 4 9.005E+13 4
 5 9.005E+13 5
 
 Then I tried:
 options(scipen=999)
 df$x - as.character(df$x)
 Hi,
 
 You can use format in this case:
 
 df$x -format(df$x, scientific = FALSE)
 write.csv(df,file=df.csv)
 
 regards,
 Paul
 
 
 
 write.csv(df,file=df.csv)
 
 and I still get:
  x y
 1 2.7104E+13 1
 2 2.7104E+13 2
 3 2.71041E+13 3
 4 9.005E+13 4
 5 9.005E+13 5
 
 How can I have R write the file so it looks like this:
  x y
 1 27104010002005
 2 27104020001805
 3 27104090001810
 4 90050013000140
 5 90050013000120 [[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.
 
 
 --
 Paul Hiemstra, Ph.D.
 Global Climate Division
 Royal Netherlands Meteorological Institute (KNMI)
 Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
 P.O. Box 201 | 3730 AE | De Bilt
 tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul
 http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
   [[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] Analysis

2011-10-14 Thread Alex Ruiz Euler

Here are some tutorials to R:

http://www.cyclismo.org/tutorial/R/
http://www.statmethods.net/

Or just search on the web.

Good luck,
A.


On Fri, 14 Oct 2011 09:29:52 +0300
Peter Kaiga kaigape...@gmail.com wrote:

 i'm actually new at R, but to me its going to be big time, i want to do an
 analysis for the attached data, like define variables and then analyse get
 means, variances, histogram, and other important attributes including cross
 tabs
 
 Regards,
 Peter

__
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] heritability estimation

2011-10-14 Thread David Winsemius


On Oct 14, 2011, at 1:44 PM, Moohbear wrote:

Thanks for the sos function, I didn't know about it. Unfortunately,  
almost

all the entries listed are not relevant to my problem.
qgen seems to be doing what I want, but gives error message when I  
type
library(qgen): Error: package 'qgen' was built before R 2.10.0:  
please
re-install it. I've tried and succeeded (I think) to install it  
from the

source, but I get the same error.
rrBLUP should in theory do, but the I don't really understand the  
sample
code and it doesn't work either anyway (the sample code for  
mixed.solve).



G - matrix(rep(0,200*1000),200,1000)
for (i in 1:200) {

+ G[i,] - ifelse(runif(1000)0.5,-1,1)
+ }

u - rnorm(1000)
g - as.vector(crossprod(t(G),u))
h2 - 0.5
y - g + rnorm(200,mean=0,sd=sqrt((1-h2)/h2*var(g)))
ans - mixed.solve(y,Z=G)

Error in dim(x) : 'x' is missing


I'm not getting the same error with that code. I installed the binary  
rrBLUP_1.8 for Mac from a CRAN mirror with only a warning that it was  
compiled on R 2.13.2.  The copy-pasted code  runs without error on a  
slightly older version of R 2.13.1 in an even older version of my OS  
(Mac OS 10.5.8) on a three year-old machine. The next lines also run  
without error:


 accuracy - cor(u,ans$u)
 accuracy
[1] 0.3117429





--
View this message in context: 
http://r.789695.n4.nabble.com/heritability-estimation-tp3904908p3905689.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.


David Winsemius, MD
West Hartford, CT

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


Re: [R] non-parametric permutation and signed paired-difference distributions

2011-10-14 Thread Jean V Adams
Michael Friendly wrote on 10/14/2011 10:38:44 AM:
 
 Hi all
 Consider the classic data below from Darwin on the heights of 15 pairs 
 of zea mays (corn) plants
 either cross-fertilized or self-fertilized, where the goal is to see if 
 it makes a difference.
 
   head(ZeaMays)
pair pot  cross   self   diff
 11   1 23.500 17.375  6.125
 22   1 12.000 20.375 -8.375
 33   1 21.000 20.000  1.000
 44   2 22.000 20.000  2.000
 55   2 19.125 18.375  0.750
 66   2 21.500 18.625  2.875
 ...
 
 I'd like to illustrate two types of non-parametric tests of whether the 
 mean(diff) = 0.
 
 (a) Permutation test, where the values of, say self are permuted and 
 diff=cross - self
 is calculated for each permutation.  There are 15! permutations, but a 
 reasonably
 large number of random permutations would suffice.


You have paired data.  To conduct a permutation test you would randomly 
assign one member of each pair to being either cross or self-fertilized. 
The other member of the pair would be assigned to the opposite 
treatment.  That would lead to 2^15 = 32,768 permutations.  See the 
perm.test() function in the R package exactRankTests.


 (b) Test based on assigning each abs(diff) a + or - sign, and 
 calculating the mean(diff).
 There are 2^15 such possible values, but again, a reasonably large 
 number of random
 samples would do.


Sounds like you are attempting to combine a sign test and a permutation 
test.  You could do this by using the logical crossself rather than the 
difference cross-self.

Jean


 This is obviously a case for apply and friends, but I can't quite see 
 how to set it up.
 
 The complete data:
 
   dput(ZeaMays)
 structure(list(pair = 1:15, pot = structure(c(1L, 1L, 1L, 2L,
 2L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L), .Label = c(1,
 2, 3, 4), class = factor), cross = c(23.5, 12, 21, 22,
 19.125, 21.5, 22.125, 20.375, 18.25, 21.625, 23.25, 21, 22.125,
 23, 12), self = c(17.375, 20.375, 20, 20, 18.375, 18.625, 18.625,
 15.25, 16.5, 18, 16.25, 18, 12.75, 15.5, 18), diff = c(6.125,
 -8.375, 1, 2, 0.75, 2.875, 3.5, 5.125, 1.75, 3.625, 7, 3, 9.375,
 7.5, -6)), row.names = c(NA, -15L), .Names = c(pair, pot,
 cross, self, diff), class = data.frame)

[[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] date and time

2011-10-14 Thread R. Michael Weylandt
Good afternoon Robert,

Suppose you have your date and time in characters like this:

d.start = 2008-04-11
t.start = 22:00:00

d.end = 2008-04-12
t.end = 15:00:00

then use POSIXct to convert them to a unified time object:

start - as.POSIXct(paste(d.start, t.start))
end - as.POSIXct(paste(d.end, t.end))

Then simply use seq() on your objects, here:

OUT - seq(start, end, by = 5) # 5 second steps.

Hope this helps,

(Robert) Michael Weylandt

On Fri, Oct 14, 2011 at 12:02 PM, threshold r.kozar...@gmail.com wrote:
 Dear R users,

 I got date and time as two separate characters
 [1] 2008-04-11
 [1] 22:00:00

 which correspond to my starting point in time domain.

 Now I need to produce series over, 5 sec epochs up to end point, say:
 [1] 2008-04-12
 [1] 23:00:00

 So something like
 2008-04-11 22:00:00
 2008-04-11 22:00:05
 2008-04-11 22:00:10
 .
 .
 .
 2008-04-12 23:00:00

 Is there any strightforward way to do it? Any suggestions?

 Best, robert


 --
 View this message in context: 
 http://r.789695.n4.nabble.com/date-and-time-tp3905358p3905358.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-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] aov(variable~group*(speed*person)) but How to get 95% confidence intervals ?

2011-10-14 Thread Ken Hutchison
Hey,
   If I understand correctly, library(gplots) plotmeans(). You might also
try TukeyHSD() to see if that gets you where you are trying to go.
   Good luck!
   Ken Hutchison

On Fri, Oct 14, 2011 at 12:11 PM, Jebb Remelius j...@kin.umass.edu wrote:

 Greetings and gratitude,

 I have 19 persons in each group, and each person walks at 3 different
 speeds.  I can do a nice p value and f value with summary command
 Please help me learn how to report the 95% confidence interval for this
 anova?
 This is easier for my fourth, separate condition: preferred walking speed,
 where there is no speed factor in the model:
 aov(variable~group)
 although I compute the 95%CI in SPSS for this model :(
 Any advice on how to do this for the single speed anova in R, because it is
 really nice!
 Thank you
 Jebb


 Jebb Remelius PhDc
 j...@kin.umass.edu
 413-545-4959 office
 224-645-3490 mobile

 __
 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] help to ... import the data from Excel

2011-10-14 Thread R. Michael Weylandt
(Sorry if I'm repeating things: working blind b/c of the
nabble-listserv interface)

Since you haven't actually told us what package you are using, I'm
guessing that your problem seems to be the same as the one discussed
here: http://r.789695.n4.nabble.com/ReadWrite-xls-problem-td3078348.html

If that's true (i.e, if you are using the xlsReadWrite package) which
is where this 11 vs 10 arguments thing tends to show up, then you need
to run this set of commands verbatim once (and only once on each
machine unless you reinstall R / the package) before trying to read an
xls file

library(xlsReadWrite)
xls.getshlib()

Note that this is different than picking a CRAN mirror (I'm not sure
how shlibs came up in that process)

This should fix the error message.

By the way, you also haven't told us what version of R you are
running: I, for one, can't get xlsReadWrite on R2.13.1 from CRAN so
there may be something else at work here.

As David points out, there are also other useful R/xls interface
packages that seem to be a little less trouble.

Michael

On Fri, Oct 14, 2011 at 12:27 PM, Sarah_R_edu sarah_r_...@hotmail.com wrote:
 eyildiz

 ...

 if i installed the package (getshlib) appeared to me to selecting a CRAN
 mirror ... Any one to be selected ?
 Note:   i am beginner to used the languge R


 /thanks eyildiz ( my prayers to you)/



 http://r.789695.n4.nabble.com/file/n3905447/47756_429620173219_788668219_5025394_743078_n.jpg


 -
 We are all like the bright moon, we still have our darker side

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/help-to-import-the-data-from-Excel-tp3893382p3905447.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-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] Party package: varimp(..., conditional=TRUE) error: term 1 would require 9e+12 columns

2011-10-14 Thread Ken Hutchison
Hi,
That's a tough one, I'll do my best and hope a more knowledgeable person
will correct me.
 Since you can measure conditional importance by permuting predictors and
re-evaluating importance, perhaps try the randomForest package and examine
how your results change based on permutation of each predictor. I understand
permutation would take a prohibitively large amount of time for certain
applications. Try (clumsy) shortcuts:
Some pseudocode
First Option
myforest=randomForest(y~.,data=df)
imp=myforest$importance #Just for your info importance is here.
#permute an x
newx=sample(x,length(x),replace=F)
#make new forest
newforest=randomForest(y~newx+all else...)
#predict oldx with newforest
#If somewhat accurate, problems afoot.

Second Option:
Predicting your held out variable 1000 times with new forest(pretty quick to
do) and examining the quantile of the predicted value relative to the old
(non permuted) distribution of the variable, should be uniformly distributed
between 0 and 1 if truly random inside the forest (and random outside since
we know it has been permuted)... could measure this with Chi-square
statistic.

#Third option
Permute the x's and plot importance for each variable when the others are
 held out (inferential only)
  Weak I know, but I hope it helps!
   Ken Hutchison


On Fri, Oct 14, 2011 at 12:06 PM, Jason Roberts jason.robe...@duke.eduwrote:

 I would like to build a forest of regression trees to see how well some
 covariates predict a response variable and to examine the importance of the
 covariates. I have a small number of covariates (8) and large number of
 records (27368). The response and all of the covariates are continuous
 variables.

 A cursory examination of the covariates does not suggest they are
 correlated
 in a simple fashion (e.g. the variance inflation factors are all fairly
 low)
 but common sense suggests there should be some relationship: one of them is
 the day of the year and some of the others are environmental parameters
 such
 as water temperature. For this reason I would like to follow the advice of
 Strobl et al. (2008) and try the authors' conditional variable importance
 measure. This is implemented in the party package by calling varimp(...,
 conditional=TRUE). Unfortunately, when I call that on my forest I receive
 the error:

  varimp(myforest, conditional=TRUE)
 Error in model.matrix.default(as.formula(f), data = blocks) :
  term 1 would require 9e+12 columns

 Does anyone know what is wrong?

 I noticed a post in June 2011 where a user reported this message and the
 ultimate problem was that the importance measure was being conditioned on
 too many variables (47). I have only a small number of variables here so I
 guessed that was not the problem.

 Another suggestion was that there could be a factor with too many levels.
 In
 my case, all of the variables are continuous. Term 1 (x1 below) is the day
 of the year, which does happen to be integers 1 ... 366. But the variable
 is
 class numeric, not integer, so I don't believe cforest would treat it as a
 factor, although I do not know how to tell whether cforest is treating
 something as continuous or as a factor.

 Thank you for any help you can provide. I am running R 2.13.1 with party
 0.9-4. You can download the data from
 http://www.duke.edu/~jjr8/data.rdata (512 KB). Here is the complete code:

  load(\\Temp\\data.rdata)
  nrow(df)
 [1] 27368
  summary(df)
   y x1  x2   x3
 x4 x5  x6  x7  x8

  Min.   :  0.000   Min.   :  1.0   Min.   :0.   Min.   :  1.00   Min.
 :  52   Min.   : 0.008184   Min.   :16.71   Min.   :0.000   Min.   :
 0.02727
  1st Qu.:  0.000   1st Qu.:105.0   1st Qu.:0.   1st Qu.: 30.00   1st
 Qu.:1290   1st Qu.: 6.747035   1st Qu.:23.92   1st Qu.:0.000   1st Qu.:
 0.11850
  Median :  1.282   Median :169.0   Median :0.2353   Median : 38.00   Median
 :1857   Median :11.310277   Median :26.35   Median :0.0001569   Median :
 0.14625
  Mean   :  5.651   Mean   :178.7   Mean   :0.2555   Mean   : 55.03   Mean
 :1907   Mean   :12.889021   Mean   :26.31   Mean   :0.0162043   Mean   :
 0.20684
  3rd Qu.:  5.353   3rd Qu.:262.0   3rd Qu.:0.4315   3rd Qu.: 47.00   3rd
 Qu.:2594   3rd Qu.:18.427410   3rd Qu.:28.95   3rd Qu.:0.0144660   3rd Qu.:
 0.20095
  Max.   :195.238   Max.   :366.0   Max.   :1.   Max.   :400.00   Max.
 :3832   Max.   :29.492380   Max.   :31.73   Max.   :0.3157486   Max.
 :11.76877
  library(HH)
 output deleted
  vif(y ~ ., data=df)
  x1   x2   x3   x4   x5   x6   x7   x8
 1.374583 1.252250 1.021672 1.218801 1.015124 1.439868 1.075546 1.060580
  library(party)
 output deleted
  mycontrols - cforest_unbiased(ntree=50, mtry=3)   # Small forest
 but requires a few minutes
  myforest - cforest(y ~ ., data=df, controls=mycontrols)
  varimp(myforest)
x1 x2 x3 

Re: [R] Split a list

2011-10-14 Thread Dennis Murphy
Hi:

Following the lead of others, here's a reproducible example that I
believe achieves what you want.

# Q1:
L - lapply(1:3, function(n)
data.frame(x = rnorm(6), y = rnorm(6), g = rep(1:2, each = 3)))

# Using David's suggestion:
L1 - lapply(L, function(d) subset(d, g == 1L))
L2 - lapply(L, function(d) subset(d, g == 2L))

# Q2:
# Let range  2 to retain in this small example:
# Find the range of the second column of each list component:
sapply(L, function(x) diff(range(x[, 2], na.rm = TRUE)))

# The code retains the data frame if the range of the second
# column is  2, otherwise it is set to NULL:
lapply(L, function(d) if(diff(range(d[, 2], na.rm = TRUE))  2) d else NULL)

# If you want to collapse the result into a data frame, the base R
approach would be
do.call('rbind', lapply(L, function(d) if(diff(range(d[, 2], na.rm =
TRUE))  2) d else NULL))

# An equivalent way to do all of this in the plyr package is:
library('plyr')
L1 - llply(L, function(d) subset(d, g == 1L))
L2 - llply(L, function(d) subset(d, g == 2L))

ldply(L, function(d) if(diff(range(d[, 2], na.rm = TRUE))  2) d else NULL)

There are advantages to naming the list components if this is what you
have in mind, since both ldply() and the rbind from do.call() will
output indicators of which component data frame each observation
belongs; ldply() uses an .id variable to designate the list component
name whereas do.call(rbind, ...) uses rownames to distinguish
observations. For this example, try

names(L) - paste('d', 1:3, sep = '')

and run the code above again to see the difference.

HTH,
Dennis

On Fri, Oct 14, 2011 at 6:06 AM, Juliet Ndukum jpnts...@yahoo.com wrote:
 I have a list of dataframes i.e. each list element is a dataframe with three 
 columns and differing number of rows. The third column takes on only two 
 values. I wish to split the list into two sublists based on the value of the 
 third column of the list element.
 Second issue with lists as well. I would like to reduce each of the sublist 
 based on the range of the second column, i.e. if the range of the second 
 column is greater than twenty for example keep the list element.

 Could someone help me with a code to implement these two issues. Thanks in 
 advance for your help,
 JN
        [[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.


Re: [R] Minimum cutsets

2011-10-14 Thread Gábor Csárdi
On Thu, Oct 13, 2011 at 7:47 PM, malhomidi mal...@essex.ac.uk wrote:
 Hi again,

         I've looked at the links above and I see the development version of
 the igraph library. I see the src folder implemented in C. Are these source
 codes available in R or I just would have to use the C code? The reason is
 that I just started learning R and I really want to stay away from C and
 C++.

From the googlecode page I mentioned, you can download an R source
package, that you can compile and install in R.
Compiling it for windows is slightly more difficult, so if you need a
windows package, I can provide one.

Gabor

 Regards,
 Mohammed Alhomidi

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Minimum-cutsets-tp885346p3903287.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.




-- 
Gabor Csardi csa...@rmki.kfki.hu     MTA KFKI RMKI

__
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] strucchange Nyblom-Hansen Test?

2011-10-14 Thread buehlerman
Thanks a lot for your immediate help and detailed explanation!

About one thing I'm not quite clear:

When the default fit = glm in gefp() is used:
sctest(gefp(Employed ~ Year + GNP.deflator + GNP + Armed.Forces, data =
longley, fit = lm), functional = meanL2BB)

is this then the original Nyblom's Parameter Stability Test (1989) or is it
the joint (Nyblom-)Hansen test with theta = (beta) constant instead of theta
= (beta, sigma^2) constant ?

--
View this message in context: 
http://r.789695.n4.nabble.com/strucchange-Nyblom-Hansen-Test-tp3887208p3905669.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] How to mean for groups of matrix rows?

2011-10-14 Thread Andrey
Dear All

Big Thanks! R is wonderful language!

-- 
*Thanks,
Andrei*

[[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] Counting the number of integers at one swoop

2011-10-14 Thread Carl Witthoft

You guys are working too hard.


Rgames y - c(0,1,1,3,3,3,5,5,6)
Rgames rle(sort(y))
Run Length Encoding
  lengths: int [1:5] 1 2 3 2 1
  values : num [1:5] 0 1 3 5 6


--
-
Sent from my Cray XK6

__
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] sorting dataframe by arbitrary order

2011-10-14 Thread Trevor Davies
This has been dogging me for a while. I've started making a lot of tables
via xtable so the way I want to sort things is not always in alphabetical or
numerical order.

As an example, consider I have a dataframe as follows

set.seed(100)
a - data.frame(V1=sample(letters[1:4],100, replace=T),V2=1:100)

I know I can sort the columns first by V1 first and then by V2 by:

sorted.a - a[do.call(order,a[c('V1','V2')]),]

What I want to do is exactly that but I do not want V1 sorted
alphabetically.  Rather, I would like it sorted as 'a','c','d','b'.

I know I could do it with a subset, rbind function but I thought there may
be a more elegant way?

Thanks for the help.

[[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] non-parametric permutation and signed paired-difference distributions

2011-10-14 Thread Michael Friendly

On 10/14/2011 1:20 PM, Weidong Gu wrote:

On Fri, Oct 14, 2011 at 11:38 AM, Michael Friendlyfrien...@yorku.ca  wrote:

Hi all
Consider the classic data below from Darwin on the heights of 15 pairs of
zea mays (corn) plants
either cross-fertilized or self-fertilized, where the goal is to see if it
makes a difference.


head(ZeaMays)

  pair pot  cross   self   diff
11   1 23.500 17.375  6.125
22   1 12.000 20.375 -8.375
33   1 21.000 20.000  1.000
44   2 22.000 20.000  2.000
55   2 19.125 18.375  0.750
66   2 21.500 18.625  2.875
...

I'd like to illustrate two types of non-parametric tests of whether the
mean(diff) = 0.

(a) Permutation test, where the values of, say self are permuted and
diff=cross - self
is calculated for each permutation.  There are 15! permutations, but a
reasonably
large number of random permutations would suffice.

(b) Test based on assigning each abs(diff) a + or - sign, and calculating
the mean(diff).
There are 2^15 such possible values, but again, a reasonably large number of
random
samples would do.


What do you mean by 'assigning each abs(diff) a + or - sign, and
calculating the mean(diff)'?
abs(diff) should be all positive, right?



I mean to calculate
mean (sign * abs(diff))
where sign is a vector of length 15 composed of some combination of (-1, 
+1).


This is actually what Fisher did.  It corresponds to assigning one 
member of each pair to cross / self


--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele StreetWeb:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

__
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] sorting dataframe by arbitrary order

2011-10-14 Thread William Dunlap
Set the levels of the factor a$V1 to the order
in which you want them to be sorted.  E.g.,

   a - data.frame(V1=letters[rep(4:1,2)], V2=1001:1008)
   a[do.call(order,a[c('V1','V2')]),]
V1   V2
  4  a 1004
  8  a 1008
  3  b 1003
  7  b 1007
  2  c 1002
  6  c 1006
  1  d 1001
  5  d 1005
   a$V1 - factor(a$V1, levels=c(a,c,d,b))
   a[do.call(order,a[c('V1','V2')]),]
V1   V2
  4  a 1004
  8  a 1008
  2  c 1002
  6  c 1006
  1  d 1001
  5  d 1005
  3  b 1003
  7  b 1007

This means that tables and plots will be ordered in
the way as well.  E.g.,

   with(a, table(V1, V2))
 V2
  V1  1001 1002 1003 1004 1005 1006 1007 1008
a00010001
c01000100
d10001000
b00100010


Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf Of Trevor Davies
 Sent: Friday, October 14, 2011 12:05 PM
 To: r-help@r-project.org
 Subject: [R] sorting dataframe by arbitrary order
 
 This has been dogging me for a while. I've started making a lot of tables
 via xtable so the way I want to sort things is not always in alphabetical or
 numerical order.
 
 As an example, consider I have a dataframe as follows
 
 set.seed(100)
 a - data.frame(V1=sample(letters[1:4],100, replace=T),V2=1:100)
 
 I know I can sort the columns first by V1 first and then by V2 by:
 
 sorted.a - a[do.call(order,a[c('V1','V2')]),]
 
 What I want to do is exactly that but I do not want V1 sorted
 alphabetically.  Rather, I would like it sorted as 'a','c','d','b'.
 
 I know I could do it with a subset, rbind function but I thought there may
 be a more elegant way?
 
 Thanks for the help.
 
   [[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.


Re: [R] non-parametric permutation and signed paired-difference distributions

2011-10-14 Thread Bert Gunter
If I understand what you want to do, it's simple. 2^15 is small (only about
33000), so you can generate all the possible means (sums, actually) and and
find the population quantile for your result. If avals is the vector of 15
absolute values, the complete distribution is:

allsums - as.matrix(expand.grid(as.data.frame(matrix(rep(c(-1,1),15), nr
=2 %*% avals

This was instantaneous on my machine.

Cheers,
Bert


On Fri, Oct 14, 2011 at 12:42 PM, Michael Friendly frien...@yorku.cawrote:

 On 10/14/2011 1:20 PM, Weidong Gu wrote:

 On Fri, Oct 14, 2011 at 11:38 AM, Michael Friendlyfrien...@yorku.ca
  wrote:

 Hi all
 Consider the classic data below from Darwin on the heights of 15 pairs of
 zea mays (corn) plants
 either cross-fertilized or self-fertilized, where the goal is to see if
 it
 makes a difference.

  head(ZeaMays)

  pair pot  cross   self   diff
 11   1 23.500 17.375  6.125
 22   1 12.000 20.375 -8.375
 33   1 21.000 20.000  1.000
 44   2 22.000 20.000  2.000
 55   2 19.125 18.375  0.750
 66   2 21.500 18.625  2.875
 ...

 I'd like to illustrate two types of non-parametric tests of whether the
 mean(diff) = 0.

 (a) Permutation test, where the values of, say self are permuted and
 diff=cross - self
 is calculated for each permutation.  There are 15! permutations, but a
 reasonably
 large number of random permutations would suffice.

 (b) Test based on assigning each abs(diff) a + or - sign, and calculating
 the mean(diff).
 There are 2^15 such possible values, but again, a reasonably large number
 of
 random
 samples would do.

  What do you mean by 'assigning each abs(diff) a + or - sign, and
 calculating the mean(diff)'?
 abs(diff) should be all positive, right?


  I mean to calculate
 mean (sign * abs(diff))
 where sign is a vector of length 15 composed of some combination of (-1,
 +1).

 This is actually what Fisher did.  It corresponds to assigning one member
 of each pair to cross / self

 --
 Michael Friendly Email: friendly AT yorku DOT ca
 Professor, Psychology Dept.
 York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
 4700 Keele StreetWeb:   http://www.datavis.ca
 Toronto, ONT  M3J 1P3 CANADA

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




-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

[[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] sorting dataframe by arbitrary order

2011-10-14 Thread Trevor Davies
Works great.  I did a couple changes so as to not affect the original
data.frame (and had to add levels back b/c I removed them in the original
read.csv).

a - data.frame(V1=letters[rep(4:1,2)], V2=1001:1008)
b - a
levels(b) - unique(a$V1)

b$V1 - factor(b$V1,levels=c('c','d','a','b'))
a.sorted- a[do.call(order,b[c('V1','V2')]),]

Thank you.

-

On Fri, Oct 14, 2011 at 12:50 PM, William Dunlap wdun...@tibco.com wrote:

 Set the levels of the factor a$V1 to the order
 in which you want them to be sorted.  E.g.,

   a - data.frame(V1=letters[rep(4:1,2)], V2=1001:1008)
a[do.call(order,a[c('V1','V2')]),]
 V1   V2
  4  a 1004
  8  a 1008
  3  b 1003
  7  b 1007
  2  c 1002
  6  c 1006
  1  d 1001
  5  d 1005
   a$V1 - factor(a$V1, levels=c(a,c,d,b))
a[do.call(order,a[c('V1','V2')]),]
 V1   V2
  4  a 1004
  8  a 1008
  2  c 1002
  6  c 1006
  1  d 1001
  5  d 1005
  3  b 1003
  7  b 1007

 This means that tables and plots will be ordered in
 the way as well.  E.g.,

   with(a, table(V1, V2))
 V2
  V1  1001 1002 1003 1004 1005 1006 1007 1008
a00010001
c01000100
d10001000
b00100010


 Bill Dunlap
 Spotfire, TIBCO Software
 wdunlap tibco.com

  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Trevor Davies
  Sent: Friday, October 14, 2011 12:05 PM
  To: r-help@r-project.org
  Subject: [R] sorting dataframe by arbitrary order
 
  This has been dogging me for a while. I've started making a lot of tables
  via xtable so the way I want to sort things is not always in alphabetical
 or
  numerical order.
 
  As an example, consider I have a dataframe as follows
 
  set.seed(100)
  a - data.frame(V1=sample(letters[1:4],100, replace=T),V2=1:100)
 
  I know I can sort the columns first by V1 first and then by V2 by:
 
  sorted.a - a[do.call(order,a[c('V1','V2')]),]
 
  What I want to do is exactly that but I do not want V1 sorted
  alphabetically.  Rather, I would like it sorted as 'a','c','d','b'.
 
  I know I could do it with a subset, rbind function but I thought there
 may
  be a more elegant way?
 
  Thanks for the help.
 
[[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] non-parametric permutation and signed paired-difference distributions

2011-10-14 Thread Michael Friendly

On 10/14/2011 4:10 PM, Bert Gunter wrote:
If I understand what you want to do, it's simple. 2^15 is small (only 
about 33000), so you can generate all the possible means (sums, 
actually) and and find the population quantile for your result. If 
avals is the vector of 15 absolute values, the complete distribution is:


allsums - as.matrix(expand.grid(as.data.frame(matrix(rep(c(-1,1),15), 
nr =2 %*% avals


This was instantaneous on my machine.

That's beautiful, Bert.  Thanks!  Here is my fleshed-out example

mean(ZeaMays$diff)
# complete permutation distribution of diff, for all 2^15 ways of assigning
# one value to cross and the other to self
allmeans - as.matrix(expand.grid(as.data.frame(matrix(rep(c(-1,1),15), 
nr =2 %*% abs(ZeaMays$diff) / 15


# upper-tail p-value
sum(allmeans  mean(ZeaMays$diff)) / 2^15
# two-tailed p-value
sum(abs(allmeans)  mean(ZeaMays$diff)) / 2^15

hist(allmeans, breaks=64, xlab=Mean difference, cross-self,
main=Histogram of all mean differences)
abline(v=mean(ZeaMays$diff), col=red, lwd=2)
abline(v=-mean(ZeaMays$diff), col=red, lwd=2, lty=2)


--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele StreetWeb:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA

__
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] Chunk of code

2011-10-14 Thread Juliet Ndukum
MATLAB chunk of code
for jj = 1:numOfAA            curAAPosInSeqIndex = aaPosInSeqIndex{1,jj};       
     for kk = 1:K                p_c_a_z_given_x_contribution(1,jj,kk) = 
sum(sum(p_c_a_z_given_m_x_permuted(:,:,kk) .* curAAPosInSeqIndex, 1),2); % 1 by 
numOfAA by K            end        end
aaPosInSeqIndex is a list of size 24, with each element a 
vector. p_c_a_z_given_m_x_permuted is an array of size N=1655 by  J=39  by 
K=151 and p_c_a_z_given_x_contribution is an array of size 1 by numOfAA = 24 by 
K=151
R equivalent:app = t(sapply(1:numOfAA, function(xx) (t(sapply(1:K, function(x) 
colSums(p_c_a_z_given_m_x_permuted[,,x]* aaPosInSeqIndex[[xx]])))[,3])))
 p_c_a_z_given_x_contribution = app
I would be very grateful if someone could look at the R code and let me know if 
there is something missing or if there is a better way of getting the exact 
MATLAB output uing R code i.e. could someone write a code that would do what 
the MATLAB chunk of code above is doing. The R code does not output the same 
MATLAB output. 
Thanks in advance for your help.JN

[[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] using do.call to call a list of functions

2011-10-14 Thread honeyoak
I am having trouble figuring out how to use do.call to call and run a list of
functions.

for example:

make.draw = function(i){i;function()runif(i)}
function.list = list()
for (i in 1:3) function.list[[i]] = make.draw(i)

will result in

 function.list[[1]]()
 [1] 0.2996515
 function.list[[2]]()
 [1] 0.7276203 0.4704813
 function.list[[3]]()
 [1] 0.9092999 0.7307774 0.4647443

what I want to do is create a function that calls all three functions in the
list at one go. from what I understand as.call() can be used to do this but
I am having trouble connecting the dots and getting 6 uniform random draws
from function.list. thanks, honeyoak.

--
View this message in context: 
http://r.789695.n4.nabble.com/using-do-call-to-call-a-list-of-functions-tp3906337p3906337.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] rpois 0

2011-10-14 Thread knut-o
Hello
what is the easiest way to generate rpois(m,lambda) but only values greater
than 0 and length = m.
tanks, knut

--
View this message in context: 
http://r.789695.n4.nabble.com/rpois-0-tp3906239p3906239.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] help to ... import the data from Excel

2011-10-14 Thread Sarah_R_edu

/Michael Weylandt/


i used read.xls() and i install the packages : xlsReadWrite and getshlib
before using this command  but, did not work.

anyway i waiting for you.


thank you so much. (Flowers)

-
We are all like the bright moon, we still have our darker side 

--
View this message in context: 
http://r.789695.n4.nabble.com/help-to-import-the-data-from-Excel-tp3893382p3906354.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] using do.call to call a list of functions

2011-10-14 Thread Richard M. Heiberger
 function.list=c(sin, cos, function(x) tan(x))
 for (f in function.list) print(f(pi))
[1] 1.224606e-16
[1] -1
[1] -1.224606e-16


On Fri, Oct 14, 2011 at 5:48 PM, honeyoak honey...@gmail.com wrote:

 I am having trouble figuring out how to use do.call to call and run a list
 of
 functions.

 for example:

 make.draw = function(i){i;function()runif(i)}
 function.list = list()
 for (i in 1:3) function.list[[i]] = make.draw(i)

 will result in

  function.list[[1]]()
  [1] 0.2996515
  function.list[[2]]()
  [1] 0.7276203 0.4704813
  function.list[[3]]()
  [1] 0.9092999 0.7307774 0.4647443

 what I want to do is create a function that calls all three functions in
 the
 list at one go. from what I understand as.call() can be used to do this but
 I am having trouble connecting the dots and getting 6 uniform random draws
 from function.list. thanks, honeyoak.

 --
 View this message in context:
 http://r.789695.n4.nabble.com/using-do-call-to-call-a-list-of-functions-tp3906337p3906337.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.htmlhttp://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] using do.call to call a list of functions

2011-10-14 Thread baptiste auguie
package plyr makes it easier,

plyr::each(function.list)(pi)

HTH,

baptiste

On 15 October 2011 11:55, Richard M. Heiberger r...@temple.edu wrote:
 function.list=c(sin, cos, function(x) tan(x))
 for (f in function.list) print(f(pi))
 [1] 1.224606e-16
 [1] -1
 [1] -1.224606e-16


 On Fri, Oct 14, 2011 at 5:48 PM, honeyoak honey...@gmail.com wrote:

 I am having trouble figuring out how to use do.call to call and run a list
 of
 functions.

 for example:

 make.draw = function(i){i;function()runif(i)}
 function.list = list()
 for (i in 1:3) function.list[[i]] = make.draw(i)

 will result in

  function.list[[1]]()
  [1] 0.2996515
  function.list[[2]]()
  [1] 0.7276203 0.4704813
  function.list[[3]]()
  [1] 0.9092999 0.7307774 0.4647443

 what I want to do is create a function that calls all three functions in
 the
 list at one go. from what I understand as.call() can be used to do this but
 I am having trouble connecting the dots and getting 6 uniform random draws
 from function.list. thanks, honeyoak.

 --
 View this message in context:
 http://r.789695.n4.nabble.com/using-do-call-to-call-a-list-of-functions-tp3906337p3906337.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.htmlhttp://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.


__
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] help to ... import the data from Excel

2011-10-14 Thread R. Michael Weylandt
This is the third time you've said you've done getshlib, but as has
been pointed out to you, the command is:

xls.getshlib()

not just typing getshlib and it must be entered verbatim. The latter
(getshlib) doesn't exist that I'm aware of. Either way, could you do
xls.getshlib() again and provide the output of that command.

Assuming that you're just not typing the code that you did enter,
could you provide the output of sessionInfo() after the call to
library(xlsReadWrite) for more diagnostics.

Michael

On Fri, Oct 14, 2011 at 5:57 PM, Sarah_R_edu sarah_r_...@hotmail.com wrote:

 /Michael Weylandt/


 i used read.xls() and i install the packages : xlsReadWrite and getshlib
 before using this command  but, did not work.

 anyway i waiting for you.


 thank you so much. (Flowers)

 -
 We are all like the bright moon, we still have our darker side

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/help-to-import-the-data-from-Excel-tp3893382p3906354.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-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] rpois 0

2011-10-14 Thread Rolf Turner

On 15/10/11 10:15, knut-o wrote:

Hello
what is the easiest way to generate rpois(m,lambda) but only values greater
than 0 and length = m.
tanks, knut


The rpospois() function from the VGAM package is what you are looking for.

I found this by doing:

RSiteSearch(truncated Poisson)

and scrabbling through the results a bit.

[Give a man a fish and you feed him for a day.  Teach a man
 to fish ... and you destroy an eco-system. :-) ]

cheers,

Rolf Turner

__
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 keep a coefficient fixed when using rq {quantreg}?

2011-10-14 Thread Tal Galili
Hello all,

I would like to compute a quantile regression using rq (from the
quantreg package), while keeping one of the coefficients fixed.
Is it possible to set an offset for rq in quantreg?  (I wasn't able to
make it to work)

Thanks,
Tal



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew)
| www.r-statistics.com (English)

__
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] Irregular 3d objects with rgl

2011-10-14 Thread emorway
Hello, 

While exploring if rgl is along the lines of what I need, I checked out
demo(rgl) and didn't find quite what I'm looking for, and am therefore
seeking additional help/suggestions.

The application is geared towards displaying a 3D rendering of a contaminant
plume in the subsurface with the following highlights:  Once the plume was
rendered as a 3D object, a pie-like wedge could be removed (or cut away)
exposing the higher concentrations within the plume as 'hotter' colors. 
About the closest example I could find is here: 

http://mclaneenv.com/graphicdownloads/plume.jpg 

Whereas this particular rendering shows a bullet-like object where 3/4 of
the object is removed, I would like to try and show something where 3/4 of
the object remains, and where the object has been cut away the colors would
show concentrations within the plume, just as in the example referenced
above.  It would seem most software capable of this type of thing is
proprietary (and perhaps for good reason if it is a difficult problem to
solve). 

I've put together a very simple 6x6x6 cube with non-zero values internal to
it representing the plume.  I wondering if an isosurface where conc = 0.01
can be rendered in 3D and then if a bite or wedge can be removed from the
3d object exposing the higher concentrations inside as discussed above?

x-c(1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6)

y-c(1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6)

z-c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6)

conc-c(0,0,0,0,0,0,0,0,0.1,0.1,0,0,0,0.1,1,1,0.1,0,0,0.1,0.5,1,0.1,0,0,0,0.2,0.2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.05,0.1,0,0,0,0.05,0.8,0.8,0.05,0,0,0.05,0.4,0.8,0.05,0,0,0,0.1,0.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.05,0,0,0,0,0.6,0.6,0.02,0,0,0,0.2,0.5,0.02,0,0,0,0.05,0.05,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.05,0.2,0,0,0,0,0,0.05,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.02,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

plume-data.frame(cbind(x=x,y=y,z=z,conc=conc))

if it helps to view the concentrations in layer by layer tabular form:
Layer 1
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.10 0.10 0.00 0.00
0.00 0.10 1.00 0.50 0.20 0.00
0.00 0.10 1.00 1.00 0.20 0.00
0.00 0.00 0.10 0.10 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
Layer 2 
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.05 0.05 0.00 0.00
0.00 0.05 0.80 0.40 0.10 0.00
0.00 0.10 0.80 0.80 0.10 0.00
0.00 0.00 0.05 0.05 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
Layer 3 
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.60 0.20 0.05 0.00
0.00 0.05 0.60 0.50 0.05 0.00
0.00 0.00 0.02 0.02 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
Layer 4 
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.05 0.00 0.00 0.00
0.00 0.00 0.20 0.05 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
Layer 5 
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.02 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
Layer 6
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00




--
View this message in context: 
http://r.789695.n4.nabble.com/Irregular-3d-objects-with-rgl-tp3906573p3906573.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] help to ... import the data from Excel

2011-10-14 Thread Sarah_R_edu
*/David/*

i used the following command :

 z -
read.xls(file=C:\\Users\\user\\Desktop\\LTS.xls,colNames=FALSE,rowNames=FALSE)

z - read.table(file=C:\\Users\\user\\Desktop\\LTS.xls)

and i have the packages : xlsReadWrite and gdata , my R version is 2.13.2
(2011-09-30)

but all these did not got me any result !






-
We are all like the bright moon, we still have our darker side 

--
View this message in context: 
http://r.789695.n4.nabble.com/help-to-import-the-data-from-Excel-tp3893382p3906511.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] glmmadmb help

2011-10-14 Thread chchjames
Hello everyone,

I am using the alpha version of glmmadmb, and it works for most of the time
except for one of my models. The weird thing is that it has worked before, a
couple of months ago, and for some reason it won't now and nothing has
changed.

The code is:
nbin5-glmmadmb(stainp~beetle.ev+Caged*Section/SegmentT+(1|Site)+(1|Log.code),data=dat1,family=nbinom)

And it thinks for a while before giving me the error:
Error in glmmadmb(stainp ~ beetle.ev + Caged * Section/SegmentT + (1 |  : 
  The function maximizer failed
In addition: Warning message:
running command './glmmadmb -maxfn 500' had status 1 

I have narrowed it down, and the factor it has trouble with is beetle.ev.
This is a column of binary data which is presence or absence of beetles.
There are only 0's and 1's in this column. The really weird thing is that I
have another column for a different beetle (beetle), binary also, which
works fine!

I have tried re-entering the data in another column, putting the beetle.ev
data in the beetle column, and nothing seems to work.

Any help would be much appreciated!

Thanks,
James



--
View this message in context: 
http://r.789695.n4.nabble.com/glmmadmb-help-tp3906469p3906469.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] using do.call to call a list of functions

2011-10-14 Thread honeyoak
Thanks for the reference, the each function in the plyr package is exactly
what I wanted.

--
View this message in context: 
http://r.789695.n4.nabble.com/using-do-call-to-call-a-list-of-functions-tp3906337p3906574.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] help to ... import the data from Excel

2011-10-14 Thread David Winsemius


On Oct 14, 2011, at 7:37 PM, Sarah_R_edu wrote:


*/David/*

i used the following command :

z -
read.xls(file=C:\\Users\\user\\Desktop\ 
\LTS.xls,colNames=FALSE,rowNames=FALSE)


As I pointed out earlier this would have produced an error on my  
system because the arguemtnts do not exist in eitehr read.xls or  
read.table  and you are asked to report verbatim all error messages.


z - read.table(file=C:\\Users\\user\\Desktop\\LTS.xls)

and i have the packages : xlsReadWrite and gdata , my R version is  
2.13.2

(2011-09-30)

but all these did not got me any result !


How do we know this did not get you a result. Any errors? Warnings?  
What does these show after:


ls()   # z should be in there
str(z)  # information about z

(It seems possible that you do not understand that objects might get  
created without any message about that fact.)


--
David Winsemius, MD
West Hartford, CT

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


Re: [R] using do.call to call a list of functions

2011-10-14 Thread David Winsemius


On Oct 14, 2011, at 8:14 PM, honeyoak wrote:

Thanks for the reference, the each function in the plyr package is  
exactly

what I wanted.


I doubt it. You have not looked at the `each` code. Its just a wrapper  
for a for loop and on StackOverfolw you started out saying that you  
were rejecting for() loops and sapply() solutions because you thought  
they were too slow. And you did not want to put any work into doing  
performance analysis of your 40 or so functions that you planned on  
testing  so,  as they say these days good luck with that.




--
View this message in context: 
http://r.789695.n4.nabble.com/using-do-call-to-call-a-list-of-functions-tp3906337p3906574.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.


David Winsemius, MD
West Hartford, CT

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


  1   2   >