[R] R: use switch or function in connecting different cases.

2016-04-24 Thread tan sj
HI, I am trying to use switch () function to connect the three distribution (normal ,gamma with equal skewness and gamma with unequal skewness. But i am losing my ideas since i have sample sizes-(10,10),(10,25),(25,25),(25,50),(25,100),50,25),(50,100), (100,25),(100,100) standard deviation rat

Re: [R] R [coding : do not run for every row ]

2016-04-18 Thread tan sj
2016 10:03 AM To: tan sj; r-help@r-project.org Subject: Re: [R] R [coding : do not run for every row ] Always keep the mailing list in cc. The code runs for each row in the data. However I get the feeling that there is a mismatch between what you think that is in the data and the actual data. i

Re: [R] R [coding : do not run for every row ]

2016-04-18 Thread tan sj
a and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2016-04-17 19:59 GMT+02:00 tan sj : > i have combined all the variables in a matrix, and i wish to conduct a > simulation row by row. > > But i found out

[R] R [coding : do not run for every row ]

2016-04-17 Thread tan sj
i have combined all the variables in a matrix, and i wish to conduct a simulation row by row. But i found out the code only works for the every first row after a cycle of nine samples. But after check out the code, i don know where is my mistake... can anyone pls help #For gamma disribu

[R] R [loop statement ]

2016-04-15 Thread tan sj
hi, i am new in this field. I am now writing a code in robustness simulation study. I have written a brief code "for loop" for the factor (samples sizes d,std deviation ) , i wish to test them in gamma distribution with equal and unequal skewness, with the above for loop in a single code if pos

[R] [R ] help in if else in connect the simulation in normal and gamma distribution.

2016-04-07 Thread tan sj
I am new in R. I have to conduct simulation study on the robustness of 2 sample tests on several combination of factors (sample sizes ,variance and distribution). I have been completed write a code in normal distribution, and now i wish to add if -else in the code so that the code can simulate

Re: [R] R-dvel [robustness Simulation study of 2 sample test on several combination of factors ]

2016-04-06 Thread tan sj
elements of vectors. You could also use a matrix and then convert it into a vector using as.vector: testmat3<-matrix(0,nrow=5,ncol=5) for(i in 1:5) { for(j in 1:5) { testmat3[i,j]<-i+j } } as.vector(testmat3) Jim On Wed, Apr 6, 2016 at 8:04 PM, tan sj wrote: > Hi, i am sorry to inter

[R] R simulation help pls

2016-04-06 Thread tan sj
Hi, i am student from malaysia, i am new in r programming field, now i am trying to conduct a robustness study on 2 sample test under several combination of factors such as sample sizes ,standard deviation ratio and also distribution.. but now i am stucking in how to use for loop or apply fun

[R] R-dvel [robustness Simulation study of 2 sample test on several combination of factors ]

2016-04-04 Thread tan sj
hi, i am new in this field. do favorite If I wish to conduct a simulation on the robustness of two sample test by using R language, is that any ways in writing the code? There ar

[R] Modular inverses

2009-11-27 Thread SJ Robson-Davis
I want to find the inverse of an integer k mod p (prime.) Is there a function that can do this for me? I know i could simply write (k^(p-2)) %% p, but i need to do this for large primes (above 100) and this gives the warning message: Warning message: probable complete loss of accuracy in modulus so

[R] predict from glmer

2009-11-24 Thread sj
Hi all, Windows XP R 2.10.0 I am trying to generate predictions from a binomial mixed model using glmer. the models is as follows: mod.PN <- glmer(PN_out~ as.factor(intr3) + transcode + Yr + (Yr|ID) family=binomial,data=partset, na.action=na.omit) where PN_out is a two column binomial variable

Re: [R] lme4 glmer how to extract the z values?

2009-11-11 Thread sj
Ben , Thanks! This worked after I updated my version of R (from 2.8.1 to 2.10) . Best, Spencer On Tue, Nov 10, 2009 at 7:04 PM, Ben Bolker wrote: > sj gmail.com> writes: > > > I am using glmer() from lmer(lme4) to run generalized linear mixed > models. I > >

[R] lme4 glmer how to extract the z values?

2009-11-10 Thread sj
Hello, I am using glmer() from lmer(lme4) to run generalized linear mixed models. I can't figure out how to extract the z values for the fixed effects that are reported using the summary function . Any help would be appreciated. Thanks, Spencer [[alternative HTML version deleted]]

[R] odfTable in loop

2008-10-21 Thread SJ
Dear list I try to create a report with several (an unknown number of) tables via odfTable. The following code results in the expected XML structure: ## scores.1=new.env() scores.1$cont.tab=rbind(c(3,5),c(6,8)) scores.2=new.env() scores.2$cont.tab=rbind(c(2,9),c(7,6))

[R] weighted quantiles

2008-10-07 Thread sj
I have a set of values and their corresponding weights. I can use the function weighted.mean to calculate the weighted mean, I would like to be able to similarly calculate the weighted median and quantiles? Is there a function in R that can do this? thanks, Spencer [[alternative HTML ve

[R] using which to identify a range of values

2008-07-18 Thread sj
Hello, I am trying to identify values that fall within a certain range. I thought that I might be able to use the which function to do this but I have been unable to figure out a way to do it. Perhaps a little code will illustrate what i am trying to do. a <- rnorm(1000, 100, 50) which( 100 < a

[R] data summarization etc...

2008-07-11 Thread sj
Hello, I am trying to do some fairly straightforward data summarization, i.e., the kind you would do with a pivot table in excel or by using SQL queires. I have a moderately sized data set of ~70,000 records and I am trying to compute some group averages and sum values within groups. the code exam

[R] data summerization etc...

2008-07-11 Thread sj
Hello, I am trying to do some fairly straightforward data summarization, i.e., the kind you would do with a pivot table in excel or by using SQL queires. I have a moderately sized data set of ~70,000 records and I am trying to compute some group averages and sum values within groups. the code exam

[R] Design package lrm summary and factors

2008-04-03 Thread sj
Hello, I have question regarding the lrm function and estimating the odds ratio between different levels of a factored variable. The following code example illustrates the problem I am having. I have a data set with an outcome variable (0,1) and an input variable (A,B,C). I would like to estimate t

Re: [R] Stationarity of a Time Series

2008-01-21 Thread sj
kpss.test in the tsereis package should do the trick On Jan 21, 2008 12:36 PM, stephen sefick <[EMAIL PROTECTED]> wrote: > Does anyone know of a test for stationarity of a time series, or like > all ordination techniques it is a qualitative assessment of a > quantitative result. Books, papers, e

[R] Missing Values in Design Package

2008-01-15 Thread sj
I am using psm to fit a survival model with a dataset that has missing values, e.g., DS <-psm(Surv(los,DSCHRG) ~AGE + SEX + ACUITY, data=LOS,dist='weibull',x=TRUE,y=TRUE) and I notice that when I look at the output there are 0 missing values and when I use the summary function e.g., summary(DS)

[R] analysis of large data set

2007-11-16 Thread sj
All, I am working with a large data set (~ 450,000 rows by 34 columns) I am trying to fit a regression model (I have tried to use several procedures psm (Design package) lm, glm). However whenever I try to fit the model I get the following error: Error: cannot allocate vector of size 1.1 Gb Her

Re: [R] a question on impulse responses

2007-10-13 Thread sj
I am pretty sure, it is a unit shock. I think that it says in th documentation. On 10/13/07, Martin Ivanov <[EMAIL PROTECTED]> wrote: > > > Dear R users, > > I am using the vars package to calculate the impulse response functions > and the forecast error variance decomposition of a VAR model. Unfo

Re: [R] calculate impulse responses

2007-10-12 Thread sj
Perhaps the VAR and irf functions in the vars library will allow you to do what you want. good luck, spencer On 10/12/07, Martin Ivanov <[EMAIL PROTECTED]> wrote: > > Dear R users, > > I need perform structural analysis on a no intercept VAR model. > Unfortunately the functions irf.VAR and d

[R] vars package, impulse response functions ??

2007-09-12 Thread sj
I am fitting a reduced form VAR model using VAR in the vars library. I have several endogenous variables, and two exogenous variables. I would like to explore the effects of a shock to one of the exogenous variables on one of the endogenous variables. Using irf in the vars library only calculates t