[R] Calculating between and within subject coefficient of variation

2017-03-29 Thread Alicia Ellis
Let's say I have repeated measures of some outcome on some subjects. I want to be able to calculate the within and between subject coefficient of variation for this measure. An example data frame is: df<-data.frame(ID = c(1,1,1,2,2,2,3,3,3), DAY = c(0,3,6, 0,3,6, 0,3,6),

Re: [R] Changing cell value for MANY unique pairings of values in 2 columns

2017-03-20 Thread Alicia Ellis
t; On Mar 18, 2017, at 9:52 AM, David Winsemius > wrote: > > > > > >> On Mar 17, 2017, at 11:33 AM, Alicia Ellis > wrote: > >> > >> am cleaning some very messy health record lab data. Several of the rows > >> in the VALUE column have te

[R] Changing cell value for MANY unique pairings of values in 2 columns

2017-03-18 Thread Alicia Ellis
am cleaning some very messy health record lab data. Several of the rows in the VALUE column have text entries and they need to be converted to numeric in the NUMERIC_VALUE column based on the values in VALUE and DESCRIPTION. For example: df <- data.frame(VALUE = c("<60", "Positive", "Negative",

[R] p.adjust not working correctly?

2016-08-03 Thread Alicia Ellis
p.adjust for bonferroni p value correction does not appear to be working correctly: > p <- runif(50) > > p [1] 0.08280254 0.08955706 0.19754389 0.52812033 0.68907772 0.21849696 0.02774784 0.23923562 0.03482480 0.76437481 0.87236155 0.76438604 [13] 0.37432032 0.89630318 0.01626565 0.08152060 0.557

[R] "no 'nobs' method available" error when using BIC selection in glmulti with genetic algorithm and lmer

2014-03-25 Thread Alicia Ellis
ed_sqrt* pden_lscan_scaled_sqrt* wealth.factor_scaled* time.water_scaled_sqrt* drink.water* urban.rural, data=mydata, level = 1, fitfunc = lmer.glmulti, random = "+(1|country.code/year/cluster)", method = "g", imm = 0.5, crit = bic, confsetsize = 16384) -- Alicia El

[R] Fwd: Error with glmulti

2014-03-18 Thread Alicia Ellis
dom = "+(1|country.code.short/year/cluster)", crit = bic, imm = 0.5, confsetsize = 5) CAN ANYONE EXPLAIN WHY WE GET THE NEGATIVE LENGTH VECTORS ERROR IF WE INCLUDE HOUSEHOLD NESTED WITHIN THE OTHER RANDOM FACTORS FOR GLMULTI BUT NOT FOR LMER? ANY SUGGESTIONS F

[R] Error with glmulti

2014-03-06 Thread Alicia Ellis
dom = "+(1|country.code.short/year/cluster)", crit = bic, imm = 0.5, confsetsize = 5) CAN ANYONE EXPLAIN WHY WE GET THE NEGATIVE LENGTH VECTORS ERROR IF WE INCLUDE HOUSEHOLD NESTED WITHIN THE OTHER RANDOM FACTORS FOR GLMULTI BUT NOT FOR LMER? ANY SUGGESTIONS F

[R] Error with glmulti

2014-03-06 Thread Alicia Ellis
ter/household), mydata, REML = F) print(lmer.model) proc.time() - ptm This works fine and gives the following output -- Alicia Ellis Postdoc Gund Institute for Ecological Economics University of Vermont 617 Main Street Burlington, VT 05405 (802) 656-1046 http://www.wcs-heal.org http://www.uvm

[R] help with NLOPTR

2013-01-03 Thread Alicia Ellis
GLAG", "xtol_rel"=0.01) ## some algorithms in nloptr require a local algorithm too opts=list("algorithm" = "NLOPT_GN_ISRES", "xtol_rel" = 0.01, "maxeval"=10 ,"local_opts" = local_opts, "print_level"=2) nloptr(x0=x0, ev

[R] loading & using Ryacas

2012-12-05 Thread Alicia Ellis
ges("yacas") library(yacas) and get this: Warning message: package ‘yacas’ is not available (for R version 2.15.2) Got the same thing for R version 2.15.1. Suggestions? I'm fairly new to R and could use some detailed instructions. Working on Mac OSx 10.8.2 Thanks! -- Alic

[R] Solve system of equations (nleqslv) only returns origin

2012-12-04 Thread Alicia Ellis
2])+K*(2*v2*N2*D)) - (delta1*theta*x[3]*(2*v1*N1*D)) - (delta2*theta*x[4]*(2*v2*N2*D)))-Cs*((2*v1*N1*D)+(2*v2*N2*D))) result=(x) } Xstart=c(1, 200, 0.5, 0.5, 12) fstart= firstordercond(Xstart) nleqslv(Xstart, firstordercond) -- Alicia Ellis Postdoc Gund Institute