search for: fit4

Displaying 20 results from an estimated 27 matches for "fit4".

Did you mean: fit
2012 Nov 08
2
Comparing nonlinear, non-nested models
...ym * (1-exp(-log(2)*(x-xo)/xo)) model4 <- function(x, xo, ym, k) ym * (1-exp(-log(2)*(x-xo)/k)) fit1 <- nls(y~model1(x, xo, ym), start=list(xo=0.5, ym=1)) fit2 <- nls(y~model2(x, xo, ym, k), start=list(xo=0.5, ym=1, k=1)) fit3 <- nls(y~model3(x, xo, ym), start=list(xo=0.5, ym=1)) fit4 <- nls(y~model4(x, xo, ym, k), start=list(xo=0.5, ym=1, k=1)) anova(fit1, fit2) anova(fit3, fit4) Models 1 and 2 are nested, as are models 3 and 4 (set k=xo), so they can be compared using anova. I am looking for a way to compare the non-nested models (ie models 1 and 3, and models 2 and 4), o...
2011 Sep 12
1
coxreg vs coxph: time-dependent treatment
...2 <- coxph(Surv(start,stop,event)~transplant + cluster(id), data=heart, weights = iptw, robust = T) fit2 # fit with coxph having robust and cluster option fit3 <- coxph(Surv(start,stop,event)~transplant + cluster(id), data=heart, weights = iptw) fit3 # fit with coxph having cluster option fit4 <- coxph(Surv(start,stop,event)~transplant, data=heart, weights = iptw) fit4 # fit with coxph # coxreg fit5 <- coxreg(Surv(start,stop,event)~transplant + cluster(id), data=heart, weights = iptw) fit5 # fit with coxreg from eha having cluster option fit6 <- coxreg(Surv(start,stop,event...
2005 Jun 15
1
anova.lme error
...ject "fit2" not found results <- myFunction(myDataFrame=df) ##################################################### ## The same thing outside of a function # Less restricted fit3 <- gls(y ~ dose, weights=varIdent(form=~1|dose), data=df) # more restricted fit4 <- gls(y ~ dose, data=df) ## This works: anova(fit3, fit4) ## The results: ## > anova(fit3, fit4) ## Model df AIC BIC logLik Test L.Ratio p-value ## fit3 1 5 57.98998 54.92145 -23.99499 ## fit4 2 3 55.75284 53.91172 -24.87642 1 vs 2 1.76286 0.4142
2004 May 07
0
rpart for CART with weights/priors
...eversion, i.e. preference for the other class) #lead to totally different trees... #third approach using weights: #sorting of data to design weight vector ind<-order(kyphosis[,1]) kyphosis1<-kyphosis[ind,] summary(kyphosis1[,1]) weight<-c(rep(1,64),rep(2,17)) summary(as.factor(weight)) fit4 <- rpart(Kyphosis ~ Age + Number + Start, data=kyphosis1, weights=weight) #leads to result very similar to fit2 with loss<-matrix(c(0,1,2,0),nrow=2,ncol=2) #(same tree and cutoff points, but slightly different probabilities, maybe numerical artefact?) fit4 plot(fit4) text(fit4,use.n=T) #do...
2008 Apr 17
1
survreg() with frailty
...atus) ~ rx + frailty(litter), rats) fit1 fit1$history[[1]]$theta # OK fit2 <- survreg(Surv(time, status) ~ rx + frailty(litter, df = 13), rats) fit2 fit2$history[[1]]$theta # discrepancy fit3 <- survreg(Surv(time, status)~ age + sex + frailty(id), kidney) fit3 fit3$history[[1]]$theta # OK fit4 <- survreg(Surv(time, status)~ age + frailty(id), kidney) fit4 fit4$history[[1]]$theta Am I missing something? Thanks in advance for any pointers! Best, Dimitris ---- Dimitris Rizopoulos Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35,...
2010 Feb 26
2
Error in mvpart example
..., collapse = ",", sep = "") : dim(X) must have a positive length This seems to be a problem with the cross-validation, since the "xerror" and "xstd" columns are missing from the summary table as well. Using the mpart() wrapper results in the same error: fit4<-mvpart(gdist(spider[,1:12],meth="bray",full=TRUE,sq=TRUE)~water+twigs+reft+herbs+moss+sand,spider,method="dist") summary(fit4) Note, changing the 'method' argument to ="mrt" seems, superficially, to solve the problem. However, when the dependent variable i...
2006 Aug 24
2
my error with augPred
Dear all I try to refine my nlme models and with partial success. The model is refined and fitted (using Pinheiro/Bates book as a tutorial) but when I try to plot plot(augPred(fit4)) I obtain Error in predict.nlme(object, value[1:(nrow(value)/nL), , drop = FALSE], : Levels (0,3.5],(3.5,5],(5,7],(7,Inf] not allowed for vykon.fac > Is it due to the fact that I have unbalanced design with not all levels of vykon.fac present in all levels of other explanatory fa...
2011 Jan 21
2
Looping with incremented object name and increment function
Folks, I am trying to get a loop to run which increments the object name as part of the loop. Here "fit1" "fit2" "fit3" and "fit4" are linear regression models that I have created. > for (ii in c(1:4)){ + SSE[ii]=rbind(anova(fit[ii])$"Sum Sq") + dfe[ii]=rbind(summary(fit[ii])$df) + } Error in anova(fit[ii]) : object 'fit' not found Why isn't it looking for object 'fit1' instead of '...
2004 Dec 20
2
problems with limma
...er in Anova > # > all <- cbind(nzw,akr) > ts <- c(1,1,1,2,2,2,3,3,3,4,4,4) > ts <- as.factor(ts) > levels(ts) <- c("nzwC","nzwT","akrC","akrT") > design <- model.matrix(~0+ts) > colnames(design) <- levels(ts) > fit4 <- lmFit(all,design) > cont.matrix <- makeContrasts( + Baseline = akrC - nzwC, + NZW_Smk = nzwT - nzwC, + AKR_Smk = akrT - akrC, + Diff = (akrT - akrC) - (nzwT - nzwC), + levels=design) > fit42 <- contrasts.fit(fit4,cont.matrix) > fit42 <- eBayes(f...
2005 Sep 09
1
nls fails to return correlation matrix (PR#8127)
...3 8 6.0219 0.67844 0.00139 4 10 6.1628 0.65797 0.00130 5 12 6.2885 0.64604 0.00119 6 16 6.4956 0.63047 0.00112 > df <- data.frame(x=data$V2-6, y=data$V3) > df x y 1 -0.3209 0.80709 2 -0.1364 0.71202 3 0.0219 0.67844 4 0.1628 0.65797 5 0.2885 0.64604 6 0.4956 0.63047 > fit4 <- nls(y ~ a+b*x+c*x^2+d*x^3+e*x^4, data = df, start = list(a = 1., b = -1., c = 1., d=-1., e=1.)) > summary(fit4) Formula: y ~ a + b * x + c * x^2 + d * x^3 + e * x^4 Parameters: Estimate Std. Error t value Pr(>|t|) a 0.680936 0.001327 513.002 0.00124 ** b -0.168167 0.010660 -15...
2011 Dec 05
1
about error while using anova function
fit1<-rq(formula=op~inp1+inp2+inp3+inp4+inp5+inp6+inp7+inp8+inp9,tau=0.15,data=wbc) fit2<-rq(formula=op~inp1+inp2+inp3+inp4+inp5+inp6+inp7+inp8+inp9,tau=0.5,data=wbc) fit3<-rq(formula=op~inp1+inp2+inp3+inp4+inp5+inp6+inp7+inp8+inp9,tau=0.15,data=wbc) fit4<-rq(formula=op~inp1+inp2+inp3+inp4+inp5+inp6+inp7+inp8+inp9,tau=0.15,data=wbc) fit5<-rq(formula=op~inp1+inp2+inp3+inp4+inp5+inp6+inp7+inp8+inp9,tau=0.15,data=wbc) *output of tau=0.15*fit1 Call: rq(formula = op ~ inp1 + inp2 + inp3 + inp4 + inp5 + inp6 + inp7 + inp8 + inp9, tau = 0.15, da...
2005 Feb 14
1
testing equality of variances across groups in lme?
Hello. I am fitting a two-level mixed model which assumes equality of variance in the lowest-level residuals across groups. The call is: fit3<-lme(CLnNAR~CLnRGR,data=meta.analysis, + na.action="na.omit",random=~1+CLnRGR|study.code) I want to test the assumption of equality of variances across groups at the lowest level. Can someone tell me how to do this? I know that one
2012 Feb 07
0
gmodels error: "no method for coercing this S4 class to a vector"
...I'm having a problem using functions in the gmodels library on an object of class mer from the lmer package. Code for a reproducible example is below. # Load lme4 library and sample data library(lme4) library(faraway) library(gmodels) data(penicillin) # Fit a linear mixed effects model fit4 <- lmer(yield ~ treat + (1|blend), penicillin) # Extract confidence intervals for fixed effects using gmodels library ci(fit4) The call to 'ci' results in the following error: Error in as.vector(data) : no method for coercing this S4 class to a vector This error does not occur w...
2018 Feb 14
0
Unexpected behaviour in rms::lrtest
...esterol, data = exdata) > fit2 <- lrm(y ~ blood.pressure + age + sex * cholesterol, data = exdata) > lrtest(fit1, fit2) # error as expected Error in lrtest(fit1, fit2) : models are not nested > fit3 <- lrm(y ~ blood.pressure + sex * age + rcs(cholesterol, 4), data = exdata) > fit4 <- lrm(y ~ blood.pressure + age + sex * rcs(cholesterol, 4), data = exdata) > lrtest(fit3,fit4) # gives result for apparently non-nested models Model 1: y ~ blood.pressure + sex * age + rcs(cholesterol, 4) Model 2: y ~ blood.pressure + age + sex * rcs(cholesterol, 4) L.R. Chisq...
2010 Sep 10
2
gee p values
windows Vista R 2.10.1 Is it possible to get p values from gee? Summary(geemodel) does not appear to produce p values.: > fit4<- gee(y~time, id=Subject, data=data.frame(data)) Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27 running glm to get initial regression estimate (Intercept) time 1.1215614 0.8504413 > summary(fit4) GEE: GENERALIZED LINEAR MODELS FOR DEPENDENT DATA gee S-function, ve...
2004 Dec 21
0
Fwd: problems with limma
...all <- cbind(nzw,akr) >> ts <- c(1,1,1,2,2,2,3,3,3,4,4,4) >> ts <- as.factor(ts) >> levels(ts) <- c("nzwC","nzwT","akrC","akrT") >> design <- model.matrix(~0+ts) >> colnames(design) <- levels(ts) >> fit4 <- lmFit(all,design) >> cont.matrix <- makeContrasts( > + Baseline = akrC - nzwC, > + NZW_Smk = nzwT - nzwC, > + AKR_Smk = akrT - akrC, > + Diff = (akrT - akrC) - (nzwT - nzwC), > + levels=design) >> fit42 <- contrasts.fit(fit4,cont.ma...
2012 Apr 29
0
need help with avg.surv (Direct Adjusted Survival Curve)
...uot;)) matlines(fits$time,fits$fits) fit2<-coxph(Surv(time, death) ~ stage + age.larynx + factor(year>=74), data=larynx, method=c("efron")) summary(fit2) fit3<-coxph(Surv(time, death) ~ stage.fac + age.larynx + year.larynx), data=larynx, method=c("efron")) summary(fit3) fit4<-coxph(Surv(time,death)~factor(stage)+factor(age>=74)+factor(year>=74),data=larynx,method=c("efron")) summary(fit4)  lines(survexp(~stage+ratetable(stage,age.larynx,year>=74),data=larynx,ratetable=fit2,cohort=TRUE),col="purple")  fits<-avg.surv(fit3, var.name=&quo...
2012 Apr 30
0
need help with avg.surv (Direct Adjusted Survival Curve), Message-ID:
...t;)) matlines(fits$time,fits$fits) fit2<-coxph(Surv(time, death) ~ stage + age.larynx + factor(year>=74), data=larynx, method=c("efron")) summary(fit2) fit3<-coxph(Surv(time, death) ~ stage.fac + age.larynx + year.larynx), data=larynx, method=c("efron")) summary(fit3) fit4<-coxph(Surv(time,death)~factor(stage)+factor(age>=74)+factor(year>=74),data=larynx,method=c("efron")) summary(fit4) lines(survexp(~stage+ratetable(stage,age.larynx,year>=74),data=larynx,ratetable=fit2,cohort=TRUE),col="purple") fits<-avg.surv(fit3, var.name=&q...
2013 Jul 09
3
fitting log function: errors using nls and nlxb
Hi- I am trying to fit a log function to my data, with the ultimate goal of finding the second derivative of the function. However, I am stalled on the first step of fitting a curve. When I use the following code: FG2.model<-(nls((CO2~log(a*Time)+b), start=setNames(coef(lm(CO2 ~ log(Time), data=FG2)), c("a", "b")),data=FG2)) I get the following error: Error in
2006 Jun 23
1
How to use mle or similar with integrate?
Hi I have the following formula (I hope it is clear - if no, I can try to do better the next time) h(x, a, b) = integral(0 to pi/2) ( ( integral(D/sin(alpha) to Inf) ( ( f(x, a, b) ) dx ) dalpha ) and I want to do an mle with it. I know how to use mle() and I also know about integrate(). My problem is to give the parameter values a and b to the