similar to: By processing on two variables at once?

Displaying 20 results from an estimated 6000 matches similar to: "By processing on two variables at once?"

2007 Feb 01
2
Losing factor levels when moving variables from one context to another
Hi, there I'm currently trying to figure out how to keep my "factor" levels for a variable when moving it from one data frame or matrix to another. Example below: vec1<-(rep("10",5)) vec2<-(rep("30",5)) vec3<-(rep("80",5)) vecs<-c(vec1, vec2, vec3) resp<-rnorm(2,15) dat<-as.data.frame(cbind(resp, vecs))
2009 Feb 08
5
glmmBUGS: logistic regression on proportional data
Hello, I am trying to run a logistic regression with random effects on proportional data in glmmBUGS. I am a newcomer to this package, and wondered if anyone could help me specify the model correctly. I am trying to specify the response variable, /yseed/, as # of successes out of total observations... but I suspect that given the error below, that is not correct. Also, Newsect should be a
2008 Mar 31
1
APPLY as alternate to FOR loop?
Dear list, Below I've written a clunky for loop that counts NA's in a row, replacing all with NA if there are more than 3 missing values, or keeping the values if 4 or more are present. This is sample code from a very large dataframe I'm trying to clean up. I know there are many simpler more elegant solutions to this little problem. Would someone be willing to show me how to
2010 Sep 11
3
confidence bands for a quasipoisson glm
Dear all, I have a quasipoisson glm for which I need confidence bands in a graphic: gm6 <- glm(num_leaves ~ b_dist_min_new, family = quasipoisson, data = beva) summary(gm6) library('VIM') b_dist_min_new <- as.numeric(prepare(beva$dist_min, scaling="classical", transformation="logarithm")). My first steps for the solution are following: range(b_dist_min_new)
2012 Jun 06
3
Sobel's test for mediation and lme4/nlme
Hello, Any advice or pointers for implementing Sobel's test for mediation in 2-level model setting? For fitting the hierarchical models, I am using "lme4" but could also revert to "nlme" since it is a relatively simple varying intercept model and they yield identical estimates. I apologize for this is an R question with an embedded statistical question. I noticed that a
2017 Aug 09
3
Plotting log transformed predicted values from lme
Hi, I am performing meta-regression using linear mixed-effect model with the lme() function that has two fixed effect variables;one as a log transformed variable (x) and one as factor (y) variable, and two nested random intercept terms. I want to save the predicted values from that model and show the log curve in a plot ; predicted~log(x) mod<-lme(B~log(x)+as.factor(y),
2004 Jan 08
3
Strange parametrization in polr
In Venables \& Ripley 3rd edition (p. 231) the proportional odds model is described as: logit(p<=k) = zeta_k + eta but polr apparently thinks there is a minus in front of eta, as is apprent below. Is this a bug og a feature I have overlooked? Here is the naked code for reproduction, below the results. ------------------------------------------------------------------------ --- version
2011 Sep 08
1
predict.rma (metafor package)
Hi (R 2.13.1, OSX 10.6.8) I am trying to use predict.rma with continuous and categorical variables. The argument newmods in predict.rma seems to handle coviariates, but appears to falter on factors. While I realise that the coefficients for factors provide the answers, the goal is to eventually use predict.rma with ANCOVA type model with an interaction. Here is a self contained example
2008 Jul 09
2
sorting a data frame by rownames
Hi there, I'm sure there's an easy answer to this, and I can't wait to see it. The question: is there an easy way to sort a data frame by it's row names? My dilemma: I've had to pull apart a data frame, run it through a loop to do some calculations and generate new variables, and then re-construct the chunks back into a data frame at the end. Doing this preserves the row
2012 Apr 18
3
normal distribution assumption for multi-level modelling
Hello, I'm analysing reaction time data from a linguistic experiment (a variant of a lexical decision task). To ascertain that the data was normally distributed, I used *shapiro.test *for each participant (see commands below), but only one out of 21 returns a p value above p.0 05. > f = function(dfr) return(shapiro.test(dfr$Target.RTinv)$p.value) > p = as.vector(by(newdat,
2017 Aug 10
0
Plotting log transformed predicted values from lme
Dear Alina If I understand you correctly you cannot just have a single predicted curve but one for each level of your factor. On 09/08/2017 16:24, Alina Vodonos Zilberg wrote: > Hi, > > I am performing meta-regression using linear mixed-effect model with the > lme() function that has two fixed effect variables;one as a log > transformed variable (x) and one as factor (y)
2011 Apr 04
1
Clarks 2Dt function in R
Dear Ben, you answerd to Nancy Shackelford about Clarks 2Dt function. Since the thread ended just after your reply, I would like to ask, if you have an idea how to use this function in R I defined it the following way: function(x , p, u) { (p/(pi*u))*(1+(x^2/u))^(p+1) } and would like to fit this one to my obeservational data (count) [,1] [,2] [1,] 15 12 [2,] 45 13 [3,]
2005 May 13
1
manipulating dataframe according to the values of some columns
hi netters, I'm a newbie to R and there are some very simple problems puzzeled me for two days. I've a dataframe here with several columns different in modes. Two of the columns are special for me: column 1 has the mode "factor" and column 2 has the mode "numeric vectors". The values for column 1 are either "T" or "F". I wanna do two things:
2011 Jun 24
2
mgcv:gamm: predict to reflect random s() effects?
Dear useRs, I am using the gamm function in the mgcv package to model a smooth relationship between a covariate and my dependent variable, while allowing for quantification of the subjectwise variability in the smooths. What I would like to do is to make subjectwise predictions for plotting purposes which account for the random smooth components of the fit. An example. (sessionInfo() is at
2005 May 24
3
obtaining first and last record for rows with same identifier
I have a dataframe that contains fields such as patid, labdate, labvalue. The same patid may show up in multiple rows because of lab measurements on multiple days. Is there a simple way to obtain just the first and last record for each patient, or do I need to write some code that performs that. Thanks, Steven
2017 Aug 10
1
Plotting log transformed predicted values from lme
Thank you Michael, Curves for each level of the factor sounds very interesting, Do you have a suggestion how to plot them? Thank you! Alina *Alina Vodonos Zilberg* On Thu, Aug 10, 2017 at 7:39 AM, Michael Dewey <lists at dewey.myzen.co.uk> wrote: > Dear Alina > > If I understand you correctly you cannot just have a single predicted > curve but one for each level of your
2009 Aug 21
2
compare observed and fitted GAM values
Hi, I am comparing the observed and fitted values of my GAM model, which includes the explanatory variables: longitude, depth, ssh, year and month. When I compare observed and fitted values for longitude, depth and ssh it works. But when I try to do it for month and year (which are as factors in the GAM model) it doesn't work. My observed and fitted values are exactly the same.. How is that
2012 Mar 27
1
Unique instances of a string in a vector -- there must be a better way to do this
I'm sure there's a better way to do this using plyr. I just can't nail the right series of commands. I've got a vector of strings. I want to remove all where the string's count within the vector is > 1. Right now I'm using: Where x2 is the original data.frame and my character strings live in x2[,3]. Based on my results, that looks like it works, though if someone
2012 Mar 28
1
Why does this work? plyr within-subset normalization
Working code that normalize each row's value against the subset's maximum. Does the invocation of max() somehow instruct R to 'step back' and evaluate the subset? Thanks, Zack -- View this message in context: http://r.789695.n4.nabble.com/Why-does-this-work-plyr-within-subset-normalization-tp4512989p4512989.html Sent from the R help mailing list archive at Nabble.com.
2006 Aug 17
8
instance variables in templates
Hey all, Well... hmm... feeling pretty stupid here... For some reason my controller instance variables are not displaying in my templates. I''ve boiled it down to this test case. class Rss::FilmController < ApplicationController def display @time = Time.now end end and the template: <html> <head> <title>Is This Ever Going To Work</title>