[R] Outlier Problem in Survreg Function

2010-07-25 Thread Vipul Agarwal

Hi Everyone,
I have recently started using r and working on survival analysis using the
function survreg.
I am facing a trange problem. One of the covariates in my analysis has
outliers because of which survreg is giving incorrect results. Howevere when
I am removing the outliers or scaling down the values of the covariate by a
factor of 2 it is giving correct results. Below is a ditribution of the
ariable and the results 

   Min. 1st Qu.  MedianMean 3rd Qu.Max. 
  0   3   54500   95450  123000 165 

Survreg Resuts

survreg(formula = Surv(TIME_TO_FAILURE, CENSOR_DEFAULT) ~ ADVANCE, 
data = data)

Coefficients:
(Intercept) ADVANCE 
   0.00   -6.385336 

Scale= 0.9785933 

Loglik(model)= -40227366   Loglik(intercept only)= -914141
Chisq= -78626451 on 1 degrees of freedom, p= 1 
n=198099 (885 observations deleted due to missingness)

Survreg Results after scaling down the variable by 10 

survreg(formula = Surv(TIME_TO_FAILURE, CENSOR_DEFAULT) ~ ADVANCE_SCALED, 
data = data)

Coefficients:
   (Intercept) ADVANCE_SCALED 
  4.132962e+00  -2.181577e-05 

Scale= 0.9428758 

Loglik(model)= -909139.4   Loglik(intercept only)= -914141
Chisq= 10003.19 on 1 degrees of freedom, p= 0 
n=198099 (885 observations deleted due to missingness)

Survreg Results Afte removing the outliers(5% of the obs)

 data - subset(data,data$ADVANCE = 20)
 survreg(Surv(TIME_TO_FAILURE,CENSOR_DEFAULT) ~ ADVANCE , data = data )
Call:
survreg(formula = Surv(TIME_TO_FAILURE, CENSOR_DEFAULT) ~ ADVANCE, 
data = data)

Coefficients:
  (Intercept)   ADVANCE 
 4.224298e+00 -3.727171e-06 

Scale= 0.9601186 

Loglik(model)= -822521.9   Loglik(intercept only)= -825137.1
Chisq= 5230.49 on 1 degrees of freedom, p= 0 
n=177332 (444 observations deleted due to missingness)


Please let me know if someone else has faced the same problem and what is
the way around to deal with it ? Should I scale down the variable or remove
the outliers? 
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Outlier-Problem-in-Survreg-Function-tp2301422p2301422.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] Equivalent to go-to statement

2010-07-25 Thread Gabor Grothendieck
On Sun, Jul 25, 2010 at 1:57 AM, Michael Haenlein
haenl...@escpeurope.eu wrote:
 Dear all,

 I'm working with a code that consists of two parts: In Part 1 I'm generating
 a random graph using the igraph library (which represents the relationships
 between different nodes) and a vector (which represents a certain
 characteristic for each node):

 library(igraph)
 g - watts.strogatz.game(1,100,5,0.05)
 z - rlnorm(100,0,1)

 In Part 2 I'm iteratively changing the elements of z in order to reach a
 certain value of a certain target variable. I'm doing this using a while
 statement:

 while (target_variable  threshold) {## adapt z}

 The problem is that in some rare cases this iterative procedure can take
 very long (a couple of million of iterations), depending on the specific
 structure of the graph generated in Part 1. I therefore would like to change
 Part 2 of my code in the sense that once a certain threshold number of
 iterations has been achieved, the iterative process in Part 2 stops and goes
 back to Part 1 to generate a new graph structure. So my idea is as follows:

 - Run Part 1 and generate g and z
 - Run Part 2 and iteratively modify z to maximize the target variable
 - If Part 2 can be obtained in less than X steps, then go to Part 3
 - If Part 2 takes more than X steps then go back to Part 1 and start again

 I think that R does not have a function like go-to or go-back.

 Does anybody know of a convenient way of doing this?

 Thanks very much for your help,


goto's can be replaced with loops.  In this case create a double loop
such that the outer loop does not repeat if the inner loop finished
due to reaching the target:

target_variable - -Inf
while(target_variable  threshold) {
...
iter - 0
while(target_variable  threshold  iter  max_iter) {
   ... update iter and target_variable ...
}
}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] UseR! 2010 - my impressions

2010-07-25 Thread friedrich . leisch
 On 07/23/2010 06:50 PM, Ravi Varadhan wrote:
 Dear UseRs!,

 Everything about UseR! 2010 was terrific!  I really mean everything -
 the tutorials, invited talks, kaleidoscope sessions, focus sessions,
 breakfast, snacks, lunch, conference dinner, shuttle services, and the
 participants. The organization was fabulous.  NIST were gracious hosts,
 and provided top notch facilities.  The rousing speech by Antonio
 Possolo, who is the chief of Statistical Engineering Division at NIST,
 set the tempo for the entire conference.  Excellent invited lectures by
 Luke Tierney, Frank Harrell, Mark Handcock, Diethelm Wurtz, Uwe Ligges,
 and Fritz Leisch.  All the sessions that I attended had many interesting
 ideas and useful contributions.  During the whole time that I was there,
 I could not help but get the feeling that I am a part of something
 great.

 Before I end, let me add a few words about a special person.  This
 conference would not have been as great as it was without the tireless
 efforts of Kate Mullen.  The great thing about Kate is that she did so
 much without ever hogging the limelight.  Thank you, Kate and thank you
 NIST!

 I cannot wait for UseR!2011!

 Best,
 Ravi.

 

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

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

 I want to echo what Ravi said.  The talks were terrific (thanks to the
 program committee and the speakers) and Kate Mullen and her team did an
 extraordinary job in putting the conference together and running it.  I
 am proud to have been a part of it.  Thank you all!


Yes. I fully agree and can only thank Kate and the rest of the NIST team
again and again for the great job they did.

Hope everybody ha[sd] a safe trip home (mine will be in a few hours).

Best,
Fritz Leisch



--
Prof. Dr. Friedrich Leisch

Institut für Statistik
Ludwig-Maximilians-Universität
Ludwigstraße 33, D-80539 München

Tel: (+49 89) 2180 3165
Fax: (+49 89) 2180 5308
http://www.stat.uni-muenchen.de/~leisch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Discrepancy in help for object.size() and question on how to round object sizes

2010-07-25 Thread Jennifer Lyon
I think there is a discrepancy In the help for object.size().

In the usage section there is the comment:
## S3 method for class 'object_size':

while in the value section there is the text:
 An object of class ‘object.size’ ...

And R itself says:

  class(object.size(letters))
[1] object_size

Also, I was trying to print out object sizes in Kb, but rounded to
whole number of units, but I could not
figure out how to do that without having to replicate the math in the
print method for object.size.

 tmp-numeric(10)
 object.size(tmp)
800024 bytes

 print(object.size(tmp), units=Kb)
781.3 Kb

What I want is 781 Kb, but it wasn't obvious how to get there. The
following seemed wrong, and
didn't work:

 print(signif(object.size(tmp),1), units=Kb)
781.2 Kb
 print(round(object.size(tmp)), units=Kb)
781.3 Kb

I know I can just get the result in bytes and divide by 1024, and then
round, but it seemed like there
should be a more straightforward way, so any suggestions are welcome.

Thanks!

Jen

 sessionInfo()
R version 2.11.1 (2010-05-31)
i686-pc-linux-gnu

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=C  LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  utils datasets  grDevices methods   base

other attached packages:
[1] RColorBrewer_1.0-2

loaded via a namespace (and not attached):
[1] tools_2.11.1

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] error using predict

2010-07-25 Thread Xebar Saram
Hi

I am very new to R (so excuse me in advance if this is pretty trivial)

I am using the predict function to get prediction on a dataset from
another dataset using the follwoing command:


newpredT2003 = predict( object=out.model_T2003, newdata=aodmc_2003 , level = 0 )

yet i get this error:

Error in na.fail.default(list(AOD = c(0.092, 0.081, 0.086, 0.085, 0.09,  :
  missing values in object
Calls: predict ... model.frame.default - Anonymous - na.fail.default

i think its something simple but cant find any info when googling..can
anyone point me in the right direction on what needs to be done to fix
the errors?

thx

Ethan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Discrepancy in help for object.size() and question on how to round object sizes

2010-07-25 Thread Duncan Murdoch

On 25/07/2010 7:58 AM, Jennifer Lyon wrote:

I think there is a discrepancy In the help for object.size().

In the usage section there is the comment:
## S3 method for class 'object_size':

while in the value section there is the text:
 An object of class ‘object.size’ ...

And R itself says:

  class(object.size(letters))
[1] object_size


Thanks, I'll fix the typo.



Also, I was trying to print out object sizes in Kb, but rounded to
whole number of units, but I could not
figure out how to do that without having to replicate the math in the
print method for object.size.


I don't think there's any simple way to do it.  You can see the print 
method using


utils:::print.object_size

and it has one decimal point hard coded into the calls to round().  So 
you could copy that print method and change the rounding, or if you 
don't mind sloppy truncating rather than proper rounding, you could do a 
hack like this:


wholesize - function(x, units=b) {
   size - capture.output(print(object.size(x), units=units))
   cat( sub(\\.[[:digit:]], , size), \n )
}

We could add a decimals argument to the version in R, but I'd rather 
not:  it just introduces another point for people to confuse formatting 
with rounding, e.g. if the size is exactly 1000 Kb, should it be printed 
as 1000.0 Kb if you ask for 1 decimal?  (Currently it will print as 1000 
Kb.)


Duncan Murdoch




tmp-numeric(10)
object.size(tmp)

800024 bytes


print(object.size(tmp), units=Kb)

781.3 Kb

What I want is 781 Kb, but it wasn't obvious how to get there. The
following seemed wrong, and
didn't work:


print(signif(object.size(tmp),1), units=Kb)

781.2 Kb

print(round(object.size(tmp)), units=Kb)

781.3 Kb

I know I can just get the result in bytes and divide by 1024, and then
round, but it seemed like there
should be a more straightforward way, so any suggestions are welcome.

Thanks!

Jen


sessionInfo()

R version 2.11.1 (2010-05-31)
i686-pc-linux-gnu

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=C  LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  utils datasets  grDevices methods   base

other attached packages:
[1] RColorBrewer_1.0-2

loaded via a namespace (and not attached):
[1] tools_2.11.1

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Manage several graphical devices in interactive mode

2010-07-25 Thread Sébastien Bihorel
Dear R-users,

Does anybody know a good way to create and use several graphical devices at
the same time in interactive mode? Ideally, I'd like to open 2 to 3 devices
and assign names to them. This way, I could make any
addition/modification/update to a particular device using its name.

I did not see anything like a name argument in ?X11. Is there an
alternative?

Thanks in advance for your feeback.

Sebastien

[[alternative HTML version deleted]]

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


[R] R equivalent of SAS proc freq

2010-07-25 Thread Sébastien Bihorel
Dear R-users,

I am looking for a R function that would be the equivalent of the SAS proc
freq (
http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#/documentation/cdl/en/procstat/63104/HTML/default/procstat_freq_sect006.htm).
The table, ftable, xtabs functions are close but do not quite offer the same
capabilities (e.g. they just return counts and no %ages as far as I could
tell).
I wanted to check with the group if there would already be such a function
in base or in a contribution package, before I start coding my own function.

Thanks for your feedback.

[[alternative HTML version deleted]]

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


Re: [R] R equivalent of SAS proc freq

2010-07-25 Thread David Winsemius


On Jul 25, 2010, at 9:32 AM, Sébastien Bihorel wrote:


Dear R-users,

I am looking for a R function that would be the equivalent of the  
SAS proc

freq (
http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#/ 
documentation/cdl/en/procstat/63104/HTML/default/ 
procstat_freq_sect006.htm).
The table, ftable, xtabs functions are close but do not quite offer  
the same
capabilities (e.g. they just return counts and no %ages as far as I  
could

tell).
I wanted to check with the group if there would already be such a  
function
in base or in a contribution package, before I start coding my own  
function.


There are a couple of efforts to imitate the Proc FREQ output in the  
archives. If you use one of the several search facilities (e.g. RSeek,  
the RSiteSearch function or the ??? function in the sos library) you  
will get links to those:


(A test of this theory with RSeek pointed to the CrossTable function  
in gmodels.)


Try also with...

?RsiteSearch

RSiteSearch()

Or with ...

require(sos)
???proc freq sas

--

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] Manage several graphical devices in interactive mode

2010-07-25 Thread Ted Harding
On 25-Jul-10 13:22:11, Sébastien Bihorel wrote:
 Dear R-users,
 
 Does anybody know a good way to create and use several graphical
 devices at the same time in interactive mode? Ideally, I'd like
 to open 2 to 3 devices and assign names to them. This way, I could
 make any addition/modification/update to a particular device using
 its name.
 
 I did not see anything like a name argument in ?X11. Is there an
 alternative?
 
 Thanks in advance for your feeback.
 Sebastien

You can certainly do this by hand. The basic R terminal is device
number 1. If you do X11() (or invoke it implicitly by using a 'plot'
command) this will be device number 2. With just this one open, any
'plot' (or plot-related) commands will re-use it.

However, having opened device #2, you can do X11() again and get a
second graphics device which will be number 3. And so on, for as many
additional devices as you like.

By default, the device that the results of any 'plot' command are
sent to will be the most recently opened one. However, you can select
the device using the command dev.set(n) where n ( = 2,3,... ) is the
device you want to use. The device which is active will be shown
by the word (ACTIVE) attached to its display. All other devices
will show (inactive).

You could name your devices by indexing a vector (2:n) by names.

Try the following, Starting with no graphics devices open:

X11()  # dev 2
X11()  # dev 3
X11()  # dev 4  ## This one is currently active
   ## Arange these so that you can see all their top bars
devN - c(plotA=2,plotB=3,plotC=4)

dev.set(devN[plotA])  # dev 2 is active

dev.set(devN[plotC])  # dev 4 is active

dev.set(devN[plotB])  # dev 3 is active

dev.set(devN[plotA])  # dev 2 is active

dev.set(devN[plotC])  # dev 4 is active

Hoping this helps,
Ted.


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 25-Jul-10   Time: 15:03:14
-- XFMail --

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


Re: [R] R equivalent of SAS proc freq

2010-07-25 Thread Corey Sparks

you can use prop.tables() on a table() object to get %ages, does this do what
you need?


-
Corey Sparks, PhD
Assistant Professor
Department of Demography and Organization Studies
University of Texas at San Antonio
501 West Durango Blvd
Monterey Building 2.270C
San Antonio, TX 78207
210-458-3166
corey.sparks 'at' utsa.edu
https://rowdyspace.utsa.edu/users/ozd504/www/index.htm
-- 
View this message in context: 
http://r.789695.n4.nabble.com/R-equivalent-of-SAS-proc-freq-tp2301547p2301607.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] Manage several graphical devices in interactive mode

2010-07-25 Thread Duncan Murdoch

On 25/07/2010 10:03 AM, (Ted Harding) wrote:

On 25-Jul-10 13:22:11, Sébastien Bihorel wrote:

Dear R-users,

Does anybody know a good way to create and use several graphical
devices at the same time in interactive mode? Ideally, I'd like
to open 2 to 3 devices and assign names to them. This way, I could
make any addition/modification/update to a particular device using
its name.

I did not see anything like a name argument in ?X11. Is there an
alternative?

Thanks in advance for your feeback.
Sebastien


You can certainly do this by hand. The basic R terminal is device
number 1. If you do X11() (or invoke it implicitly by using a 'plot'
command) this will be device number 2. With just this one open, any
'plot' (or plot-related) commands will re-use it.

However, having opened device #2, you can do X11() again and get a
second graphics device which will be number 3. And so on, for as many
additional devices as you like.

By default, the device that the results of any 'plot' command are
sent to will be the most recently opened one. However, you can select
the device using the command dev.set(n) where n ( = 2,3,... ) is the
device you want to use. The device which is active will be shown
by the word (ACTIVE) attached to its display. All other devices
will show (inactive).

You could name your devices by indexing a vector (2:n) by names.

Try the following, Starting with no graphics devices open:

X11()  # dev 2
X11()  # dev 3
X11()  # dev 4  ## This one is currently active


That's the right idea, but I wouldn't count on the numbers coming out 2, 
3, 4:  what if another device was already opened?  Better to use 
dev.cur() just after you open a new device to find out what its number 
was.  So do something like


X11()
plotA - dev.cur()

X11()
plotB - dev.cur()

X11()
plotC - dev.cur()


dev.set(plotA)  # first one is active

etc.

Duncan Murdoch


   ## Arange these so that you can see all their top bars
devN - c(plotA=2,plotB=3,plotC=4)

dev.set(devN[plotA])  # dev 2 is active

dev.set(devN[plotC])  # dev 4 is active

dev.set(devN[plotB])  # dev 3 is active

dev.set(devN[plotA])  # dev 2 is active

dev.set(devN[plotC])  # dev 4 is active

Hoping this helps,
Ted.


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 25-Jul-10   Time: 15:03:14
-- XFMail --

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Optmatch

2010-07-25 Thread nero

Hello ,

i want to work with the optmatch-package
(http://cran.r-project.org/web/packages/optmatch/index.html)..
Like many other packages , the information-window opens after the
library()-command.

How can i stop this? The Information-Window must not open a single time! 
How can i handle this problem?

regards Nero
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Optmatch-tp2301676p2301676.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] Mask grid in R

2010-07-25 Thread Agustín Muñoz
Hi all,

 

I want to cut a grid (Interpolation) with a Polygon in R, one knows how to do 
it...

 

I hope I can help, as they always do.

 

from now, thank you very much.

 

Regards...

 

Saludos Cordiales...

 

Agustín Muñoz M.

 


[[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] Left Outer Join 2 DF's on Multiple Conditions

2010-07-25 Thread harsh yadav
Hi,

I am trying to execute the following SQL statement using two data frames:

tab1, tab2 : Two Tables

Select tab1.*, tab2.*, tab1.tobiiTime - tab2.ruiTime as timeDiff,
IFNULL(n-m, -999) as alwaysIncrement
  FROM tab1
LEFT OUTER JOIN tab2 On tab1.data1 - tab2.mouseX = 0 And tab1.data2 -
tab2.mouseY = 0


I am trying to do the following in R:-

*#Getting error here:*
data - merge(tab1,tab2, all.x=TRUE, by=(data$data1 - data$mouseX == 0),
by=(data$data2 - data$mouseY == 0))
 data - cbind(data, data[, tobiiTime] - data[, ruiTime], data[, n] -
data[, m])

#Change name of column tobiiTime-ruiTime to timeDiff, for convenience
data - rename(data, c(tobiiTime-ruiTime=timeDiff))

#Change name of column n-m to alwaysIncrement, for convenience
data - rename(data, c(n-m=alwaysIncrement))

*In the merge step, I want to include the following condition of merging:-*
tab1.data1 - tab2.mouseX = 0 And tab1.data2 - tab2.mouseY = 0

Any ideas how this could be done.

Thanks in advance.

Regards,
Harsh Yadav

[[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] 3d topographic map

2010-07-25 Thread sheck

Hi All-

I would like to create a 3d topographic map using lat/lon and 
z(height).  I have been scouring the R help pages and have not located 
the package I am looking for.  Does anyone have a suggestion of package 
that will work for this?


thanks-

sherri

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] 3d topographic map

2010-07-25 Thread David Winsemius


On Jul 25, 2010, at 6:31 PM, sh...@ucar.edu wrote:


Hi All-

I would like to create a 3d topographic map using lat/lon and  
z(height).  I have been scouring the R help pages and have not  
located the package I am looking for.  Does anyone have a suggestion  
of package that will work for this?


thanks-


I suspect most viewers of this message are going to be puzzled. If  
wireframe and contourplot are not doing it for you, what are the  
problems?


Surely you found references to Lattice and wireframe. The Lattice  
system has a worked example in Figure 6.11 from this page:

http://lmdvr.r-forge.r-project.org/figures/figures.html

A search for topographic in one of the r searching facilities is  
sure to bring multiple hits, . including the usual starting point:


https://svn.r-project.org/R/trunk/src/library/graphics/demo/graphics.R

So there must be details and issues that you have not chosen to  
disclose.


--
David.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Left Outer Join 2 DF's on Multiple Conditions

2010-07-25 Thread Nikhil Kaza

Look at sqldf package, it is easier to do sql like statements with it.

Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina

nikhil.l...@gmail.com

On Jul 25, 2010, at 6:10 PM, harsh yadav wrote:


Hi,

I am trying to execute the following SQL statement using two data  
frames:


tab1, tab2 : Two Tables

Select tab1.*, tab2.*, tab1.tobiiTime - tab2.ruiTime as timeDiff,
IFNULL(n-m, -999) as alwaysIncrement
 FROM tab1
LEFT OUTER JOIN tab2 On tab1.data1 - tab2.mouseX = 0 And tab1.data2 -
tab2.mouseY = 0


I am trying to do the following in R:-

*#Getting error here:*
data - merge(tab1,tab2, all.x=TRUE, by=(data$data1 - data$mouseX ==  
0),

by=(data$data2 - data$mouseY == 0))
data - cbind(data, data[, tobiiTime] - data[, ruiTime], data[,  
n] -

data[, m])

#Change name of column tobiiTime-ruiTime to timeDiff, for convenience
data - rename(data, c(tobiiTime-ruiTime=timeDiff))

#Change name of column n-m to alwaysIncrement, for convenience
data - rename(data, c(n-m=alwaysIncrement))

*In the merge step, I want to include the following condition of  
merging:-*

tab1.data1 - tab2.mouseX = 0 And tab1.data2 - tab2.mouseY = 0

Any ideas how this could be done.

Thanks in advance.

Regards,
Harsh Yadav

[[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] CRAN (and crantastic) updates this week

2010-07-25 Thread Crantastic
CRAN (and crantastic) updates this week

New packages


* evaluate (0.1)
  Hadley Wickham
  http://crantastic.org/packages/evaluate

  Parsing and evaluation tools that make it easy to recreate the command
  line behaviour of R.

* multitaper (0.1-1)
  Karim Rahim
  http://crantastic.org/packages/multitaper

  

* operator.tools (1.0.0)
  Christopher Brown
  http://crantastic.org/packages/operator-tools

  Utilities for working with R's operators

* pglm (0.1-0)
  Yves Croissant
  http://crantastic.org/packages/pglm

  Estimation of panel models for glm-like models: this includes binomial
  models (logit and probit) count models (poisson and negbin) and
  ordered models (logit and probit)

* rvgtest (0.5.0)
  Josef Leydold
  http://crantastic.org/packages/rvgtest

  Test suite for non-uniform pseudo-random number generators.

* sigclust (1.0.0)
  Hanwen Huang
  http://crantastic.org/packages/sigclust

  SigClust is a statistical method for testing the significance of
  clustering results. SigClust can be applied to assess the
  statistical significance of splitting a data set into two clusters.
  For more than two clusters, SigClust can be used iteratively.

* SII (1.0.0)
  Gregory R. Warnes
  http://crantastic.org/packages/SII

  This package calculates ANSI S3.5-1997 Speech Intelligibility Index
  (SII), a standard method for computing the intelligibility of speech
  from acoustical measurements of speech, noise, and hearing
  thresholds. This package includes data frames corresponding to
  Tables 1 - 4 in the ANSI standard as well as a function utilizing
  these tables and user-provided hearing threshold and noise level
  measurements to compute the SII score.  The methods implemented here
  extend the standard computations to allow calculation of SII when
  the measured frequencies do not match those required by the standard
  by applying interpolation to obtain values for the required
  frequencies -- Development of this package was funded by the Center
  for Bioscience Education and Technology (CBET) of the Rochester
  Institute of Technology (RIT).

* someMTP (1.0)
  Unknown
  http://crantastic.org/packages/someMTP

  It is a collection of functions for Multiplicty Correction and
  Multiple Testing.


Updated packages


actuar (1.1-1), AnalyzeFMRI (1.1-12), aqp (0.90), asbio (0.3-12), BAS
(0.90), bibtex (0.2-1), bigtabulate (1.0.13), binGroup (1.0-6), caret
(4.44), CHNOSZ (0.9-1), cmaes (1.0-9), COZIGAM (2.0-3), cxxPack
(7.0.6), dcemriS4 (0.32), distrMod (2.2.2), DoseFinding (0.2-2), DOSim
(1.2), dplR (1.3.6), dti (0.9-2.1), dynaTree (1.0-1), epiR (0.9-26),
ergm (2.2-5), eVenn (1.21), FAMT (2.1), flashClust (1.00-2), forensim
(1.1-7), GEOmap (1.5-8), gridExtra (0.6.5), hergm (1.2-6), hmm.discnp
(0.1-3), hts (1.2), HWEintrinsic (1.1), JM (0.6-2), lqa (1.0-3),
mclust (3.4.5), MCPMod (1.0-7), memisc (0.95-31), miniGUI (0.7.0),
minqa (1.1.9), mixsmsn (0.2-5), mlogit (0.1-8), mokken (2.4), mondate
(0.9.6), MplusAutomation (0.3-3), mra (2.6), np (0.40-3), ordinal
(2010.07-06), pamctdp (0.1.5), pcaPP (1.8-2), pgirmess (1.4.7),
phylobase (0.6.0), picante (1.2-0), plm (1.2-5), plspm (0.1-7), plyr
(1.1), PolynomF (0.94), PowerTOST (0.6-2), psych (1.0-90), PtProcess
(3.2-5), R.filesets (0.8.3), r4ss (1.07), raster (1.3-1), rattle
(2.5.36), rbugs (0.4-4), Rcgmin (0.8), RFLPtools (1.3), rgdal
(0.6-28), RMySQL (0.7-5), RpgSQL (0.1-3.1), rredis (1.4), RSEIS
(2.4-1), RSQLite (0.9-2), Rvmmin (0.95), rwm (1.49), saws (0.9-3.3),
SensoMineR (1.11), simPopulation (0.1.3), soil.spec (1.4), sp
(0.9-66), sparr (0.2-1), spdep (0.5-16), spgrass6 (0.6-19),
stratigraph (0.62), SV (1.3.0), TeachingSampling (1.7.9), tgp (2.3-4),
traitr (0.9), TripleR (0.4), vegdata (0.1.8), x12 (0.0-7), xlsx
(0.2.2), YieldCurve (3.0)



This email provided as a service for the R community by
http://crantastic.org.

Like it?  Hate it?  Please let us know: crana...@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.


[R] Is there a function to interdigitate two columns?

2010-07-25 Thread Bryan Hanson
Hello List Inhabitants:

I don¹t know what this operation is called or if there is a function that
does it automatically, hence I seek your help!

If I divide a large data collection tasks between two students, and I have a
master list of samples, but one student records some of the values, and the
other student the remainder, I need to get the two sets of student
measurements into one column.  Here¹s an example:

samp - LETTERS[1:10] # sample names
student1 - c(NA, NA, 22, 34.3, NA, 10.5, 19.7, 20.22, NA, 12.9)
student2 - c(25.5,29.4, NA, NA, 13.6, NA, NA, NA, 17.0, NA)
merged - c(25.5,29.4, 22, 34.3, 13.6, 10.5, 19.7, 20.22, 17.0, 12.9)

df1 - data.frame(samp, student1)
df2 - data.frame(samp, student2)

merge(df1, df2) # these don't quite do what I want
join(df1, df2) # in latest release of plyr

What I need is to take the two columns of student data and merge them into
one that contains a single value for each sample, that is, I want to
generate a 2-column data frame containing samp and merged as shown above

I can write a function to do this (maybe not a great one) but I'd like to
know if it already exists.  Seems like it ought to be a common process, but
as I'm not sure what it's called I'm having trouble searching.

Thanks as always, Bryan
*
Bryan Hanson
Acting Chair
Professor of Chemistry  Biochemistry
DePauw University, Greencastle IN USA

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 a function to interdigitate two columns?

2010-07-25 Thread RICHARD M. HEIBERGER
 result - data.frame(samp=samp, merged=ifelse(is.na(student2), student1,
student2))
 result
   samp merged
1 A  25.50
2 B  29.40
3 C  22.00
4 D  34.30
5 E  13.60
6 F  10.50
7 G  19.70
8 H  20.22
9 I  17.00
10J  12.90


Rich

[[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] Loading Rdata files in a Package

2010-07-25 Thread Andrew Leeser
I have an .Rdata file saved in my data folder in a package I created. 
However, 
when I use the data() function it doesn't recognize that there any dataset 
exists within the package. Is there anything specific I need to do such that 
the 
data() function will load my dataset?

Thanks in advance,
Andrew


  
[[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] package for rank ordered logit

2010-07-25 Thread zachmohr

You may want to try a multinomial logit, mlogit{mlogit}.  Hope this helps.

On Fri, Jul 16, 2010 at 11:42 AM, Suresh Singh-2 [via R] 
ml-node+2291644-2038081369-246...@n4.nabble.comml-node%2b2291644-2038081369-246...@n4.nabble.com
 wrote:

 My understanding is that polr will do ordered logit but I am not sure if it

 is also suited for rank ordered logit (or is there no such distinction)

 I am thinking of following two situations

 1. there is an ordered response (say small,medium,large coffee) and each
 individual selects one of these options. the order is predetermined i.e we
 know which one is small, medium or large and interested in knowing which
 option is selected. in this case each choice is independent because
 different individuals choose them
 2. an individual ranks some or all the options (say three different types
 of
 coffee). We do not know apriori what the order is beforehand - these ranks
 are dependent because the same individual selects them

 I am calling the 1st situation - ordered logit and 2nd situation - rank
 ordered logit.

 Are these equivalent situations and is polr suited for both?

 Suresh


 On Fri, Jul 16, 2010 at 11:41 AM, Tal Galili [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=2291644i=0
 wrote:

  Did you try:
  library(MASS)
  ?polr
 
  ?
 
 
  Contact
  Details:---
  Contact me: [hidden 
  email]http://user/SendEmail.jtp?type=nodenode=2291644i=1|  
  972-52-7275845
  Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |

  www.r-statistics.com (English)
 
 --


 
 
 
 
  On Fri, Jul 16, 2010 at 6:15 PM, Suresh Singh [hidden 
  email]http://user/SendEmail.jtp?type=nodenode=2291644i=2
 wrote:
 
  Is there a package in R that can run rank-ordered logit?
 
  Thanks,
  Suresh
 
  __
  [hidden email] 
  http://user/SendEmail.jtp?type=nodenode=2291644i=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.
 
 

 [[alternative HTML version deleted]]

 __
 [hidden email] http://user/SendEmail.jtp?type=nodenode=2291644i=4mailing 
 list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


 --
  View message @
 http://r.789695.n4.nabble.com/package-for-rank-ordered-logit-tp2291526p2291644.html
 To unsubscribe from R, click here (link removed) ==.





-- 
Department of Public Administration
University of Kansas
4060 Wesco Hall
Office W
Lawrence KS 66045-3177

Phone: (785) 813-1384
Email: zachm...@gmail.com

-- 
View this message in context: 
http://r.789695.n4.nabble.com/package-for-rank-ordered-logit-tp2291526p2301834.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] Loading Rdata files in a Package

2010-07-25 Thread Charles C. Berry

On Sun, 25 Jul 2010, Andrew Leeser wrote:


I have an .Rdata file saved in my data folder in a package I created. However,
when I use the data() function it doesn't recognize that there any dataset
exists within the package. Is there anything specific I need to do such that the
data() function will load my dataset?


No reproducible example was provided.

Did you provide a name for the .Rdata file? e.g. mydat.RData

Run

example( package.skeleton )

then edit the 'mypkg' Rd files to put add dummy \title{} entries.

Then INSTALL, then run R,

library(mypkg)
data(d)
str(d)

.
.
.

Emulate what you see in mypkg/*

Or use package.skeleton() to get you started.


HTH,

Chuck



Thanks in advance,
Andrew



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



Charles C. Berry(858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cbe...@tajo.ucsd.edu   UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Marginal effects from interaction regression model

2010-07-25 Thread Guillem R.

Dear all,

I'd like to plot the marginal effect of a variable in a multiplicative
interaction regression, that is, the effect of a variable conditional on the
values of another variable. As an illustration, given model lm1

lm1 - lm(y ~ x*z)

I'd like to get the effects of x on y conditional on the values of z, with
the corresponding confidence intervals if possible. Does anyone know of any
package or simple way to do this?

Thanks


-- 
View this message in context: 
http://r.789695.n4.nabble.com/Marginal-effects-from-interaction-regression-model-tp2301858p2301858.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] hatching posibility in Panel.Polygon

2010-07-25 Thread HC

Hatching with lines can be done in polygon function using density and angle
arguments.

Is similar possibility of hatching polygons available when using
panel.polygon while trying to plot in panels using lattice?

Many thanks in advance for your help.
HC
-- 
View this message in context: 
http://r.789695.n4.nabble.com/hatching-posibility-in-Panel-Polygon-tp2301863p2301863.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] Marginal effects from interaction regression model

2010-07-25 Thread David Winsemius


On Jul 25, 2010, at 10:24 PM, Guillem R. wrote:



Dear all,

I'd like to plot the marginal effect of a variable in a multiplicative
interaction regression, that is, the effect of a variable  
conditional on the

values of another variable. As an illustration, given model lm1

lm1 - lm(y ~ x*z)


? predict

Perhaps:

predict(lm1, newdata=data.frame(x=1:10, z=5), interval=confidence)




I'd like to get the effects of x on y conditional on the values of  
z, with
the corresponding confidence intervals if possible. Does anyone know  
of any

package or simple way to do this?

Thanks


--

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] Marginal effects from interaction regression model

2010-07-25 Thread Guillem R.

As far as I know, the predict command gives the predicted values (and
intervals) of y, but what I'm looking for is the conditional effects (betas)
of x on y conditional on values of z.

I'm trying to produce a plot similar to the first shown in this link:
http://homepages.nyu.edu/~mrg217/interaction.html#code

Thanks again



David Winsemius wrote:
 
 
 On Jul 25, 2010, at 10:24 PM, Guillem R. wrote:
 

 Dear all,

 I'd like to plot the marginal effect of a variable in a multiplicative
 interaction regression, that is, the effect of a variable  
 conditional on the
 values of another variable. As an illustration, given model lm1

 lm1 - lm(y ~ x*z)
 
 ? predict
 
 Perhaps:
 
 predict(lm1, newdata=data.frame(x=1:10, z=5), interval=confidence)
 
 

 I'd like to get the effects of x on y conditional on the values of  
 z, with
 the corresponding confidence intervals if possible. Does anyone know  
 of any
 package or simple way to do this?

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

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Marginal-effects-from-interaction-regression-model-tp2301858p2301884.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] hatching posibility in Panel.Polygon

2010-07-25 Thread Deepayan Sarkar
On Sun, Jul 25, 2010 at 7:40 PM, HC hca...@yahoo.co.in wrote:

 Hatching with lines can be done in polygon function using density and angle
 arguments.

 Is similar possibility of hatching polygons available when using
 panel.polygon while trying to plot in panels using lattice?

No.

-Deepayan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Specification Testing in Binary Choice Models

2010-07-25 Thread Amirreza Khosroshahi
Hi,

First of all I'm sorry if my question is repeated. I could not find an
answer to it after searching the mail archive or the whole net.

I have estimated a binary choice (probit, to be specific) model using 'glm'
function in R, and now I want to perform some diagnostic tests, among which
testing for heteroscedasticty is most important for my work.

My question is if there are any packages/functions in R which can perform
these tests for glm's. I know that we have the 'lmtest' package which
includes several tests of specifications, but, as the lmtest package is for
*l*inear *m*odels, I am not sure if its results are also valid for
non-linear glm's.

Specifically, functions that could perform Logit and Probit specification
tests described in Davidson and McKinnon (1984) would be most helpful.

Thank you,

Amirreza

[[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] data arranged by p-values

2010-07-25 Thread jd6688

Id  cat1locationitem_values p-valuessequence
a1111   3002737 0.196504377 0.011   
a1121   3017821 0.196504377 0.052   
a1131   3027730 0.196504377 0.023   
a1141   3036220 0.196504377 0.044   
a1151   3053984 0.196504377 0.035   
a1161   3063892 0.196504377 0.076   
a1171   3076333 0.196504377 0.087   
a1181   3090500 0.196504377 0.028   
a1191   3103304 0.196504377 0.039   
a1201   3119350 0.196504377 0.0510  
a1211   3129884 0.196504377 0.0111  
a1221   3154598 0.196504377 0.0312  
a1231   3170910 0.196504377 0.0513  
a1241   3180712 0.196504377 0.0614  
a1251   3186519 0.196504377 0.0715  
a1261   3192256 0.196504377 0.0916  
a1271   3198441 0.196504377 0.0117  
a1281   3205784 0.196504377 0.0218  
a1291   3210685 0.196504377 0.0319  
a1301   3218542 0.196504377 0.0420  
a1311   3234318 0.196504377 0.0521  
a1321   3239972 0.196504377 0.0922  
a1331   3245663 0.196504377 0.0523  
a1341   3257997 0.196504377 0.0224  
a1351   3273226 0.196504377 0.0326  
a1361   3285404 0.196504377 0.0427  
a1371   3290332 0.196504377 0.0528  
a1381   3300679 0.196504377 0.0329  
a1391   3310164 0.196504377 0.0930  


first of all, please pay attention to the P -values, all the rows with the
p-value 0.05 will be considered as one region until the p-value 0.05
identified. for instance: REGION 1 is the rows from id a111 to id A115 .
REGION 2  is the rows from id a118 to a123, etc.

what i am going to accomplish is to pick the start and end location, and the
peak value from the item_values for each region.

option 1:

   loop through each row until the p-value0.05 identified then
start_location=the first location value
end_location=the location value before the p0.05
peak_value of the item_values=the maximum one

option 2

create a sequence number for each row;
subset the raw dataframe by p0.05;
the p-value regions will be identified by the gapped sequence number.
for instance
   from sequence 1 to 5 will be considering one region.

 Id cat1locationitem_values p-valuessequence
a1111   3002737 0.196504377 0.011   
a1121   3017821 0.196504377 0.052   
a1131   3027730 0.196504377 0.023   
a1141   3036220 0.196504377 0.044   
a1151   3053984 0.196504377 0.035   
a1181   3090500 0.196504377 0.028   
a1191   3103304 0.196504377 0.039   


I need your recommendation on the different approach to implement this?
Thanks,

-- 
View this message in context: 
http://r.789695.n4.nabble.com/data-arranged-by-p-values-tp2301909p2301909.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] p-values calculation

2010-07-25 Thread jd6688

Id  cat1locationitem_values p-valuessequence
a1111   3002737 0.196504377 0.011
a1121   3017821 0.196504377 0.052
a1131   3027730 0.196504377 0.023
a1141   3036220 0.196504377 0.044
a1151   3053984 0.196504377 0.035
a1161   3063892 0.196504377 0.076
a1171   3076333 0.196504377 0.087
a1181   3090500 0.196504377 0.028
a1191   3103304 0.196504377 0.039
a1201   3119350 0.196504377 0.0510
a1211   3129884 0.196504377 0.0111
a1221   3154598 0.196504377 0.0312
a1231   3170910 0.196504377 0.0513
a1241   3180712 0.196504377 0.0614
a1251   3186519 0.196504377 0.0715
a1261   3192256 0.196504377 0.0916
a1271   3198441 0.196504377 0.0117
a1281   3205784 0.196504377 0.0218
a1291   3210685 0.196504377 0.0319
a1301   3218542 0.196504377 0.0420
a1311   3234318 0.196504377 0.0521
a1321   3239972 0.196504377 0.0922
a1331   3245663 0.196504377 0.0523
a1341   3257997 0.196504377 0.0224
a1351   3273226 0.196504377 0.0326
a1361   3285404 0.196504377 0.0427
a1371   3290332 0.196504377 0.0528
a1381   3300679 0.196504377 0.0329
a1391   3310164 0.196504377 0.0930


I would like to calculate the p values for the item_values above.

option 1: z score based
 wData - within(wData, { 
+ z - (values - mean(values))/sd(values) 
+ p-value - 2*pnorm(-abs(z))  ## 2-sided 
+ rm(z) }) 
 wData 

option 2: t distibution based
   
p_value-2*pt(-abs(t),df=n-1)


my questions:
what R function can assist the distribution analysis to the item_values
column above? for instance: normal distribution analysis?

how to calculate the p values if the distribution of the item_values is
no-parameter distribution?

-- 
View this message in context: 
http://r.789695.n4.nabble.com/p-values-calculation-tp2301917p2301917.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] Loading Rdata files in a Package

2010-07-25 Thread Prof Brian Ripley

From ?data


   2. files ending ‘.RData’ or ‘.rda’ are ‘load()’ed.

'.Rdata' (l/c 'd') files are not supported (although on 
case-insensitive file systems they will work in _some_ circumstances, 
but only some. Without the sessionInfo() output we asked for in the 
posting guide, we can only guess if this such a file system.).


On Sun, 25 Jul 2010, Charles C. Berry wrote:


On Sun, 25 Jul 2010, Andrew Leeser wrote:

I have an .Rdata file saved in my data folder in a package I created. 
However,

when I use the data() function it doesn't recognize that there any dataset
exists within the package. Is there anything specific I need to do such 
that the

data() function will load my dataset?


No reproducible example was provided.

Did you provide a name for the .Rdata file? e.g. mydat.RData

Run

example( package.skeleton )

then edit the 'mypkg' Rd files to put add dummy \title{} entries.

Then INSTALL, then run R,

library(mypkg)
data(d)
str(d)

.
.
.

Emulate what you see in mypkg/*

Or use package.skeleton() to get you started.


HTH,

Chuck



Thanks in advance,
Andrew



Charles C. Berry(858) 534-2098
   Dept of Family/Preventive 
Medicine

E mailto:cbe...@tajo.ucsd.edu   UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] NULL

2010-07-25 Thread Yuan Jian
hi,
I have a simple problem.

how can I test whether a variable is NULL?

a = NULL
if (a == NULL){
...
}
it seems not work

thanks

YU





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

2010-07-25 Thread Peter Alspach
Tena koe Yu

?is.null

HTH ...


Peter Alspach

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Yuan Jian
 Sent: Monday, 26 July 2010 5:05 p.m.
 To: r-help@r-project.org
 Subject: [R] NULL
 
 hi,
 I have a simple problem.
 
 how can I test whether a variable is NULL?
 
 a = NULL
 if (a == NULL){
 ...
 }
 it seems not work
 
 thanks
 
 YU
 
 
 
 
 
 
   [[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.