Displaying 7 results from an estimated 7 matches for "sloperegime1".
2018 May 22
2
Using tryCatch in a for loop
...ift <- 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]
SlopeRegime1 <- summary(seg.reg)$coefficients[2,1]
SlopeDiff <- summary(seg.reg)$coefficients[3,1]
new.regimeshift <- data.frame(RSyear=RSyear, SlopeRegime1=SlopeRegime1, SlopeDiff=SlopeDiff)
rownames(new.regimeshift) <- colnames(y)[i]
regimeshift <- rbind(regimeshift,new.regime...
2018 May 22
0
Using tryCatch in a for loop
...){
> ? 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]
> ? ? SlopeRegime1 <- summary(seg.reg)$coefficients[2,1]
> ? ? SlopeDiff <- summary(seg.reg)$coefficients[3,1]
> ? ? new.regimeshift <- data.frame(RSyear=RSyear, SlopeRegime1=SlopeRegime1, SlopeDiff=SlopeDiff)
> ? ? rownames(new.regimeshift) <- colnames(y)[i]
> ? ? regimeshift <- rbind(...
2018 May 22
4
Using tryCatch in a for loop
...ift <- 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]
? ? SlopeRegime1 <- summary(seg.reg)$coefficients[2,1]?
? ? SlopeDiff <- summary(seg.reg)$coefficients[3,1]?
? ? new.regimeshift <- data.frame(RSyear=RSyear, SlopeRegime1=SlopeRegime1, SlopeDiff=SlopeDiff)
? ? rownames(new.regimeshift) <- colnames(y)[i]
? ? regimeshift <- rbind(regimeshift,new.regime...
2018 May 22
0
Using tryCatch in a for loop
...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]
> SlopeRegime1 <- summary(seg.reg)$coefficients[2,1]
> SlopeDiff <- summary(seg.reg)$coefficients[3,1]
> new.regimeshift <- data.frame(RSyear=RSyear,
> SlopeRegime1=SlopeRegime1, SlopeDiff=SlopeDiff)
> rownames(new.regimeshift) <- colnames(y)[i]
> regimeshift <- rbind...
2018 May 22
3
Using tryCatch in a for loop
...ift <- 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]
? ? SlopeRegime1 <- summary(seg.reg)$coefficients[2,1]?
? ? SlopeDiff <- summary(seg.reg)$coefficients[3,1]?
? ? new.regimeshift <- data.frame(RSyear=RSyear, SlopeRegime1=SlopeRegime1, SlopeDiff=SlopeDiff)
? ? rownames(new.regimeshift) <- colnames(y)[i]
? ? regimeshift <- rbind(regimeshift,new.regime...
2018 May 22
0
Using tryCatch in a for loop
...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]
> SlopeRegime1 <- summary(seg.reg)$coefficients[2,1]
> SlopeDiff <- summary(seg.reg)$coefficients[3,1]
> new.regimeshift <- data.frame(RSyear=RSyear,
> SlopeRegime1=SlopeRegime1, SlopeDiff=SlopeDiff)
> rownames(new.regimeshift) <- colnames(y)[i]
> regimeshift <- rbind...
2018 May 22
0
Using tryCatch in a for loop
...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]
> SlopeRegime1 <- summary(seg.reg)$coefficients[2,1]
> SlopeDiff <- summary(seg.reg)$coefficients[3,1]
> new.regimeshift <- data.frame(RSyear=RSyear,
> SlopeRegime1=SlopeRegime1, SlopeDiff=SlopeDiff)
> rownames(new.regimeshift) <- colnames(y)[i]
> regimeshift <- rbind...