[R] Multilevel mediated moderation

2015-07-27 Thread Sally Chan
know whether a Level 2 variable can be specified in a lmer model...any idea? mod.m <- lmer(Med ~ IV*Mod + (IV | firm_id), data, REML=FALSE) mod.y <- lmer(DV ~ Med*IV*Mod + (IV | firm_id), data, REML=FALSE) Thanks so much for your help!!! Best regards, Sally [[alternative HTML vers

[R] posting for R-help on the predict function and categorical variables in R

2014-03-07 Thread Roman, Sally (MRC)
at any value less than 0.5 was equal to 0 and any value greater than 0.5 was equal to 1. Does this seem correct? Thanks for any help. Sally Roman Fisheries Management Specialist Virginia Marine Resources Commission 2600 Washington Avenue, 3rd Floor Newport News, VA 23607 Phone: 757-247-2243

[R] Probit regression with limited parameter space

2012-01-31 Thread Sally Luo
Dear R helpers, I need to estimate a probit model with box constraints placed on several of the model parameters. I have the following two questions: 1) How are the standard errors calclulated in glm (family=binomial(link="probit")? I ran a typical probit model using the glm probit link and the

[R] Formatting probability data to produce confusion matrix for binary data for logistric regression

2011-12-12 Thread Sally Ann Sims
-0.740746896 0.249451379 0.992102707 0.528213419 0.336177573 -0.944476861 1.000292603 0.273345885 0.994184267 -1.419114223 Or is there another function for entering probabilities into my data file to calculate a confusion matrix? Thank you, Sally [[alternative HTML version

[R] logistric regression: model revision

2011-11-07 Thread Sally Ann Sims
in the model where costdis1 is squared. Any ideas what I might do to correct this? Thank you. Sally [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] Constructing the transition pair using loop function and paste()

2011-10-20 Thread Sally Zhen
,6), rep(2857,2), rep(6178,3), rep(6018,5), rep(5629,4), > rep(7535,4)) > mydata <- as.data.frame(cbind(x,y)) > names(mydata) <- c('actions', 'agents') > mydata > > transition <- vector('list', length(unique(mydata$agents)))# > create

[R] Constructing the transition pair using loop function and paste()

2011-10-20 Thread Sally Zhen
the outputs transit.i <- c() for (j in 1:length(agent.i$actions)-1){ transit.i[j] <- paste(agent.i$actions[j], agent.i$actions[j+1], sep = '')} # for each subset of each agent, perform the 'pairing' transition[[i]] <- transit.i} transition The actions are ordered,

[R] Importing all observations and variables from csv file into dataframe

2011-10-17 Thread Sally Ann Sims
red into R as a dataframe. Thank you, Sally [[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 a

[R] loop function within a loop

2011-10-12 Thread Sally Zhen
Hi all, I'm working on a loop function for a large dataset which contains 1000 different groups. I would like to reconstruct the order of events within each group by using a loop function in R. (Currently the order of events are based on the ascending order of prev_event within the group) A demo

[R] How to draw a map of Europe?

2011-03-19 Thread Sally Luo
Hi R users, I need to draw a map of select European countries with country names shown on the map. Does anyone know how to do this in R? Also, is it possible to draw a historical map of European countries using R? Thanks a lot for your help. Maomao [[alternative HTML version deleted]]

[R] if statement and truncated distribution

2010-10-24 Thread Sally Luo
Hi R helpers, I am trying to use the if statement to generate a truncated random variable as follows: if (y[i]==0) { v[i] ~ rnorm(1,0,1) | (-inf ,0) } if (y[i]==1) { v[i] ~ rnorm(1,0,1) | (0, inf) } I guess I cannot use " | ( , ) " to restrict the range of a variable in R. Could you let me kno

[R] Problem using BRugs

2010-10-15 Thread Sally Luo
Hi R users, I am trying to call openbugs from R. And I got the following error message: ~ model is syntactically correct expected the collection operator c error pos 8 (error on line 1) variable ww is not defined

[R] Place constrictions on parameters when using Optim and MaxLik

2010-09-30 Thread Sally Luo
Hi R users, I am trying to restrct the range of two of the parameters in a maximization problem. Both parameters should be between -1 and 1. As far as I know, if I choose the estimation method ="L-BFGS-B" under Optim, I can restrict the parameter space. However, the "L-BFGS-B" always require fi

[R] Can I monitor the iterative/convergence process while using Optim or MaxLik?

2010-09-14 Thread Sally Luo
Hi R-helpers, Is it possible that I have the estimates from each step/iteration shown on the computer screen in order to monitor the process while I am using Optim or MaxLik? Thanks for your help. Maomao [[alternative HTML version deleted]] _

[R] How can I fixe convergence=1 in optim

2010-09-04 Thread Sally Luo
Hi R users, I am using the optim funciton to maximize a log likelihood function. My code is as follows: p<-optim(c(-0.2392925,0.4653128,-0.8332286, 0.0657, -0.0031, -0.00245, 3.366, 0.5885, -0.8, 0.0786,-0.00292,-0.00081, 3.266, -0.3632, -0.49,0.1856, 0.00394, -0.00193

[R] What does this warning message (from optim function) mean?

2010-08-25 Thread Sally Luo
Hi R users, I am trying to use the optim function to maximize a likelihood funciton, and I got the following warning messages. Could anyone explain to me what messege 31 means exactly? Is it a cause for concern? Since the value of convergence turns out to be zero, it means that the converging is s

[R] Read.table not reading in all columns

2009-02-19 Thread Sally
Hello, I am reading in a file called fit2.txt (Limma). fit2.txt has 38 columns but when I dim(fit2) I only get 6 columns. The first column that it does not read in is df.residual. fit2<-read.table(fit2, file="fit2.txt",sep="\t",quote="",comment.char="",as.is=TRUE) The first few lines of fi

[R] Delete row if first letter of row name is

2009-02-14 Thread Sally
Hello! I am still a beginner. Can you tell me how to delete a row (from a matrix or data.frame) if the row name starts with U? See example below: U179971039 0.0586630.087575 empty1 -0.1296 -0.09105 empty2 0.136259 0.398073 empty3 0.446041 -0.33997 Sally

[R] Error Message: Error in dim(data) <- dim : attempt to set an attribute on NULL

2009-02-12 Thread Sally
(s24vss48,file="s24vss48.txt",sep="\t") s48vss96<-topTable(fit2,coef="s48vss96",number=3412,adjust.method="BH",p.value=1) write.table(s48vss96,file="s48vss96.txt",sep="\t") c0vsc24<-topTable(fit2,coef="c0vsc24",numb