Displaying 7 results from an estimated 7 matches for "regimeshift".
2018 May 22
2
Using tryCatch in a for loop
...ake3<- c(1, 2, 5, -3, 1, 1, 2, 3, 4, 5, 6, 2, 3, 1, 2)
Lake4<- c(1, 1, 1, 1, 1, 1, 1, 250, 240, 240, 240, 240, 240, 239, 255)
mydata<- data.frame(Year, Lake1, Lake2, Lake3, Lake4)
#Running a for loop that indicates when an error or warning occurs
y<- mydata[,2:5]
year <- mydata$Year
regimeshift <- data.frame()
for (i in 1:4){
tryCatch({
y.val <- y[,i]
lin.reg <- lm(y.val~year, mydata)
seg.reg <- segmented.lm(lin.reg, seg.Z = ~ year, psi = NA, control = seg.control(stop.if.error = FALSE, n.boot = 0, it.max = 20))
RSyear <- summary(seg.reg)$psi [1,2]
Slo...
2018 May 22
0
Using tryCatch in a for loop
...2004)
> Lake1<- c(2, 4, 5, 2, 1)
> Lake2<- c(1, 3, -1, 4, -2)
> Lake3<- c(1, 2, 5, -3, 1)
> mydata<- data.frame(Year, Lake1, Lake2, Lake3)
>
> #Running a for loop that indicates when an error or warning occurs
> y<- mydata[,2:4]
> year <- mydata$Year
> regimeshift <- data.frame()
> for (i in 1:3){
> ? tryCatch({
> ? ? y.val <- y[,i]
> ? ? lin.reg <- lm(y.val~year, mydata)
> ? ? seg.reg <- segmented.lm(lin.reg, seg.Z = ~ year, psi = NA, control = seg.control(stop.if.error = FALSE, n.boot = 0, it.max = 20))
> ? ? RSyear <-...
2018 May 22
4
Using tryCatch in a for loop
...t dataset
Year<- c(2000, 2001, 2002, 2003, 2004)
Lake1<- c(2, 4, 5, 2, 1)
Lake2<- c(1, 3, -1, 4, -2)
Lake3<- c(1, 2, 5, -3, 1)
mydata<- data.frame(Year, Lake1, Lake2, Lake3)
#Running a for loop that indicates when an error or warning occurs
y<- mydata[,2:4]
year <- mydata$Year
regimeshift <- data.frame()
for (i in 1:3){
? tryCatch({
? ? y.val <- y[,i]
? ? lin.reg <- lm(y.val~year, mydata)
? ? seg.reg <- segmented.lm(lin.reg, seg.Z = ~ year, psi = NA, control = seg.control(stop.if.error = FALSE, n.boot = 0, it.max = 20))
? ? RSyear <- summary(seg.reg)$psi [1,2]
? ? Slo...
2018 May 22
0
Using tryCatch in a for loop
...3, 4, 5, 6, 2, 3, 1, 2)
> Lake4<- c(1, 1, 1, 1, 1, 1, 1, 250, 240, 240, 240, 240, 240, 239, 255)
> mydata<- data.frame(Year, Lake1, Lake2, Lake3, Lake4)
>
> #Running a for loop that indicates when an error or warning occurs
> y<- mydata[,2:5]
> year <- mydata$Year
> regimeshift <- data.frame()
> for (i in 1:4){
> tryCatch({
> y.val <- y[,i]
> lin.reg <- lm(y.val~year, mydata)
> seg.reg <- segmented.lm(lin.reg, seg.Z = ~ year, psi = NA, control =
> seg.control(stop.if.error = FALSE, n.boot = 0, it.max = 20))
> RSyear <-...
2018 May 22
3
Using tryCatch in a for loop
...t dataset
Year<- c(2000, 2001, 2002, 2003, 2004)
Lake1<- c(2, 4, 5, 2, 1)
Lake2<- c(1, 3, -1, 4, -2)
Lake3<- c(1, 2, 5, -3, 1)
mydata<- data.frame(Year, Lake1, Lake2, Lake3)
#Running a for loop that indicates when an error or warning occurs
y<- mydata[,2:4]
year <- mydata$Year
regimeshift <- data.frame()
for (i in 1:3){
? tryCatch({
? ? y.val <- y[,i]
? ? lin.reg <- lm(y.val~year, mydata)
? ? seg.reg <- segmented.lm(lin.reg, seg.Z = ~ year, psi = NA, control = seg.control(stop.if.error = FALSE, n.boot = 0, it.max = 20))
? ? RSyear <- summary(seg.reg)$psi [1,2]
? ? Slo...
2018 May 22
0
Using tryCatch in a for loop
..., 2004)
> Lake1<- c(2, 4, 5, 2, 1)
> Lake2<- c(1, 3, -1, 4, -2)
> Lake3<- c(1, 2, 5, -3, 1)
> mydata<- data.frame(Year, Lake1, Lake2, Lake3)
>
> #Running a for loop that indicates when an error or warning occurs
> y<- mydata[,2:4]
> year <- mydata$Year
> regimeshift <- data.frame()
> for (i in 1:3){
> tryCatch({
> y.val <- y[,i]
> lin.reg <- lm(y.val~year, mydata)
> seg.reg <- segmented.lm(lin.reg, seg.Z = ~ year, psi = NA, control =
> seg.control(stop.if.error = FALSE, n.boot = 0, it.max = 20))
> RSyear <-...
2018 May 22
0
Using tryCatch in a for loop
..., 2004)
> Lake1<- c(2, 4, 5, 2, 1)
> Lake2<- c(1, 3, -1, 4, -2)
> Lake3<- c(1, 2, 5, -3, 1)
> mydata<- data.frame(Year, Lake1, Lake2, Lake3)
>
> #Running a for loop that indicates when an error or warning occurs
> y<- mydata[,2:4]
> year <- mydata$Year
> regimeshift <- data.frame()
> for (i in 1:3){
> tryCatch({
> y.val <- y[,i]
> lin.reg <- lm(y.val~year, mydata)
> seg.reg <- segmented.lm(lin.reg, seg.Z = ~ year, psi = NA, control =
> seg.control(stop.if.error = FALSE, n.boot = 0, it.max = 20))
> RSyear <-...