search for: mod1

Displaying 20 results from an estimated 214 matches for "mod1".

Did you mean: mod
2010 Feb 20
3
aggregating using 'with' function
Hi All, I am interested in aggregating a data frame based on 2 categories--mean effect size (r) for each 'id's' 'mod1'. The 'with' function works well when aggregating on one category (e.g., based on 'id' below) but doesnt work if I try 2 categories. How can this be accomplished? # sample data id<-c(1,1,1,rep(4:12)) n<-c(10,20,13,22,28,12,12,36,19,12, 15,8) r<-c(.98,.56,.03,.64,.49,-...
2010 Jan 28
2
Data.frame manipulation
...formed a weighted average of effect size for each study. This results in a reduced # of rows. I am particularly interested in simply reducing the additional variables in the data.frame to the first row of the corresponding id variable. For example: id<-c(1,2,2,3,3,3) es<-c(.3,.1,.3,.1,.2,.3) mod1<-c(2,4,4,1,1,1) mod2<-c("wai","other","calpas","wai","itas","other") data<-as.data.frame(cbind(id,es,mod1,mod2)) data id es mod1 mod2 1 1 0.3 2 wai 2 2 0.1 4 other 3 2 0.2 4 calpas 4 3 0....
2009 Jun 17
2
djustment values not defined
Hello,   I am using mod1 <- lrm(y~x1+x2,na.action=na.pass,method="lrm.fit") summary(mod1) and I've got the following error: Error in summary.Design(mod1) : adjustment values not defined here or with datadist for x1 x2   Many thank, Amor [[alternative HTML version deleted]]
2006 Mar 14
1
Ordered logistic regression in R vs in SAS
I tried the following ordered logistic regression in R: mod1 <- polr(altitude~sp + wind_dir + wind_speed + hr, data=altioot) But when I asked The summary of my regression I got the folloing error message: > summary (mod1) Re-fitting to get Hessian Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess, ...) : the initi...
2009 Mar 05
1
problems with nls?
...residuals, scatterplot. thanks SCRIPT ros<-read.table("Dataset.csv",header=T,sep=",") ros attach(ros) # preliminaries options(width=44) options(digits=3) ## Nonlinear Regression par(mfrow=c(1,2)) attach(ros) plot(U1.7km, R, main="(a)") library(nls) mod1<-nls(R ~ beta1*(U1.7km^beta2)+(Hm^beta3)),start=list(beta1=2.031,beta2=0.800,beta3=-0.255), trace = TRUE) summary(mod1) coef(mod1) coef(summary(mod1)) lines(R, fitted.values(mod1), lwd=2) plot(R, residuals(mod1), type="b", main="(b)") abline(h=0, lty=2) -- View this mess...
2012 Jun 29
1
number of items to replace is not a multiple of replacement length
...t_yr=y1850_file_no+(startyr-1850) print("************************************") filename=paste(file_name,start_yr,".nc",sep="") print("Opening:") print(varname) print("in:") print(filename) ncfile=open.ncdf(filename) mod1=get.var.ncdf(ncfile,varname) print("------------------------------------") a=dim(mod1) print(a) b=length(a) if (b==3) { mod =array(0,dim=c(a[1],a[2],a[3],nyrs)) modi=array(0,dim=a) } else { mod =array(0,dim=c(a[1],a[2],1,nyrs)) mod...
2010 Mar 29
1
getting CI's for certain y of nls fitted curve
....186302231, 1, 0.42980063, 0.103882476, 0.086463799), tr = c(513, 235.7, 120.4, 69.4, 318.3, 271.6, 97.5, 59.3, 476.5, 204.8, 49.5, 41.2)), .Names = c("run", "press", "tr_rel", "tr"), row.names = c(NA, -12L), class = "data.frame"))) summary(mod1<-nls(tr ~ SSlogis( log(press), Asym, xmid, scal),data=por)) press_x <- seq(10, 40, length = 100) predict(mod1, data.frame(press = press_x)) with(por, plot(press,tr,xlim=c(10,35),ylim=c(0,500))) lines(press_x, predict(mod1, data.frame(press = press_x))) ###http://finzi.psych.upenn.edu/R/R...
2010 Feb 15
2
creating functions question
...g but is irrelevant for the example): # sample data: id<-rep(1:20) n<-c(10,20,13,22,28,12,12,36,19,12,36,75,33,121,37,14,40,16,14,20) r<-c(.68,.56,.23,.64,.49,-.04,.49,.33,.58,.18,-.11,.27,.26,.40,.49, .51,.40,.34,.42,.16) mod2<-factor(c(rep(c(1,2,3,4),5))) da<-data.frame(id, n, r, mod1, mod2) reg0<-lm(da$r ~ 1) reg1<-lm(da$r ~ da$mod1) reg2<-lm(da$r ~ da$mod1 + da$mod2) # This is as far as I get with the function: MRfit <- function( ...) { models <- list(...) fit<- anova(models) return(fit) } MRfit(reg0,reg1,reg2) # This is what I get from R: # Error...
2006 Oct 04
1
extracting nested variances from lme4 model
I have a model: mod1<-lmer( x ~ (1|rtr)+ trth/(1|cs) , data=dtf) # Here, cs and rtr are crossed random effects. cs 1-5 are of type TRUE, cs 6-10 are of type FALSE, so cs is nested in trth, which is fixed. So for cs I should get a fit for 1-5 and 6-10. This appears to be the case from the random effects: > me...
2004 Jul 28
2
Simulation from a model fitted by survreg.
...) since my error terms are assumed to be Weibull, but it does not make any sense. The mean survival time is easy to predict, but I would like to simulate individual survival times. I am probably missing something completely obvious. Any hints or advice are appreciated. Thanks Sixten > summary(mod1) Call: survreg(formula = Surv(tid, study$first.event.death) ~ regim + age + stadium2, data = study, dist = "weibull") Value Std. Error z p (Intercept) 11.6005 0.7539 15.387 2.01e-53 regimposto -0.1350 0.1558 -0.867 3.86e-01 age -0.0362...
2011 Apr 08
1
Variance of random effects: survreg()
...t.seed(1007) x <- runif(100) m <- rnorm(10, mean = 1, sd =2) mu <- rep(m, rep(10,10)) test1 <- data.frame(Time = qsurvreg(x, mean = mu, scale= 0.5, distribution = "weibull"), Status = rep(1, 100), Unit = gl(10,10) ) mod1 <- survreg(Surv(Time, Status) ~ 1 + frailty.gaussian(Unit), data = test1) > mod1 ... coef se(coef) se2 Chisq DF p (Intercept) 0.987 0.582 0.0457 2.87 1.00 9.0e-02 frailty.gaussian(Unit) 85.26 8.95 1.4e-14 Scale= 0.434...
2009 Mar 12
1
zooreg and lmrob problem (bug?)
...,620.5187,759.3312,712.9750,606.6688,451.9250,560.2313, 308.1875,551.7687,615.3312,673.1250,678.4562,485.5312,491.8875,568.5688, 689.5750,507.0875,467.9125,539.4875,461.8625,827.3750,507.9250,526.5688, 363.9625,355.8813,585.9750,792.8438,698.6250,625.1063,463.4875,619.4688, 684.9438,815.3438) > mod1<-lmrob(dad~seq(58)) > summary(mod1) Call: lmrob(formula = dad ~ seq(58)) Weighted Residuals: Min 1Q Median 3Q Max -291.106 -98.083 0.912 102.219 349.697 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 630.2021 38.5583 16...
2006 Nov 11
1
predict.lda is missing ?
I'm trying to classify some observations using lda and I'm getting a strange error. I loaded the MASS package and created a model like so: >train <- mod1[mod1$rand < 1.7,] >classify <- mod1[mod1$rand >= 1.7,] >lda_res <- lda(over_win ~ t1_scrd_a + t1_alwd_a, data=train, CV=TRUE) That works, and all is well until I try to do a prediction for the holdouts: >lda_pred <- predict(lda_res, classify)$class Error in predict(lda_res...
2010 Jul 09
1
output without quotes
...column names without quotes and am struggling to do it properly. The tough part is that I am interested in using these column names for a function within a function (e.g., lm() within a wrapper function). Therefore, cat() doesnt seem appropriate and print() is not what I need. Ideas? # sample data mod1 <- rnorm(20, 10, 2) mod2 <- rnorm(20, 5, 1) dat <- data.frame(mod1, mod2) # collapsing the colnames to 'mod1+mod2' temp <- paste(names(dat), collapse="+") temp # this gives quotes print(temp, quote = FALSE) # no quotes but includes [1] # need the output like this...
2008 Dec 19
0
What BIC is calculated by 'regsubsets'?
...l-subsets selection based on the AIC rather than the BIC). The following code defines a function that illustrates the issue. Thanks -Paul script.ic <- function() { library(datasets) print(names(airquality)) # Ozone Solar.R Wind Temp Month Day # Fit a model with two predictors mod1 <- lm(Ozone ~ Wind + Temp, data=airquality) npar <- length(mod1$coef)+1 # no. parameters in fitted model, # including s2, is 4 nobs <- length(mod1$fitted) # no. of observations = 116 s2 <- summary(mod1)$sigma2 # MSE = 477...
2012 Mar 24
0
Help ordinal mixed model!
...set(du, ALT.RENAIS != 'NA') tabela <- table(du[,c(2,4)]) tabela colnames(tabela) <- c('Normal','Aguda','Cr?nica') rownames(tabela) <- c('Pre','Propolis','Vincr') tabela #the mixed model: set.seed(1) mod1 <- MCMCglmm(ALT.RENAIS ~-1+FASES, random= ~ ANIMAIS, family='ordinal',pl=TRUE,data=du) summary(mod1) Then the pain starts, since the documentation is insufficient in this case. According to him Jarrod (forums), the a posteriori means of the coefficients of the covariates are the pro...
2011 Oct 26
2
Error in summary.mlm: formula not subsettable
When I fit a multivariate linear model, and the formula is defined outside the call to lm(), the method summary.mlm() fails. This works well: > y <- matrix(rnorm(20),nrow=10) > x <- matrix(rnorm(10)) > mod1 <- lm(y~x) > summary(mod1) ... But this does not: > f <- y~x > mod2 <- lm(f) > summary(mod2) Error en object$call$formula[[2L]] <- object$terms[[2L]] <- as.name(ynames[i]) : objeto de tipo 'symbol' no es subconjunto I would say that the problem is in the follo...
2012 May 27
2
Unable to fit model using “lrm.fit”
Hi, I am running a logistic regression model using lrm library and I get the following error when I run the command: mod1 <- lrm(death ~ factor(score), x=T, y=T, data = env1) Unable to fit model using ?lrm.fit? where score is a numeric variable from 0 to 6. LRM executes fine for the following commands: mod1 <- lrm(death ~ score, x=T, y=T, data = env1) mod1<- lrm(death ~ factor(score)+...
2012 Mar 10
1
problem with effects : 'subscript out of bounds'
...r", "generalized", "other")) norway$trust <- tmp nor.trust <- as.factor(norway$trust) #### nor.trust is my IV, a factor as you can see. n.diversity <- norway$v221 ## control n.net <- norway$v228 ##control (there are others but they were coded the same) n.mod1 <- lm(nor.dem ~ nor.trust + n.diversity + n.age + n.sex + n.educ + famecon + n.net) ### linear model. all of these variables already are specific to the dataset which i called 'norway' so there is no need to specify in the model. summary(n.mod1) > plot(effect("nor.trust"...
2010 Jun 23
1
Shapefile
...p$WOLVES_99 %in% 2,];wolfsub dim(wolfsub) # 42 = Forest, 51 = Shrub, > 81 = Agriculture wolfsub$Forest<-ifelse(wolfsub$MAJOR_LC==42,1,0) wolfsub$Shrub<-ifelse(wolfsub$MAJOR_LC==51,1,0) wolfsub$Agriculture<-ifelse(wolfsub$MAJOR_LC>81,1,0) names(wolfsub);dim(wolfsub) # create the model mod1<-glm(WOLVES_99~RD_DENSITY+Forest+Shrub +Agriculture,family=binomial,data=wolfsub) summary(mod1) wolfsub$pred99<-fitted(mod1) names(wolfsub) #fitted(mod1) wolfsub$pred99 # Add the wolfsub data to the map to see the map wolfsub <- fortify(wolfsub);names(wolfsub) area_mod <- wolves.plot +...