[R] Fit the data with an inverse quardratic function?

2013-04-10 Thread Jing Tang
Hi, I have a data y~x which looks like an inverse quardratic function, i.e. y=+/- sqrt(x). So for each x there are two y values due to the +/- operation. Do you know it is possible to fit a linear model on the data to fit such a model? How do I write the formula for this case? Thanks for the

[R] Contrasts for a data

2013-02-08 Thread jing tang
Hi, I am using a data called Rail in the nlme package. The data contains two variables: Rail and Travel. >Rail Grouped Data: travel ~ 1 | Rail Rail travel 1 1 55 2 1 53 3 1 54 4 2 26 5 2 37 6 2 32 7 3 78 8 3 91 9 3 85 10

[R] The interpretation of lm(y~x)?

2013-02-06 Thread jing tang
Hi, I am reading the book "Mixed Effects Models in S and S-Plus" and come across an example with the Rail data. I tried to use lm(travel~Rail,data=Rail) and got the following result: Call: lm(formula = travel ~ Rail, data = Rail) Residuals: Min 1Q Median 3Q Max -6.6667 -1.

[R] Statistical test for predictor selection

2012-05-02 Thread jing tang
Hi, In a data I have two predictors and one response variable. The response variable is categorical and fixed. Now I want to choose which predictor would better predict the response variable. Is there a statistical test for that? Best, Jing -- Jing Tang, PhD Senior Researcher

Re: [R] Strsplit with a separator of ||

2012-03-22 Thread jing tang
Thanks! JIng -Original Message- From: Berend Hasselman [mailto:b...@xs4all.nl] Sent: 22. maaliskuuta 2012 9:33 To: Berend Hasselman Cc: jing tang; r-help@r-project.org Subject: Re: [R] Strsplit with a separator of || On 22-03-2012, at 08:28, Berend Hasselman wrote: > > On 22-0

[R] Strsplit with a separator of ||

2012-03-22 Thread jing tang
Hi, I tried to use strsplit for separating a string with || like strsplit(string,"\\||") but it returned each single character was separated. For example: strsplit("a||bc","\\||") [[1]] [1] "a" "" "" "b" "c" where I want the result to be "a" and "bc". Any ideas? Thanks! Best

[R] How to determine a subset of a binary strings?

2012-02-20 Thread jing tang
Hi, I need some neat ways of determing a subset of binary strings. For example, x=c(0,0,1), y=c(0,1,1), z=c(0,1,0). So x is a subset of y and z is also a subset of y, but x is not a subset of z. I tried to search R functions and packages but no hits. Any ideas? Best, Jing -- Jing Tang