search for: model3

Displaying 20 results from an estimated 72 matches for "model3".

Did you mean: model
2006 Jan 09
1
trouble with extraction/interpretation of variance structure para meters from a model built using gnls and varConstPower
...ata x = c(0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7); y0 = c(.1,.1,.1, .5,.5,.5, 1,1,1, 2,2,2, 4,4,4, 7,7,7, 9,9,9, 10,10,10); yp = c(0,.03,.05, 0,.05,.01, 0,.07,.03, .1,0,.2, .2,.1,0, .3,0,.1, 0,.3,.4, .3,.5,0); y = y0 + 4*yp; data = data.frame(x=x,y=y); #Run model library(nlme) model3 = try(gnls(y ~ SSfpl(x,A,B,xmid,scal),data=data,weights=varConstPower(const=1,power=0,form= ~fitted(.)))); #Examine results model3; #const = .6551298, power = .8913665 summary(model3); #const = .6551298, power = .8913665...
2007 Jan 03
1
problem with logLik and offsets
Hi, I'm trying to compare models, one of which has all parameters fixed using offsets. The log-likelihoods seem reasonble in all cases except the model in which there are no free parameters (model3 in the toy example below). Any help would be appreciated. Cheers, Jarrod x<-rnorm(100) y<-rnorm(100, 1+x) model1<-lm(y~x) logLik(model1) sum(dnorm(y, predict(model1), summary(model1)$sigma,log=TRUE)) # no offset - in agreement model2<-lm(y~offset(rep(1,100))+x-1) logLik(model2)...
2010 Apr 01
2
Adding regression lines to each factor on a plot when using ANCOVA
...v:group) model1.summ <- summary(model1) model1.anv <- anova(model1) # separate regression lines for each group, but with the same slope model2 <- lm(lgVar ~ lgCov + group) model2.summ <- summary(model2) model2.anv <- anova(model2) # same regression line for all groups model3 <- lm(lgVar ~ lgCov) model3.summ <- summary(model3) model3.anv <- anova(model3) compare <- anova(model1, model2, model3) # compare all models # plots par(mfcol=c(1,2)) boxplot(lgVar ~ group, col="darkgoldenrod1") # plot the variate and covariate by group plot(lgVar...
2011 Sep 08
1
predict.rma (metafor package)
...1,2,3),5))) # factor mid<-c(rep(1:5,4)) # covariate df<-data.frame(id, n.1,n.2, g, var.g,mod, mid) # Examples # Random Effects model1<-rma(g,var.g,mods=~mid,method="REML") # covariate model model2<-rma(g,var.g,mods=~mod,method="REML") # factor model model3<-rma(g,var.g,mods=~mid+mod,method="REML") # multiple # example matrix for predicting against model3 newdat<-expand.grid(c(1,2,3,4,5),c(1,2,3)) predict(model1,newmods=c(1,2,3,4,5)) predict(model2,newmods=c(1,2,3)) predict(model3,newmods=newdat) -- Andr...
2006 Feb 17
0
trouble with extraction/interpretation of variance struct ure para meters from a model built using gnls and varConstPower
...spencer.graves at pdf.com] Sent: Sunday, January 15, 2006 6:41 PM To: Rand, Hugh Cc: 'r-help at lists.R-project.org' Subject: Re: [R] trouble with extraction/interpretation of variance structure para meters from a model built using gnls and varConstPower How about this: > exp(coef(model3$modelStruct$varStruct)["const"]) const 0.6551298 Does that answer the question about not understanding the connection between summary(model3) and coef(model3$modelStruct$varStruct)["const"]? Regarding the question about R not being able to find 'coef.varFunc...
2009 Mar 09
1
lme anova() and model simplification
...1 7 9.702400 0.0170 adh31 1 2 0.015683 0.9118 awpm 1 2 2.824076 0.2349 apsm 1 2 1.520431 0.3428 orien 1 2 6.167557 0.1310 > > > model2<-lme(awsm~adh31+awpm+apsm+orien,random=~1|viney,method="ML") > model3<-lme(awsm~adh31+awpm+orien,random=~1|viney,method="ML") > anova(model2,model3) Model df AIC BIC logLik Test L.Ratio p-value model2 1 7 42.44324 46.91664 -14.22162 model3 2 6 41.47847 45.31281 -14.73924 1 vs 2 1.035230 0.3089 > > model3.1...
2011 May 27
1
Error with BRugs 0.53 and 0.71, on Win7 with R 2.12.2 and 2.13.0 (crashes R GUI)
...+ alpha12 * x1[i] * x2[i] + b[i] } alpha0 ~ dnorm(0, 1.0E-6) alpha1 ~ dnorm(0, 1.0E-6) alpha2 ~ dnorm(0, 1.0E-6) alpha12 ~ dnorm(0, 1.0E-6) tau ~ dgamma(0.001, 0.001) sigma <- 1 / sqrt(tau) } " print(modelString) writeLines(modelString,con="model3.txt") modelCheck( "model3.txt" ) Which (usually) produces: > modelCheck( "model3.txt" ) Error in handleRes(res[[3]]) : An OpenBUGS module or procedure was called that did not exist. I've copied at the end of this message an example from a single R session that s...
2008 Oct 02
1
An AIC model selection question
Dear R users, Assume I have three models with the following AIC values: model AIC df model1 -10 2 model2 -12 5 model3 -11 2 Obviously, model2 would be preferred, but it "wastes" 5 df compared to the other models. Would it be allowed to select model3 instead, simply because it uses up less df and the delta-AIC between model2 and model3 is just 1? Many thanks for any suggestions/comments! Best wishes C...
2009 Jul 02
0
MCMCpack: Selecting a better model using BayesFactor
...artment of Commerce, Sydney. I am using R 2.9.1 on Windows XP. This has reference to the package “MCMCpack”. My objective is to select a better model using various alternatives. I have provided here an example code from MCMCpack.pdf. The matrix of Bayes Factors is: model1 model2 model3 model1 1.000 14.08 7.289 model2 0.071 1.00 0.518 model3 0.137 1.93 1.000 > PostProbMod(BF) model1 model2 model3 0.82766865 0.05878317 0.11354819 I need assistance to interpret the results. If I am wrong, please correct me. 1. By looking at the matrix...
2011 Apr 14
1
mixed model random interaction term log likelihood ratio test
...way to analyze a mixed model with the MatingPair as the fixed effect, DrugPair as the random effect and the interaction between these two as the random effect as well. Please confirm if that seems correct. 2. Assuming the above code is correct, I have model2 in which I remove the interaction term, model3 in which I remove the DrugPair term and model4 in which I only keep the fixed effect of MatingPair. 3. I want to perform the log likelihood ratio test to compare these models and that's why I have REML=F. However the code anova(model1, model2, model3, model4) gives me a chisq estimate and a p-...
2004 Oct 26
3
GLM model vs. GAM model
...ial", na.action = na.exclude) A second nested model could be: model2 <-glm(formula = exitus ~ age+gender, family = "binomial", na.action = na.exclude) To compare these two GLM models the instruction is: anova(model1,model2, test="F") Similarly for GAM models model3 <-gam(formula = exitus ~ s(age)+gender, family = "binomial", na.action = na.exclude) "R" allows to compare these two models (GLM vs. GAM) anova(model2,model3, test="F") This instruction returns a p-value with no error or warning, but this test is based on max...
2005 Apr 24
2
A question on the library lme4
Hi, I ran the following model using nlme: model2<-lme(log(malrat1)~I(year-1982),random=~1|Continent/Country,data=wbmal10) I'm trying to run a Poisson GlMM to avoid the above transformation but I don't know how to specify the model using lmer in the lme4 library: model3<-lmer((malrat1)~I(year-1982) + ??,data=wbmal10,family=poisson) How can I introduce a random factor of the form= ~1|Continent/Country? Thanks; -- Luis Fernando Chaves
2006 Sep 12
4
variables in object names
Is there any way to put an argument into an object name. For example, say I have 5 objects, model1, model2, model3, model4 and model5. I would like to make a vector of the r.squares from each model by code such as this: rsq <- summary(model1)$r.squared for(i in 2:5){ rsq <- c(rsq, summary(model%i%)$r.squared) } So I assign the first value to rsq then cycle through models 2 through 5 gathering th...
2010 Oct 03
5
How to iterate through different arguments?
If I have a model line = lm(y~x1) and I want to use a for loop to change the number of explanatory variables, how would I do this? So for example I want to store the model objects in a list. model1 = lm(y~x1) model2 = lm(y~x1+x2) model3 = lm(y~x1+x2+x3) model4 = lm(y~x1+x2+x3+x4) model5 = lm(y~x1+x2+x3+x4+x5)... model10. model_function = function(x){ for(i in 1:x) { } If x =1, then the list will only add model1. If x =2, then the list will add both model1 and model2. If x=3, then the list will add model1 model 2 and model3 and s...
2009 Jan 16
2
Predictions with GAM
...with the example shown below: * model1<-gam(nsdall ~ s(jdaylitr2), data=datansd) newd1 <- data.frame(jdaylitr2=(244:304)) pred1 <- predict.gam(model1,newd1,type="response")* The problem I am encountering now is that I cannot seem to get it done for the following type of model: *model3<-gam(y_no~s(day,by=mapID),family=binomial, data=mergeday)* My mapID consists of 8 levels of which I get individual plots with * plot(model3)*. When I do predict with a newdata in it just like my first model I need all columns to have the same amount of rows or else R will not except it ofcourse...
2008 Nov 25
4
glm or transformation of the response?
...ata.frame( response=rpois(40,1:40), explanatory=1:40) attach(poissondata) However, I have run into a problem because it looks like the lm model (with sqrt-transformation) fits the data best: ## model1=lm(response~explanatory,poissondata) model2=lm(sqrt(response+0.5)~explanatory,poissondata) model3=lm(log(response+1)~explanatory,poissondata) model4=glm(response~explanatory,poissondata,family=poisson) model5=glm(response~explanatory,poissondata,family=quasipoisson) model6=glm.nb(response~explanatory,poissondata) model7=glm(response~explanatory,quasi(variance="mu",link="identity&...
2012 Jun 06
3
Sobel's test for mediation and lme4/nlme
...sobel.lme<-function (pred, med, out, grpid) { NEWDAT <- data.frame(pred = pred, med = med, out = out, grpid=grpid) NEWDAT <- na.exclude(NEWDAT) model1 <- lme(out ~ pred, random=~1|grpid,data = NEWDAT) model2 <- lme(out ~ pred + med, random=~1|grpid, data = NEWDAT) model3 <- lme(med ~ pred, random=~1|grpid, data = NEWDAT) mod1.out <- summary(model1)$tTable mod2.out <- summary(model2)$tTable mod3.out <- summary(model3)$tTable indir <- mod3.out[2, 1] * mod2.out[3, 1] effvar <- (mod3.out[2, 1])^2 * (mod2.out[3, 2])^2 + (mod2.out[3,...
2010 Sep 29
1
Understanding linear contrasts in Anova using R
.... #group3 -2.71500 0.61412 -4.421 4.67e-05 *** #group4 -1.25833 0.61412 -2.049 0.045245 * #group5 0.08667 0.61412 0.141 0.888288 # Use sum contrasts to compare each group against grand mean. options(contrasts = c("contr.sum","contr.poly")) model3 <- lm(dv ~ group) summary(model3) # Again, this is as expected. Intercept is grand mean and others are deviatoions from that. #Coefficients: # Estimate Std. Error t value Pr(>|t|) # (Intercept) 0.7997 0.1942 4.118 0.000130 *** # group1 1.0028...
2001 Oct 23
1
Rows function in nlme package
The Rows function which is called from plot.compareFits in the nlme package is not found. > plot(compareFits(coef(bp.model3),coef(bp.model3M))) Error in plot.compareFits(compareFits(coef(bp.model3), coef(bp.model3M))) : couldn't find function "Rows" > Can I find it elswhere? Have I missed a required package? Thanks Ross Darnell > library(help=nlme) nlme Linear and nonlinear mixed e...
2009 Aug 12
1
psi not functioning in nlrob?
Hi all, I'm trying to fit a nonlinear regression by "nlrob": model3=nlrob(y~a1*x^a2,data=transient,psi=psi.bisquare, start=list(a1=0.02,a2=0.7),maxit=1000) However an error message keeps popping up saying that the function psi.bisquare doesn't exist. I also tried psi.huber, which is supposed to be the default for nlrob: model3=nlrob(y~a1*x^a2,data=transient,...