[R] Confidence intervals nls
Dear All I am quite new to R and would appreciate some help fitting 95% confidence intervals to a nls function. I have the data DOY CET 90 5.9 91 8 92 8.4 93 7.7 95 6.6 96 6.8 97 7.1 98 9.7 99 12.3 100 12.8 102 11 103 9.3 104 9.8 105 9.9 107 7.7 110 6.2 111 5.9 112 5.9 113 3.4 114 3.5 116 3.3 117 5.4 118 6.3 119 9.7 120 11.2 121 7.3 124 7.8 etc I am trying to use some code that has been previously posted on the help boards but keep getting an error message "dim(X) must have a positive length" plot(DOY, CET) model<-nls(CET~a+(b*sin(((2*pi)/365)*(DOY+t))),start=list(a=9.5, b=-6.5, t=65)) summary(model) days<-seq(0,365,1) predict(model,list(DOY=days)) se.fit <- sqrt(apply(attr(predict(model,list(DOY = days)),"gradient"),1, function(x) sum(vcov(fm)*outer(x,x matplot(days, predict(model,list(DOY = days))+ outer(se.fit,qnorm(c(.5, .025,.975))),type="l") Any help would be greatly appreciated Best wishes Tom -- View this message in context: http://n4.nabble.com/Confidence-intervals-nls-tp1556487p1556487.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Confidence intervals nls
Dear Peter Thank you that is an error in the code but unfortunately the problem is still apparent. I think it is related to calculating the gradient Tom -- View this message in context: http://n4.nabble.com/Confidence-intervals-nls-tp1556487p1556585.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Survival analysis
Dear all I have a dataset examining the probability of a population surviving (calculated from a logistic regression) of a species over a 200yr period. The predictor variables are either continuous but non-normal (e.g. temperature, oxygen) or categorical (e.g. channelisation), unfortunately I also have a large amount of missing values. YearDecline Temperature Oxygen Channelisation 18000.947758115 36.6NA NA 18010.946135961 25.2NA NA 18020.944466388 28.5NA NA 18030.942748196 35.5NA NA 18040.940980166 33 NA NA 18050.93916106 30.2NA NA truncated … 19990.028531339 10.5NA 5 20000.027649801 8.4 NA 5 I have been trying to run a Cox Proportional Hazards Model with the code model<-coxph(Surv(Year, Decline) ~ Temperature + Oxygen + Channelisation) but keep getting an error message ‘Invalid status value’. Have I inputted the data in the wrong format or am I trying to run a totally unsuitable model? Any help would be greatly appreciated Tom -- View this message in context: http://n4.nabble.com/Survival-analysis-tp1559155p1559155.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Survival analysis
We are looking the extinction of a species of freshwater fish. The logistic regression was derived by scoring the anecdotal descriptions of the species' former population size (1 for a positive description of the population e.g. abundant, and 0 for a negative description e.g. scarce) and plotting this against time. Therefore it’s the population size relative to t=0. The anecdotal evidence in not regular and therefore why I used a derived measure of the population. We then have the predictor variables temperature, oxygen and river modification for some of the 1800-2000 time period. Unfortunately the data is collected in bursts e.g. for the oxygen 1923-1938 and the 1954-1972, so the missing data will not be random. Best wishes, Tom -- View this message in context: http://n4.nabble.com/Survival-analysis-tp1559155p1559435.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.