search for: grp

Displaying 20 results from an estimated 613 matches for "grp".

Did you mean: arp
2009 Jun 17
2
Re gression by groups questions
...m is also that I want to extend it from a single variable case to a multivariable case and haven't really got a clue how to go about it. Hope someone can help. # The code below creates a data.frame comprising two marginally noisy straight lines and performs a # regression on each based on the grp factor. This is a single variable case based on R wiki one liner. # y = x for grp A # y = 2 + 5x for grp B set.seed(5) ind <- as.vector(runif(50)) d1 <- data.frame(x=ind, y=ind + rnorm(50,0,0.1), grp=rep("A", 50)) d2 <- data.frame(x=ind, y=2+5*ind+rnorm(50,0,0.1), grp=rep("...
2006 Jul 17
1
sem: negative parameter variances
Dear Spencer and Prof. Fox, Thank you for your replies. I'll very appreciate, if you have any ideas concerning the problem described below. First, I'd like to describe the model in brief. In general I consider a model with three equations. First one is for annual GRP growth - in general it looks like: 1) GRP growth per capita = G(investment, migration, initial GRP per capita, spatial lag on GRP growth + some additional explanatory variables to control for regional disparities), where spatial lag on GRP growth in year t is simply spatial weights matrix...
2005 Jun 26
4
Mixed model
...ffects. Following previous correspondence . Dataset <- read.table("C:/Program Files/R/rw2011/data/miss/model1a.dat", header=TRUE, sep="\t", na.strings="NA", dec=".", strip.white=TRUE) attach(Dataset) require (nlme) with(Dataset, table(runnb, id, grp)) b.lvls <- table(Dataset$runnb) nb <- length(b.lvls) fit <- vector(mode="list", nb) for(i in 1:nb) fit[[i]]<- lme (trans1 ~ Index1 + grp, random = ~ 1 | id / grp , data = Dataset, na.action = "na.exclude")...
2005 Nov 03
1
Specify Z matrix with lmer function
...my modifications noted. x <- fossil$age y <- 100000*fossil$strontium.ratio knots <- seq(94,121,length=25) n <- length(x) X <- cbind(rep(1,n),x) Z <- outer(x,knots,"-") Z <- Z*(Z>0) # I had to create the groupedData object with one group to fit the model I wanted grp <- rep(1,n) grp.dat<-groupedData(y~Z|grp) fit <- lme(y~-1+X,random=pdIdent(~-1+Z),data=grp.dat) I would like to know how I could fit this same model using the lmer function. Specifically can I specify a Z matrix in the same way as I do above in lme? Thanks, Mark
2009 Jun 23
1
How to exclude insignificant intercepts using "step" function
...have now done. The code below creates a data.frame comprising three marginally noisy surfaces. The code below (including a fix courtesy of David Winsemius that avoids a step function error through use of the "by" function) returns significant coefficients for regressions based on factor grp. In the case of grp A the intercept is not significantly different from zero. However I can't get step to consider dropping the intercept term. In the attached code the returned function for grp A is y ~ x1+x2. However I think it should return y ~ -1 + x1 +x2 (or I guess y ~ 0 + x1 + x2). If I...
2007 Dec 30
2
auth-master permission error
On F7, I get to where I have Postfix and Dovecot installed and configured, postfix check runs fine, but when I try to start Dovecot I'm getting a permission error. Here is the log entry: Dec 29 21:54:06 grp-01-50-90 dovecot: Dovecot v1.0.7 starting up Dec 29 21:54:06 grp-01-50-90 dovecot: Generating Diffie-Hellman parameters for the first time. This may take a while.. Dec 29 21:54:06 grp-01-50-90 dovecot: auth(default): bind(/var/run/dovecot/auth-master) failed: Permission denied Dec 29 21:54:06 grp-0...
2003 May 19
1
plotting a simple graph
...or the three groups (each group represented by a different symbol), overlaid by the fitted regression lines for each group's relation between the 'x1' and 'y' variables, covarying the remaining four 'x' variables and adjusting them to their mean values. #All five of the grp*x interactions are significant in: fit1=lm(log(y)~grp*(log(x1)+log(x2)+log(x3)+log(x4)+log(x5)) summary(fit1) #However, to avoid sending all of the data, I create dummy data-sets #that have distributions resembling the original variables (which are #very skewed, hence the log-transformations). gr...
2018 Mar 06
4
Capturing warning within user-defined function
...s looking at them know how to view those estimates. I am successfully able to do this in a straightforward set of steps. However, once I place those steps inside a function it fails. Here's the code (sorry this is a long post): # create data wt <- rgamma(6065, 0.7057511981, 0.0005502062) grp <- sample(c(replicate(315, "Group1"), replicate(3672, "Group2"), replicate(1080, "Group3"), replicate(998, "Group4"))) dta <- data.frame(grp, wt) head(dta) str(dta) # declare design my.svy <- svydesign(ids=~1, weights=~wt, data=dta) # subset grp1 &...
2005 Sep 20
3
annotating an axis in bwplot (lattice)
...e size for every group in a bwplot as a parenthetical annotation to the axis. Here's a sketch: --8<---------------cut here---------------start------------->8--- require(Hmisc) age <- sample(1:100, 1000, replace = TRUE) sex <- gl(2, 8, 1000, c("Male", "Female")) grp <- gl(4, 6, 1000, letters[1:4]) bwplot(grp ~ age | sex, aspect = 0.5, box.ratio = 2, panel = function(x, y, ...) { panel.bpplot(x, y, nout = 0.01, probs = seq(0.05, 0.45, 0.05)) nage <- tapply(age, grp, length) panel.text(rep(0, length(x)), seq(along = x), l...
2006 Mar 10
1
add trend line to each group of data in: xyplot(y1+y2 ~ x | grp...
Although this should be trivial, I'm having a spot of trouble. I want to make a lattice plot of the format y1+y2 ~ x | grp but then fit a lm to each y variable and add an abline of those models in different colors. If the xyplot followed y~x|grp I would write a panel function as below, but I'm unsure of how to do that with y1 and y2 without reshaping the data before hand. Thoughts appreciated. -Andy foo <- da...
2008 Sep 23
5
xyplot problem
...the dots indicates a Z value (like e.g. earthquake maps where dot sizes indicate magnitudes and X/Y the location). This works fine with xyplot, e.g.: xyplot(1:3~1:3,cex=1:3,pch=16) However, when I do this with a panel variable, e.g.: x<-rep(1:3,5) y <- rep(1:3,5) sz <- rep(1:5,each=3) grp <- factor(rep(1:5,each=3)) xyplot(y~x | grp , cex=sz) then sz in the cex argument is not applied per group as I would expect. Same for other arguments like col. Is this really the intended behaviour? How can I achieve what I want, i.e., that the cex argument is different for the different...
2001 Dec 03
3
beginner's questions about lme, fixed and random effects
...package. My first attempt was to try doing a t-test in lme. This is very similar to the Rail example that comes with nlme, but it has two groups instead of five. So I try a1 <- 1:10 a2 <- 7:16 t.test(a2,a1) getting t(18)=4.43, p=.0003224. Then I try to do it with lme: a12 <- c(a1,a2) grp <- factor(rep(1:2,c(10,10))) Now, at this point, I think I should be able to do something like this: lme(a12~grp) or lme(a12~1|grp) but I keep getting an error message, "Invalid formula for groups." So I tried making a groupedData object: data1 <- as.data.frame(cbind(a12,grp)) gd...
2010 Feb 14
2
xyplot, overlay two variables on one plot with group factors
All I want to overlay two variables on the same plot following their appropriate grouping. I have attempted to use subscripting in panel with panel.xyplot, but I can't get the grouping to follow into the panel...here is an example... dat<-data.frame( y= log(1:10), y2=10:19, x=1:10, grp = as.factor(1) ) dat2<-data.frame( y= log(10:19), y2= 20:29, x=1:10, grp = as.factor(c(2)) ) dat<-rbind(dat, dat2) # Here I plot both response variables on y axis by the same x xyplot(y2 ~ x, dat, groups=grp, type="l") xyplot(y ~ x, dat, groups=grp, type="l") # I wan...
2010 Apr 10
7
Attempting to checksum a non-TCP/UDP packet errors rolling across screen
Hello, Just did a fresh install of xen-4.0 and using the 2.6.31.13 dom0 kernel. I have 6 linux debian guests running, and on my host console i am getting these errors rolling pretty constantly. "Attempting to checksum a non-TCP/UDP packet, dropping a protocol 1 packet" I tried doing the ethtool -K eth0 tx off and same thing on peth0, using bridged mode for network config. Any tips?
2010 Apr 10
7
Attempting to checksum a non-TCP/UDP packet errors rolling across screen
Hello, Just did a fresh install of xen-4.0 and using the 2.6.31.13 dom0 kernel. I have 6 linux debian guests running, and on my host console i am getting these errors rolling pretty constantly. "Attempting to checksum a non-TCP/UDP packet, dropping a protocol 1 packet" I tried doing the ethtool -K eth0 tx off and same thing on peth0, using bridged mode for network config. Any tips?
2009 May 08
1
glm fit
Hi, I try to ask here, because I hope someone will help me understand this problem- I have fittet a glm in R with the results > glm1 <- > glm(log(claims)~log(sum)*as.factor(grp),family=gaussian(link="identity")) > summary(glm1) Call: glm(formula = log(claims) ~ log(sum) * as.factor(grp), family = gaussian(link = "identity")) Deviance Residuals: Min 1Q Median 3Q Max -6.6836 -1.3626 -0.2576 1.2038 8.2480 Coefficien...
2010 Dec 06
3
[plyr] Question regarding ddply: use of .(as.name(varname)) and varname in ddply function
..., 0.663383934998686)), .Names = c("g10", "l1", "d1", "l13", "d13" ), row.names = c(1L, 2L, 3L, 1758L, 1759L, 1760L), class = "data.frame") ----------- If some one doesn't want to open github - here is the code ## Doesn't work # grp -- name of a column of the the data.frame df # function call is -- getMinMax1( df1 , grp = "var1") getMinMax1 <-function(df, grp){ dfret <- ddply( df , .(as.name(grp)), ## I am using as.name(grp), source of error function(x){ minmax <- c(mix(x[...
2013 Mar 28
2
ggplot2: less than equal sign
Hi I am trying to add a less than equal sign to a plot. I have previously done this using unicode but is not working in this instance. Any suggestions would be great thanks example code: library(ggplot2) df<-data.frame(vis=c(0,0,1,1) , count=c(10,15,20,10) , grp=c(0,1,0,1)) df$grp <-factor(df$grp ,levels=c(0,1) , labels =c("x \u2265 10" , "x > 10")) ggplot(df, aes(x = factor(vis), y=count , fill=grp)) + geom_bar(stat = "identity") -- View this message in context: http://r.789695.n4.nabble.com/ggplot2-less-than-equal...
2010 Oct 08
2
Count values in a dataframe with respect to groups
Dear all, I am looking for a function to count values belonging to a class within a dataframe (and ignore NAs). grp = c(1,1,1, 1,2, 2,2) val = c(2,1,5,NA,3,NA,1) dta = data.frame(grp=grp, val=val) The result should look like: grp count 1 3 2 2 At the moment, I am trying to find a function for FUN in aggregate, but with no success. Can anybody help me? Thanks in advance. Marcus
2009 Jul 03
3
Variable names in lattice XY-plot
...? Variable text acet = "Acetylaspartate Thalamus" chol = "Choline Thalamus" acetp = "Acetylaspartate parieoc" ino = "Inositole Thalamus" I could not find a solution. Please have a look at my syntax. Thanks a lot, Udo library(lattice) grp <-c(0,1,0,1) zp <- c(1,1,2,2) acet <- c(1.7,1.8,1.9,1.8) chol <- c(0.6, 0.8,0.8, 0.7) ino <- c(0.6, 0.3, 0.5, 0.4) acetp <- c(1.8, 1.9, 2.0, 1.8) data <- data.frame(cbind(grp, zp, acet, chol, ino, acetp)) data$grp <- factor(data$grp) levels(data$grp) <- c("low"...