Displaying 7 results from an estimated 7 matches for "rsyear".
2018 May 22
2
Using tryCatch in a for loop
...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]
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]...
2018 May 22
0
Using tryCatch in a for loop
...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]
> ? ? 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)...
2018 May 22
4
Using tryCatch in a for loop
...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]
? ? 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]...
2018 May 22
0
Using tryCatch in a for loop
...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]
> 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...
2018 May 22
3
Using tryCatch in a for loop
...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]
? ? 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]...
2018 May 22
0
Using tryCatch in a for loop
...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]
> 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...
2018 May 22
0
Using tryCatch in a for loop
...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]
> 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...