Re: [R] Predictions with missing inputs

2011-02-12 Thread Bernardo Rangel Tura
On Fri, 2011-02-11 at 20:51 -0500, Axel Urbiz wrote:
 Dear users,
 
 I'll appreciate your help with this (hopefully) simple problem.
 
 I have a model object which was fitted to inputs X1, X2, X3. Now, I'd like
 to use this object to make predictions on a new data set where only X1 and
 X2 are available (just use the estimated coefficients for these variables in
 making predictions and ignoring the coefficient on X3). Here's my attempt
 but, of course, didn't work.
 
 #fit some linear model to random data
 
 x=matrix(rnorm(100*3),100,3)
 y=sample(1:2,100,replace=TRUE)
 mydata - data.frame(y,x)
 mymodel - lm(y ~ ns(X1, df=3) + X2 + X3, data=mydata)
 summary(mymodel)
 
 #create new data with 1 missing input
 
 mynewdata - data.frame(matrix(rnorm(100*2),100,2))
 mypred - predict(mymodel, mynewdata)
 Thanks in advance for your help!
 
 Axel.

Axel,

I think mice package solve your problem 

-- 
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil

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

2011-02-12 Thread Jaeik Cho
Yes, this point i can understand your suggestion and I should read HOW TO ASK 
GOOD QUESTIONS.
I'm a just new mailing list, also a R user for researching on graduate school.

Any person can make mistake, also it can be effect to other people, however a 
good person is teaching good way.
Anyway, actually I couldn't understand why you telling me like this, but sorry 
for my English and stupid first mailing list user.

Sorry again.

ps. I don't know also why should I put your name on CC Bert, sorry.
Last of all, R is a kind of professional software. It means many of R user is 
high level educated person at least I think.
Also, so many foreigner using this software who is not good for English 
writing. Please little bit more understand foreign users.

Thanks.

On Feb 11, 2011, at 4:57 PM, David Winsemius wrote:

 
 On Feb 11, 2011, at 4:11 PM, Jaeik Cho wrote:
 
 I mean, after done for the testing step, I want show which data classified 
 to wrong class.
 That predictions.
 
 At this point my suggestion is that your (re?)-read the Posting Guide and 
 determine whether you have adhered to the level of detail and specificity 
 that is implied to be desirable or optimal for questions to r-help. There may 
 be a language issue and without implying any moral issue, the provision of a 
 worked example might be even more important here than it would be in a 
 situation of a shared language.  You might also consult the How to ask good 
 questions link which IIRC is at the bottom of that document.
 
 (My apologies to Bert if this was a question that he really was hoping to 
 answer.)
 
 -- 
 David
 
 Jaeik
 
 
 Begin forwarded message:
 
 From: Bert Gunter gunter.ber...@gene.com
 Date: February 11, 2011 3:00:47 PM CST
 To: David Winsemius dwinsem...@comcast.net
 Cc: Jaeik Cho choja...@gmail.com, r-help@r-project.org
 Subject: Re: [R] About classification methods.
 
 
 
 Which package should I using, and can I compare each classifier result by
 predictions?
 
 
 By prediction on the training data, emphastically no. By prediction on
 new data not used for training, yes.
 
 -- Bert
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] how to improve the precison of this calculation?

2011-02-12 Thread zhaoxing731
Hello
T
I want to order some calculation result, there will be lots of 
result that need to calculate and order
PS: the result is just a intermediate varible and ordering them is 
the very aim

# problem:
# For fixed NT and CT, and some pair (c,n). order the pair by corresponding 
result
# c and n are both random variable

CT-6000#assignment to CT
NT-29535210#assignment to NT

# formulae for calculation intermediate variable result, this is just a 
picture of the calculation which can't implement due to  the precision problem

i-0:(c-1)
vec-choose(n,i)*choose(NT-n,CT-i)  #get the vector which need summation
result-log(sum(vec))   #get the log of summation

# thanks to Petr, we have a solution
calsta - function(c, n) { 
i - seq(from=0, length=c) 
logx - lchoose(NT-n, CT-i) + lchoose(n, i) 
logmax - max(logx) 
logmax + log(sum(exp(logx - logmax))) 
} 

# now, new problem arise, in theory, the result of different (c,n) pair 
should most probably differ, so I can order them, but
 calsta(918,10)-calsta(718,10)
[1] 0
 calsta(718,9)-calsta(718,9)
[1] 0
 calsta(718,9)-calsta(918,10)
[1] 0
# As Eik pointed out in another post, calsta constantly returns 57003.6 for 
c38 (the summands in
# sum(exp(logx - logmax)) will become 0 for c38) (when n= 10,000)


I think there are two ways to solve this problem:

1.Reducing the calcuation formulae algebraically get a conciser kernel for 
comparing. I think this is the perfect method and I failed many times, though 
this is not the topic of mailing-list, I hope if someone with stronge 
algebraical skills could give me some surprise

2.Through skills of R, which is difficult for me

PS: I don't want a perfect solution but a better one, which could have a higher 
discriminability than before

Thank you in advance

Yours sincerely
 
ZhaoXing
Department of Health Statistics
West China School of Public Health
Sichuan University
No.17 Section 3, South Renmin Road
Chengdu, Sichuan 610041
P.R.China   

__
¸Ï¿ì×¢²áÑÅ»¢³¬´óÈÝÁ¿Ãâ·ÑÓÊÏä?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] natural cubic spline and multiple variables

2011-02-12 Thread Vijayakumar Ramachandran

I want to create natural cubic spline on my predictors and fit them to a linear 
model.  The DF and Degree of all the splines are the same.  I noticed that I 
can setup the lm() formula as y~ns(x1, df=5) + ns(x2, df=5).
My problem is that I have a huge number of predictors (hundreds).  ns however 
seems to take only a single set of values for creating the splines.  Is there 
an elegant way to handle this?
ThanksVijay   
[[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] linear models with factors

2011-02-12 Thread ATANU

i am trying to fit a linear model with both continuous covariates and
factors. When fitted with the intercept 
term the first level of the factor is treated by R as intercept and the
estimate of the effects of remaining levels(say i th level)  are given as 
true estimate of i th level - estimate of 1st level. i want the estimates of
coefficients of  each level along with the intercept term(general
effect).can anyone please help me? 
thanks in advance.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/linear-models-with-factors-tp3302404p3302404.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] Package distr and define your own distribution

2011-02-12 Thread Dr. Matthias Kohl

Dear Gabriel,

it is possible. You can define a new class or just an object of an 
already existing class.


Did you look at:
library(distr)
vignette(newDistributions)

as well as
?AbscontDistribution
?DiscreteDistribution

Please let me know if you have further questions!

Best
Matthias

On 11.02.2011 16:05, gabriel.ca...@ubs.com wrote:


Hi all
I  am using the Package distr (and related)

Do you know if it is possible to define your own distribution (object)
GIVEN that you have an analytical form of the probability density
function (pdf) ?

I would then like to use the standard feature of the distr and related
packages.


Best regards

Giuseppe Gabriel Cardi




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


--
Dr. Matthias Kohl
www.stamats.de

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Comparison of glm.nb and negbin from the package aod

2011-02-12 Thread Matthieu Lesnoff

Dear Sabine

In negbin(aod), the deviance is calculated by:

# full model
logL.max - sum(dpois(x = y, lambda = y, log = TRUE))
# fitted model
logL - -res$value
dev - -2 * (logL - logL.max)

(the log-Lik contain all the constants)

As Ben Bolker said, whatever the formula used for deviance, differences 
between deviances of two models should be the same


Regards

--
--
Matthieu Lesnoff

On 10/02/2011 18:00, sabwo wrote:


I have fitted the faults.data to glm.nb and to the function negbin from the
package aod. The output of both is the following:

summary(glm.nb(n~ll, data=faults))

Call:
glm.nb(formula = n ~ ll, data = faults, init.theta = 8.667407437,
 link = log)

Deviance Residuals:
 Min   1Q   Median   3Q  Max
-2.0470  -0.7815  -0.1723   0.4275   2.0896

Coefficients:
 Estimate Std. Error z value Pr(|z|)
(Intercept)  -3.7951 1.4577  -2.603  0.00923 **
ll0.9378 0.2280   4.114 3.89e-05 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for Negative Binomial(8.6674) family taken to be 1)

 Null deviance: 50.28  on 31  degrees of freedom
Residual deviance: 30.67  on 30  degrees of freedom
AIC: 181.39

Number of Fisher Scoring iterations: 1


   Theta:  8.67
   Std. Err.:  4.17

  2 x log-likelihood:  -175.387

the output of the function negbin with a global dispersion parameter should
- when i understood it right - yield the same estimates as glm.nb.  it does,
with slightly little differences.


negbin(n~ll,~1, data=faults)

Negative-binomial model
---
negbin(formula = n ~ ll, random = ~1, data = faults)

Convergence was obtained after 112 iterations.

Fixed-effect coefficients:
   Estimate Std. Errorz value Pr(  |z|)
(Intercept) -3.795e+00  1.421e+00 -2.671e+00 7.570e-03
ll   9.378e-01  2.221e-01  4.222e+00 2.417e-05

Overdispersion coefficients:
  Estimate Std. Error   z value   Pr(  z)
phi.(Intercept) 1.154e-01   5.56e-02 2.076e+00 1.895e-02

Log-likelihood statistics
   Log-lik nbpar   df res.  Deviance   AIC  AICc
-8.77e+01 329 5.209e+01 1.814e+02 1.822e+02

The thing i really dont understand is why there is such a big difference
between the deviances? (glm.nb = 30.67 and negbin=52.09?) Shouldnt they be
nearly the same??

thanks for your help,
sabine


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Re. When is *interactive* data visualization useful to use?

2011-02-12 Thread Tal Galili
Hello Antony,
Thank you very much for your detailed answer!
All of your points are valid and interesting to reflect upon.

Regarding your note number (6), it's a very good point - I didn't think of
it.
It might be argued that because interactive data visualization can be faster
then analytical programming, it might invite more visual hypothesis
testing without counting your hypothesis were as when doing it with
printed output - it's much clearer what the number of your hypothesis tests
were.

Regarding your note number (7) - I'd be happy for (non spatial) examples for
interesting patterns found by interactive methods.

Regarding the bug reports.
So far I've filed one for ggobi:
http://code.google.com/p/ggobi-documentation/issues/detail?id=37
Although since the last time the software was built was 2008, I'm not sure
if anyone is even going to respond to the ticket...

Cheers,
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)
--




On Fri, Feb 11, 2011 at 3:55 PM, Antony Unwin un...@math.uni-augsburg.dewrote:

 Hello Tal,

 You asked *When is it helpful to use interactive plots? Either for data
 exploration (for ourselves) and data presentation (for a client)?*

 My answer: It's helpful for checking data quality, for exploration with and
 without clients, for checking results, and for data presenting.

 Notes:
 (1) It's difficult to explain interactive data visualization in print,
 demonstrations are so much more effective.
 (2) Interactive data visualization is fun, both for the analyst, and more
 important, for the dataset owners.  You not only get better interaction with
 the data, you get better interaction with the scientists you cooperate with.
  They are prepared to contribute, because they can understand what is going
 on.  That is not always the case with statistical models.
 (3) The key is not animation but direct manipulation.  The aim is to be
 able to directly interact with all statistical objects in a graphic:
 querying, linking, reordering, reformatting, zooming, whatever.
 (4) You write of point-based graphics, what about area-based graphics like
 histograms, barcharts and mosaicplots?  For categorical data the ability to
 select groups and look at spineplots of other variables to compare
 proportions is very effective. (And don't forget linking to maps for spatial
 data.)
 (5) You mention outliers.  How do you decide what is an outlier?
  Interactive parallel coordinate plots are extremely useful, either for
 identifying outliers or for checking ones found with an analytic approach.
 (6) Interactive data visualization is not in competition with other
 approaches, it complements them.  Results found with models should be
 checked graphically and results found graphically should be checked
 analytically.  Your comment about data dredging is important, though why
 people think this only happens with graphics and not with modelling
 approaches always puzzles me!
 (7) There are often interesting features of a dataset (not just errors and
 outlier groups) that can be found graphically that would be difficult or
 impossible to find analytically.

 Have a look at Interactive Graphics for Data Analysis: Principles and
 Examples by Martin Theus and Simon Urbanek (Chapman  Hall).  There are some
 excellent explanations and case studies there.

 I could go on (and on), but what you really need is a good demo.

 Best regards

 Antony

 PS Have you reported the bugs in GGobi and Mondrian you have found to the
 software authors?

 Antony Unwin
 Professor of Computer-Oriented Statistics and Data Analysis,
 Mathematics Institute,
 University of Augsburg,
 86135 Augsburg, Germany





[[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] markov-switching models

2011-02-12 Thread Nanda Mendez

I'm looking for Markov switching models, written in R. Does anyone know about 
programs?
Thanks,
Nanda
  
[[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] From SPSS Syntax to R code

2011-02-12 Thread beky

There is a code from SPSS Syntax

do if sub(ATVK,2,2)=01.
comp strata=1.
else if sub(ATVK,2,2)=05 and sub(ATVK,2,2)=27.
comp strata=3.
else if sub(ATVK,4,2)20 or sub(ATVK,6,2)20.
comp strata=4.
else if sub(ATVK,4,2)00.
comp strata=2.
end if.

value labels strata 1 R 2 Li 3 M 4 La.

How can i rewrite it in R code?
-- 
View this message in context: 
http://r.789695.n4.nabble.com/From-SPSS-Syntax-to-R-code-tp3302666p3302666.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] Time unit in ts() and arima() functions

2011-02-12 Thread Jose-Marcio Martins da Cruz


This question is surely trivial, sorry. I'm afraid I'm misunterpreting 
the information I got with the documentation, and I'm a little bit 
confused. I'm just an engineer with some little skills in statistics.


Well, I have a time series - 600 days long - with some weekly 
periodicity inside. So far, so good.


Well, if I define the time series with, say :

   a - ts(b, frequency = 7)

and I do plot(a), each unit of time seems to be a week, not a day, 
which is coherent with help(ts) which says frequency: the number of 
observations per unit of time. but this isn't what I want. I'd like to 
retrieve seasonal information but, as I'd like to retrieve also day to 
day information, the time unit should remain one day.


Also, when I use the arima(...) function to fit a model (almost the 
same kind of algorithm which appeared here some days ago), and I specify 
in the seas= parameter, frequency = 7, or frequency = frequency(a) 
(a is the time series), I can get arN, maN, sarN, smaN... coefficients. 
What unit shall be applied to these coefficients ? One day or one week ? 
Logically (and ideally), for me, one day for arN and maN and one week 
for sarX and smaX coefficients, but I'm not sure.


I have the same kind of doubt about lag units when I apply the acf() 
function to the time series (a) or the residuals returned by the arima() 
function.


Thanks for your answer.

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

2011-02-12 Thread Pete Brecknock

You might want to take a look at Bob Muenchen's book R for SAS and SPSS
Users 

There is an 80 page preview at  .. http://rforsasandspssusers.com/

Additionally, there is lots of documentation for getting started with R on
the CRAN website http://cran.r-project.org/

HTH

Pete
-- 
View this message in context: 
http://r.789695.n4.nabble.com/From-SPSS-Syntax-to-R-code-tp3302666p3302707.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] From SPSS Syntax to R code

2011-02-12 Thread Daróczi Gergely
Hi,

instead of sub, use substr in R, also look for 'which' and 'factor' in the
manual.
E.g.:

?substr

?which
 ?factor


I hope this could help you to rewrite the SPSS syntax in R.
Good luck!

Best,
Gergely


On Sat, Feb 12, 2011 at 2:08 PM, beky b...@inbox.lv wrote:


 There is a code from SPSS Syntax

 do if sub(ATVK,2,2)=01.
 comp strata=1.
 else if sub(ATVK,2,2)=05 and sub(ATVK,2,2)=27.
 comp strata=3.
 else if sub(ATVK,4,2)20 or sub(ATVK,6,2)20.
 comp strata=4.
 else if sub(ATVK,4,2)00.
 comp strata=2.
 end if.

 value labels strata 1 R 2 Li 3 M 4 La.

 How can i rewrite it in R code?
 --
 View this message in context:
 http://r.789695.n4.nabble.com/From-SPSS-Syntax-to-R-code-tp3302666p3302666.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] problem with installing packages

2011-02-12 Thread Uwe Ligges



On 11.02.2011 16:14, xin shi wrote:


Dear:

I am recnetly trying to install some libraries. However, I found this issue for 
both my laptop and desktop even I uninstall and install it again.

I even can not update the R now.

I wonder if you have the similar issue.



Do you have a) internet connection and b) are you sure you are not 
behind a proxy or configured R to deal with the proxy otherwise?


Uwe Ligges



Thakns!

Xin


chooseCRANmirror()

Warning message:
In open.connection(con, r) :
   unable to connect to 'cran.r-project.org' on port 80.

setRepositories()
utils:::menuInstallPkgs()

Warning: unable to access index for repository 
http://www.stats.bris.ac.uk/R/bin/windows/contrib/2.12
Warning: unable to access index for repository 
http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.12
Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type = 
type) :
   no packages were specified

[[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] Data manipulation

2011-02-12 Thread mathijsdevaan

Hi,

I have a dataset with info on individuals (B) that have been involved in
projects (A) during multiple years (C). The dataset contains three columns:
A, B, C. Example:
   A  B  C
1 1  a  1999
2 1  b  1999
3 1  c  1999
4 2  c  2001
5 2  d  2001
6 3  a  2004
7 3  b  2004

I am interested in the average tenure of all individuals for each project
(assuming that the tenure of an individual = 0 in the first project this
individual is involved in). So based on the data above:
  A  D
1 1  0
2 2  1
3 3  5

where D = average project tenure. How do I do this?

Your help is very much appreciated. Thanks!
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Data-manipulation-tp3302717p3302717.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] Time unit in ts() and arima() functions

2011-02-12 Thread Gabor Grothendieck
On Sat, Feb 12, 2011 at 7:48 AM, Jose-Marcio Martins da Cruz
jose-marcio.mart...@mines-paristech.fr wrote:

 This question is surely trivial, sorry. I'm afraid I'm misunterpreting the
 information I got with the documentation, and I'm a little bit confused. I'm
 just an engineer with some little skills in statistics.

 Well, I have a time series - 600 days long - with some weekly periodicity
 inside. So far, so good.

 Well, if I define the time series with, say :

   a - ts(b, frequency = 7)

 and I do plot(a), each unit of time seems to be a week, not a day, which
 is coherent with help(ts) which says frequency: the number of observations
 per unit of time. but this isn't what I want. I'd like to retrieve seasonal
 information but, as I'd like to retrieve also day to day information, the
 time unit should remain one day.

 Also, when I use the arima(...) function to fit a model (almost the same
 kind of algorithm which appeared here some days ago), and I specify in the
 seas= parameter, frequency = 7, or frequency = frequency(a) (a is the
 time series), I can get arN, maN, sarN, smaN... coefficients. What unit
 shall be applied to these coefficients ? One day or one week ? Logically
 (and ideally), for me, one day for arN and maN and one week for sarX and
 smaX coefficients, but I'm not sure.

 I have the same kind of doubt about lag units when I apply the acf()
 function to the time series (a) or the residuals returned by the arima()
 function.


Functions which work with ts typically assume that a full cycle is
represented by 1 unit so if a full cycle is a week then a week must be
one unit and a day must be 1/7th of a unit; however, you can later
convert your series to a non-ts representation which supports dates.
For example,

 b - 101:121
 a - ts(b, frequency = 7); a
Time Series:
Start = c(1, 1)
End = c(3, 7)
Frequency = 7
 [1] 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
[20] 120 121

 time(a)
Time Series:
Start = c(1, 1)
End = c(3, 7)
Frequency = 7
 [1] 1.00 1.142857 1.285714 1.428571 1.571429 1.714286 1.857143 2.00
 [9] 2.142857 2.285714 2.428571 2.571429 2.714286 2.857143 3.00 3.142857
[17] 3.285714 3.428571 3.571429 3.714286 3.857143

 # suppose start date is today
 library(zoo)
 z - zooreg(coredata(a), start = Sys.Date()); z
2011-02-12 2011-02-13 2011-02-14 2011-02-15 2011-02-16 2011-02-17 2011-02-18
   101102103104105106107
2011-02-19 2011-02-20 2011-02-21 2011-02-22 2011-02-23 2011-02-24 2011-02-25
   108109110111112113114
2011-02-26 2011-02-27 2011-02-28 2011-03-01 2011-03-02 2011-03-03 2011-03-04
   115116117118119120121


-- 
Statistics  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at 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] Test for equivalence

2011-02-12 Thread syrvn

Hi!

is there a way in R to check whether the outcome of two different
experiments is statistically distinguishable or indistinguishable? More
preciously, I used the wilcoxon test to determine the differences between
controls and treated subjects for two different experiments. Now I would
like to check whether the two lists of analytes obtained are statistically
distinguishable or indistinguishable

I tried to use a equivalence test from the 'equivalence' package in R but it
seems that this test is not applicable to my problem. The test in the
'equivalence' package just determines similarity between two conditions but
I need to compare the outcome of two different experiments.

My experiments are constructed as follows:

Exp1:
8 control samples
8 treated samples
- determine significantly changes (List A)

Exp2:
8 control samples
8 treated samples
- determine significantly changes (List B)


Now i would like to check whether List A and List B are distinguishable or
indistinguishable.

Any advice is very much appreciated!

Best,
beginner
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Test-for-equivalence-tp3302739p3302739.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] Revolution Analytics reading SAS datasets

2011-02-12 Thread Charles Roosen
Another option is to use StatTransfer which is a commercial data
exchange product from Circle Systems:

http://www.stattransfer.com

That's the basis of the import/export in S-PLUS:

http://www.stattransfer.com/stattransfer/developers.html

I wouldn't be surprised if it's also being used by Revolution, in which
case it isn't their intellectual property so they aren't in a position
to release the source code.

Charlie Roosen
Mango Solutions

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Gong-Yi Liao
Sent: 11 February 2011 17:42
To: Chao(Charlie) Huang
Cc: r-help@r-project.org
Subject: Re: [R] Revolution Analytics reading SAS datasets

If you have SAS, You can read Dr. Harrell's page:

http://biostat.mc.vanderbilt.edu/wiki/Main/SASexportHowto

if not, you can take a look on WPS:

http://www.teamwpc.co.uk/products



On Fri, 2011-02-11 at 10:32 -0600, Chao(Charlie) Huang wrote: 
 I am right now using Revolution R Enterprise 4.2. Could somebody show
 me how to import/export SAS datasets. Thanks.
 


-- 
Gong-Yi Liao

Department of Statistics
University of Connecticut
215 Glenbrook Road  U4120
Storrs, CT 06269-4120

860-486-9478

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
LEGAL NOTICE
This message is intended for the use o...{{dropped:10}}

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

2011-02-12 Thread Ista Zahn
I already responded to your identical post yesterday, asking you to
actually ask a question. can you please help me? is not enough.

Best,
Ista


On Sat, Feb 12, 2011 at 5:57 AM, ATANU ata.s...@gmail.com wrote:

 i am trying to fit a linear model with both continuous covariates and
 factors. When fitted with the intercept
 term the first level of the factor is treated by R as intercept and the
 estimate of the effects of remaining levels(say i th level)  are given as
 true estimate of i th level - estimate of 1st level. i want the estimates of
 coefficients of  each level along with the intercept term(general
 effect).can anyone please help me?
 thanks in advance.
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/linear-models-with-factors-tp3302404p3302404.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.




-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org

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

2011-02-12 Thread Ista Zahn
Well, I may have been too hasty there. Actually the question was
slightly improved. I think you are looking for ?contr.sum

Best,
Ista

On Sat, Feb 12, 2011 at 3:55 PM, Ista Zahn iz...@psych.rochester.edu wrote:
 I already responded to your identical post yesterday, asking you to
 actually ask a question. can you please help me? is not enough.

 Best,
 Ista


 On Sat, Feb 12, 2011 at 5:57 AM, ATANU ata.s...@gmail.com wrote:

 i am trying to fit a linear model with both continuous covariates and
 factors. When fitted with the intercept
 term the first level of the factor is treated by R as intercept and the
 estimate of the effects of remaining levels(say i th level)  are given as
 true estimate of i th level - estimate of 1st level. i want the estimates of
 coefficients of  each level along with the intercept term(general
 effect).can anyone please help me?
 thanks in advance.
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/linear-models-with-factors-tp3302404p3302404.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.




 --
 Ista Zahn
 Graduate student
 University of Rochester
 Department of Clinical and Social Psychology
 http://yourpsyche.org




-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org

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

2011-02-12 Thread Christophe Pallier
See ?contrasts and ?contr.sum

By default, R uses contr.treatment, you want contr.sum

Christophe


On Sat, Feb 12, 2011 at 6:57 AM, ATANU ata.s...@gmail.com wrote:

 i am trying to fit a linear model with both continuous covariates and
 factors. When fitted with the intercept
 term the first level of the factor is treated by R as intercept and the
 estimate of the effects of remaining levels(say i th level)  are given as
 true estimate of i th level - estimate of 1st level. i want the estimates of
 coefficients of  each level along with the intercept term(general
 effect).can anyone please help me?
 thanks in advance.
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/linear-models-with-factors-tp3302404p3302404.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.




-- 
Christophe Pallier  christo...@pallier.org
tel: +33 (0)1 69 08 79 34
Unité de Neuroimagerie Cognitive INSERM-CEA,
Neurospin center, F91191 Gif-sur-Yvette, France
web site: http://www.unicog.org
personal web site: www.pallier.org

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

2011-02-12 Thread David Winsemius


On Feb 12, 2011, at 11:16 AM, Ista Zahn wrote:


Well, I may have been too hasty there. Actually the question was
slightly improved. I think you are looking for ?contr.sum



Another issue will arise besides what the switch of the contrasts
-- The intercept is not a general effect but rather a combined  
intercept for all of the continuous terms estimated when they are  
simultaneous zero. (Only in the situation where the continuous  
variables had all been centered would this be anywhere near the  
general effect or grand mean. ) I infer that OP has been brought  
up in an anova tradition and has not made a proper transition to  
regression.


Perhaps what could be explored is whether the predict() function is a  
path to enlightenment or at least partial satisfaction.


?predict

OP: Try something along these lines with the names for the factor  
variables matching that of the original data and choosing a  
representative value or values for the continuous variables:


predict(mdl, data.frame(lev1=factor(val1,val2,val3, levels=levels(dat 
$lev1)),

lev2=  ... etc
etc=etc ), contin=median(dat$contin) )
 )

Perhaps with expand.grid() if combinations are needed.

--
david.  er,  David.

Best,
Ista

On Sat, Feb 12, 2011 at 3:55 PM, Ista Zahn  
iz...@psych.rochester.edu wrote:

I already responded to your identical post yesterday, asking you to
actually ask a question. can you please help me? is not enough.

Best,
Ista


On Sat, Feb 12, 2011 at 5:57 AM, ATANU ata.s...@gmail.com wrote:


i am trying to fit a linear model with both continuous covariates  
and

factors. When fitted with the intercept
term the first level of the factor is treated by R as intercept  
and the
estimate of the effects of remaining levels(say i th level)  are  
given as
true estimate of i th level - estimate of 1st level. i want the  
estimates of

coefficients of  each level along with the intercept term(general
effect).can anyone please help me?
thanks in advance.
--
View this message in context: 
http://r.789695.n4.nabble.com/linear-models-with-factors-tp3302404p3302404.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.





--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org





--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org

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

2011-02-12 Thread Johannes Huesing
mathijsdevaan mathijsdev...@gmail.com [Sat, Feb 12, 2011 at 03:00:18PM CET]:
 
 Hi,
 
 I have a dataset with info on individuals (B) that have been involved in
 projects (A) during multiple years (C). The dataset contains three columns:
 A, B, C. Example:
A  B  C
 1 1  a  1999
 2 1  b  1999
 3 1  c  1999
 4 2  c  2001
 5 2  d  2001
 6 3  a  2004
 7 3  b  2004
 
 I am interested in the average tenure of all individuals for each project
 (assuming that the tenure of an individual = 0 in the first project this
 individual is involved in). So based on the data above:
   A  D
 1 1  0
 2 2  1
 3 3  5
 
 where D = average project tenure. How do I do this?
 

I am not getting how you arrive at D calculating an average.
Could you write down the arithmetic operations involved?


-- 
Johannes Hüsing   There is something fascinating about science. 
  One gets such wholesale returns of conjecture 
mailto:johan...@huesing.name  from such a trifling investment of fact.  
  
http://derwisch.wikidot.com (Mark Twain, Life on the Mississippi)

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

2011-02-12 Thread jim holtman
Will this do it for you:

 x - read.table(textConnection( A  B  C
+ 1 1  a  1999
+ 2 1  b  1999
+ 3 1  c  1999
+ 4 2  c  2001
+ 5 2  d  2001
+ 6 3  a  2004
+ 7 3  b  2004), header = TRUE)
 closeAllConnections()
 # add a tenure column
 x$tenure - ave(x$C, x$B, FUN = function(yr) yr - min(yr))
 x
  A BC tenure
1 1 a 1999  0
2 1 b 1999  0
3 1 c 1999  0
4 2 c 2001  2
5 2 d 2001  0
6 3 a 2004  5
7 3 b 2004  5
 # compute tenure on project
 aggregate(x$tenure, list(project = x$A), mean)
  project x
1   1 0
2   2 1
3   3 5


On Sat, Feb 12, 2011 at 9:00 AM, mathijsdevaan mathijsdev...@gmail.com wrote:

 Hi,

 I have a dataset with info on individuals (B) that have been involved in
 projects (A) during multiple years (C). The dataset contains three columns:
 A, B, C. Example:
   A  B  C
 1 1  a  1999
 2 1  b  1999
 3 1  c  1999
 4 2  c  2001
 5 2  d  2001
 6 3  a  2004
 7 3  b  2004

 I am interested in the average tenure of all individuals for each project
 (assuming that the tenure of an individual = 0 in the first project this
 individual is involved in). So based on the data above:
  A  D
 1 1  0
 2 2  1
 3 3  5

 where D = average project tenure. How do I do this?

 Your help is very much appreciated. Thanks!
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Data-manipulation-tp3302717p3302717.html
 Sent from the R help mailing list archive at Nabble.com.

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




-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?

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

2011-02-12 Thread Shing Hing Man
Hi,
  I am trying to create a linked list in R by defining a class Node which has a 
instance variable Node.

setClass(Node, representation(rate=numeric,  nextNode=ANY))

The above works. But the following gives me a warning message.
setClass(Node, representation(rate=numeric,  nextNode=Node))



 setClass(Node, representation(rate=numeric,  nextNode=ANY))
[1] Node
 removeClass(Node)
[1] TRUE

 setClass(Node, representation(rate=numeric,  nextNode=Node))
[1] Node
Warning message:
undefined slot classes in definition of Node: nextNode(class Node)


In the case when nextNode is type Node, is it possible to get ride of the above 
 undefined slot classes warning message ?


Thanks in advance for any assistance!

Shing 




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

2011-02-12 Thread Jeff Newmiller
Why would you do this, when lists are fundamental types in R?
---
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.

Shing Hing Man mat...@yahoo.com wrote:

Hi, I am trying to create a linked list in R by defining a class Node which has 
a instance variable Node. setClass(Node, representation(rate=numeric, 
nextNode=ANY)) The above works. But the following gives me a warning message. 
setClass(Node, representation(rate=numeric, nextNode=Node))   
setClass(Node, representation(rate=numeric, nextNode=ANY)) [1] Node  
removeClass(Node) [1] TRUE   setClass(Node, 
representation(rate=numeric, nextNode=Node)) [1] Node Warning message: 
undefined slot classes in definition of Node: nextNode(class Node)  In the 
case when nextNode is type Node, is it possible to get ride of the above 
undefined slot classes warning message ? Thanks in advance for any 
assistance! Shing_
R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Regarding {KernSmooth} - Can a package on CRAN have non GPL copyrights?

2011-02-12 Thread Tal Galili
Hi all,
I'm not sure who to ask this, so I'm posting this here.

I just ran:
 require(KernSmooth)
And got (I bolded the text):
Loading required package: KernSmooth
KernSmooth 2.23 loaded
*Copyright M. P. Wand 1997-2009*
Warning message:
package 'KernSmooth' was built under R version 2.12.1

What does that mean?

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

[[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] Linked List in R

2011-02-12 Thread Martin Morgan
On 02/12/2011 11:08 AM, Shing Hing Man wrote:
 Hi,
   I am trying to create a linked list in R by defining a class Node which has 
 a instance variable Node.
 
 setClass(Node, representation(rate=numeric,  nextNode=ANY))
 
 The above works. But the following gives me a warning message.
 setClass(Node, representation(rate=numeric,  nextNode=Node))
 
 

 setClass(Node, representation(rate=numeric,  nextNode=ANY))
 [1] Node
 removeClass(Node)
 [1] TRUE

 setClass(Node, representation(rate=numeric,  nextNode=Node))
 [1] Node
 Warning message:
 undefined slot classes in definition of Node: nextNode(class Node)

 
 In the case when nextNode is type Node, is it possible to get ride of the 
 above  undefined slot classes warning message ?
 
 
 Thanks in advance for any assistance!

Hi Shing --

Not really an answer to your question, but I guess linked lists give you
constant insert / linear search. The only data type in R with constant
insert time is an environment. Environments map keys to values, with
keys being character scalars. So (untested)

setClass(Node,representation(next=character, value=ANY))
setClass(LinkedList,
representation(store=environment, head=character)))

environments are tricky because of their pass-by-reference semantic, and
to initialize the LinkedList class you'll want to write an initialize
method that creates a new environment for each instance

setMethod(initialize, LinkedList,
function(.Object, ..., store=new.env(parent=emptyenv()))
{
callNextMethod(.Object, ..., store=store)
})

you'd then write methods on the LinkedList class to insert / delete /
etc. Likely some new concepts in there but hopefully that helps...

For the node values, creating S4 objects can be very expensive and if
you are thinking of large linked lists that are frequently updated, you
might do well either to use simple lists or vectors to represent the
node values, or to rethink whether linked lists are what you need --
they're not a very friendly R data structure.

And since the LinkedList class is based on an environment, it has
reference semantics that will confuse R users.

Martin

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


-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793

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


Re: [R] Regarding {KernSmooth} - Can a package on CRAN have non GPL copyrights?

2011-02-12 Thread Murray Stokely
On Sat, Feb 12, 2011 at 11:57 AM, Tal Galili tal.gal...@gmail.com wrote:
 Hi all,
 I'm not sure who to ask this, so I'm posting this here.

 I just ran:
  require(KernSmooth)
 And got (I bolded the text):
 Loading required package: KernSmooth
 KernSmooth 2.23 loaded
 *Copyright M. P. Wand 1997-2009*
 Warning message:
 package 'KernSmooth' was built under R version 2.12.1

 What does that mean?

There are many licenses used on CRAN, such as BSD, MIT, GPL, LGPL, and
public domain.  There are even some that aren't really open source at
all such as 'akima' and 'SparseM'.  These packages make additional
restrictions such as that a license is only granted for academic /
non-commercial use.  It's particularly annoying that many other
packages without such restrictions depend on these packages, making it
pretty difficult to ensure license compliance for companies using R.

The fact that the code is Copyright by that author is somewhat
orthogonal to the license he chooses to distribute it under.  See the
LICENSE file.  In this case, it's much more open than GPL -- it is
completely unrestricted / public domain.  After reading the license
for the package you are interested in, you may like to read how those
licenses are interpreted by e.g.

   http://www.opensource.org/licenses/index.html

 - Murray

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

2011-02-12 Thread Shing Hing Man

--- On Sun, 13/2/11, Shing Hing Man mat...@yahoo.com wrote:

 From: Shing Hing Man mat...@yahoo.com
 Subject: Re: [R] Linked List in R
 To: Martin Morgan mtmor...@fhcrc.org
 Date: Sunday, 13 February, 2011, 4:49
 Hi Martin,
   Thanks for the pointer ! It seems quite involved to
 create a 
 a linked list in the oo way. I need to read up on
 environment.
 
 Thanks!
 Shing
 
 
 --- On Sun, 13/2/11, Martin Morgan mtmor...@fhcrc.org
 wrote:
 
  From: Martin Morgan mtmor...@fhcrc.org
  Subject: Re: [R] Linked List in R
  To: Shing Hing Man mat...@yahoo.com
  Cc: r-help@r-project.org
  Date: Sunday, 13 February, 2011, 4:10
  On 02/12/2011 11:08 AM, Shing Hing
  Man wrote:
   Hi,
     I am trying to create a linked list
  in R by defining a class Node which has a instance
 variable
  Node.
   
   setClass(Node,
 representation(rate=numeric, 
  nextNode=ANY))
   
   The above works. But the following gives me a
 warning
  message.
   setClass(Node,
 representation(rate=numeric, 
  nextNode=Node))
   
   
  
   setClass(Node,
  representation(rate=numeric,  nextNode=ANY))
   [1] Node
   removeClass(Node)
   [1] TRUE
  
   setClass(Node,
  representation(rate=numeric,  nextNode=Node))
   [1] Node
   Warning message:
   undefined slot classes in definition of Node:
  nextNode(class Node)
  
   
   In the case when nextNode is type Node, is it
 possible
  to get ride of the above  undefined slot classes
  warning message ?
   
   
   Thanks in advance for any assistance!
  
  Hi Shing --
  
  Not really an answer to your question, but I guess
 linked
  lists give you
  constant insert / linear search. The only data type in
 R
  with constant
  insert time is an environment. Environments map keys
 to
  values, with
  keys being character scalars. So (untested)
  
  setClass(Node,representation(next=character,
  value=ANY))
  setClass(LinkedList,
      representation(store=environment,
  head=character)))
  
  environments are tricky because of their
 pass-by-reference
  semantic, and
  to initialize the LinkedList class you'll want to
 write an
  initialize
  method that creates a new environment for each
 instance
  
  setMethod(initialize, LinkedList,
      function(.Object, ...,
  store=new.env(parent=emptyenv()))
  {
      callNextMethod(.Object, ..., store=store)
  })
  
  you'd then write methods on the LinkedList class to
 insert
  / delete /
  etc. Likely some new concepts in there but hopefully
 that
  helps...
  
  For the node values, creating S4 objects can be very
  expensive and if
  you are thinking of large linked lists that are
 frequently
  updated, you
  might do well either to use simple lists or vectors
 to
  represent the
  node values, or to rethink whether linked lists are
 what
  you need --
  they're not a very friendly R data structure.
  
  And since the LinkedList class is based on an
 environment,
  it has
  reference semantics that will confuse R users.
  
  Martin
  
   
   Shing 
   
   
   
   
   __
   R-help@r-project.org
  mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide 
   http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained,
  reproducible code.
  
  
  -- 
  Computational Biology
  Fred Hutchinson Cancer Research Center
  1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109
  
  Location: M1-B861
  Telephone: 206 667-2793
  
 
 
 
 




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


Re: [R] linear models with factors

2011-02-12 Thread Bert Gunter
Ummm...

The simple answer to your question:

i want the
 estimates of
 coefficients of  each level along with the intercept term(general
 effect).can anyone please help me?

is no, because it's matrhematically impossible. You need to consult a
local statistician or read up on linear models and contrast in
statistics to understand why.

-- Bert

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] extracting p-values from the Manova function (car library)

2011-02-12 Thread Bettina Kulle Andreassen

thanks that worked out

tina :-)


On Fri, 11 Feb 2011 12:21:19 -0500, Ista Zahn 
iz...@psych.rochester.edu wrote:

Hi,
one approach is to modify

getAnywhere(print.Anova.mlm)

to return the information you want.

Best,
Ista

On Fri, Feb 11, 2011 at 7:16 AM, Bettina Kulle Andreassen
b.k.andreas...@medisin.uio.no wrote:

hi,

i am not able to extract the p-values from the
Manova function in the car library. I need
to use this function in a high-throughput setting
and somehow need the p-values produced.

Any ideas?

Best regards

Bettina Kulle Andreassen

--

Bettina Kulle Andreassen

University of Oslo

Department of Biostatistics

and

Institute for Epi-Gen (Faculty Division Ahus)

tel:
+47 22851193
+47 67963923

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] use map.axes for a projected map

2011-02-12 Thread sybil

Hi,
I am new to R and I want to display longitude and latitude for a projected
map.
map.axes won't do it since it only works for unprojected map.
Can anyone help me with this?

Thanks,
Sybil
-- 
View this message in context: 
http://r.789695.n4.nabble.com/use-map-axes-for-a-projected-map-tp3302918p3302918.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] Regarding {KernSmooth} - Can a package on CRAN have non GPL copyrights?

2011-02-12 Thread Joshua Wiley
AFAIK CRAN does not explicitly require use of a GPL license (though
obviously the license needs to allow at least free access to the
packages and source).

On Sat, Feb 12, 2011 at 11:57 AM, Tal Galili tal.gal...@gmail.com wrote:
 Hi all,
 I'm not sure who to ask this, so I'm posting this here.

 I just ran:
  require(KernSmooth)
 And got (I bolded the text):
 Loading required package: KernSmooth
 KernSmooth 2.23 loaded
 *Copyright M. P. Wand 1997-2009*
 Warning message:
 package 'KernSmooth' was built under R version 2.12.1

 What does that mean?

Well, I think that is just a warning that it was built under a
different version of R than you are currently running it under.

If memory serves, the current KernSmooth is a port to R by Brian
Ripley; that message suggests the original KernSmooth was copyrighted
by M. P. Wand from 1997 until 2009 (probably the original author in
S?).

Cheers,

Josh


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

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

-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.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] Data manipulation

2011-02-12 Thread mathijsdevaan

That worked great! Thanks!
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Data-manipulation-tp3302717p3303001.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] Time unit in ts() and arima() functions

2011-02-12 Thread Jose-Marcio Martins da Cruz


Thanks for the hint. Helped a lot

Gabor Grothendieck wrote:

On Sat, Feb 12, 2011 at 7:48 AM, Jose-Marcio Martins da Cruz




Functions which work with ts typically assume that a full cycle is
represented by 1 unit so if a full cycle is a week then a week must be
one unit and a day must be 1/7th of a unit; however, you can later
convert your series to a non-ts representation which supports dates.



--

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

2011-02-12 Thread Paka yag

   Hello

I have model that is: lm(y~ lag(x, -1) + lag(z, -1)
so basically a time series regression with exogen variables
And I want to make rolling out of sample forecasts, meaning that:

I first use a subsample (e.g. 1990 -1995) for estimating, then I perform a one 
step ahead forecast, then I add one observation and make another one step ahead 
forecast and so on

I have tried to work with rollapply and defining the model as arima(0,0,0) with 
xreg=lags of the other varibles, but that doesnt work. 

Please, if you could point me to a solution, your help is much appreciated!

Chris

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

2011-02-12 Thread Gabor Grothendieck
On Sat, Feb 12, 2011 at 4:08 PM, Paka yag pak...@web.de wrote:

   Hello

 I have model that is: lm(y~ lag(x, -1) + lag(z, -1)
 so basically a time series regression with exogen variables
 And I want to make rolling out of sample forecasts, meaning that:

 I first use a subsample (e.g. 1990 -1995) for estimating, then I perform a 
 one step ahead forecast, then I add one observation and make another one step 
 ahead forecast and so on

 I have tried to work with rollapply and defining the model as arima(0,0,0) 
 with xreg=lags of the other varibles, but that doesnt work.

 Please, if you could point me to a solution, your help is much appreciated!


See:

http://stackoverflow.com/questions/4856555/iteratively-forecasting-dyn-models/4858364#4858364


-- 
Statistics  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at 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] Test for equivalence

2011-02-12 Thread Greg Snow
Does it make sense for you to combine the 2 data sets and do a 2-way anova with 
treatment vs. control as one factor and experiment number as the other factor?  
Then you could test the interaction and treatment number factor to see if they 
make a difference.

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


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of syrvn
 Sent: Saturday, February 12, 2011 7:30 AM
 To: r-help@r-project.org
 Subject: [R] Test for equivalence
 
 
 Hi!
 
 is there a way in R to check whether the outcome of two different
 experiments is statistically distinguishable or indistinguishable? More
 preciously, I used the wilcoxon test to determine the differences
 between
 controls and treated subjects for two different experiments. Now I
 would
 like to check whether the two lists of analytes obtained are
 statistically
 distinguishable or indistinguishable
 
 I tried to use a equivalence test from the 'equivalence' package in R
 but it
 seems that this test is not applicable to my problem. The test in the
 'equivalence' package just determines similarity between two conditions
 but
 I need to compare the outcome of two different experiments.
 
 My experiments are constructed as follows:
 
 Exp1:
 8 control samples
 8 treated samples
 - determine significantly changes (List A)
 
 Exp2:
 8 control samples
 8 treated samples
 - determine significantly changes (List B)
 
 
 Now i would like to check whether List A and List B are distinguishable
 or
 indistinguishable.
 
 Any advice is very much appreciated!
 
 Best,
 beginner
 --
 View this message in context: http://r.789695.n4.nabble.com/Test-for-
 equivalence-tp3302739p3302739.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.


[R] calculate phase/amplitude of fourier transform function in R

2011-02-12 Thread sammyny

I did a fourier transform on a function in time domain to get the following
functions in frequency domain (in latex):

$Y_1[\omega] = \frac{1}{1-\phi_1 e^{-jw}}$

$Y_2[\omega] = \frac{1}{1-(\phi_1 + \phi_2)e^{-jw} +\phi_1\phi_2e^{-2jw}}$

How do I find the spectrum of this function for given $\phi_1$ and $\phi_2$
coefficients and in the discretization interval $w = [-\pi:.1*\pi: \pi]$?
Then, how do I find the 'magnitude' of spectrum and 'phase' of spectrum in
R?

Is there an existing package/function in R? An example would be very
helpful.

-- 
View this message in context: 
http://r.789695.n4.nabble.com/calculate-phase-amplitude-of-fourier-transform-function-in-R-tp3303345p3303345.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] Changes titles in ggplot2 plot

2011-02-12 Thread Shige Song
Dear Colleagues,

In the following simple ggplot2 code:

m - ggplot(d.fig, aes(time, prob))
m + stat_summary(fun.data = median_hilow, conf.int = .95, geom =
smooth) + facet_wrap(~ Cohort, nrow=1) + coord_cartesian(ylim = c(0,
.03))

Is there a way to replace the y-axis label from prob to Predicted
Probability and replace the x-axis label from time to Time
Elapsed?

Many thanks.

Best,
Shige

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

2011-02-12 Thread Felipe Carrillo
you can just probably add 
+ labs(x=Time Elapsed,y=Predicted Probability)
 
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish  Wildlife Service
California, USA
http://www.fws.gov/redbluff/rbdd_jsmp.aspx




- Original Message 
 From: Shige Song shiges...@gmail.com
 To: r-help Help r-help@r-project.org
 Sent: Sat, February 12, 2011 7:07:39 PM
 Subject: [R] Changes titles in ggplot2 plot
 
 Dear Colleagues,
 
 In the following simple ggplot2 code:
 
 m - ggplot(d.fig, aes(time, prob))
 m + stat_summary(fun.data = median_hilow, conf.int = .95, geom =
 smooth) + facet_wrap(~ Cohort, nrow=1) + coord_cartesian(ylim = c(0,
 .03))
 
 Is there a way to replace the y-axis label from prob to Predicted
 Probability and replace the x-axis label from time to Time
 Elapsed?
 
 Many thanks.
 
 Best,
 Shige
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


 

Now that's room service!  Choose from over 150,000 hotels
in 4[[elided Yahoo spam]]
hoo.com/promo-generic-14795097

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Regarding {KernSmooth} - Can a package on CRAN have non GPL copyrights?

2011-02-12 Thread Prof Brian Ripley

On Sat, 12 Feb 2011, Joshua Wiley wrote:


AFAIK CRAN does not explicitly require use of a GPL license (though
obviously the license needs to allow at least free access to the
packages and source).


GPL and the other licences are about distribution.  CRAN requires a 
licence to allow it to distribute packages -- in some cases (e.g. 
mclust) that requires a CRAN exception.


Copyright is an almost entirely orthogonal issue.  In many countries 
all intellectual creation is copyright -- this message is, R itself 
is, my packages are (including my contributions to KernSmooth) -- and 
that does not need to stated.  Matt Wand has chosen to assert his 
copyright in the startup message.  A closely related concept you will 
see in British books is that 'X has asserted his moral right to be 
identified as the author of this work'.


With the freedoms that Open Source licences give goes a moral 
responsibility to give due credit, something we see **far** too little 
of here.




On Sat, Feb 12, 2011 at 11:57 AM, Tal Galili tal.gal...@gmail.com wrote:

Hi all,
I'm not sure who to ask this, so I'm posting this here.

I just ran:
 require(KernSmooth)
And got (I bolded the text):
Loading required package: KernSmooth
KernSmooth 2.23 loaded
*Copyright M. P. Wand 1997-2009*
Warning message:
package 'KernSmooth' was built under R version 2.12.1

What does that mean?


Well, I think that is just a warning that it was built under a
different version of R than you are currently running it under.

If memory serves, the current KernSmooth is a port to R by Brian
Ripley; that message suggests the original KernSmooth was copyrighted
by M. P. Wand from 1997 until 2009 (probably the original author in
S?).

Cheers,

Josh



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

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


--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.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.



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