z <- data.frame(geo = c("Iceland", "Portugal", "Spain"),
eu = c("nonEU", "EU", "EU"),
year = rep(c("2018","2019"), each = 3),
freq = c(2,3,7,1,5,6), stringsAsFactors = FALSE)
z4 <- z[-c(1:2), ]
PLSroundingFits(z4, "freq", formula = ~eu * year + geo, extend0 = FALSE)[c("inner", "publish")]
PLSroundingFits(z4, "freq", formula = ~eu * year + geo)[c("inner", "publish")]
my_km2 <- SSBtools::SSBtoolsData("my_km2")
# Default automatic extension (extend0Fits = TRUE)
PLSroundingFits(my_km2, "freq",
formula = ~(Sex + Age) * Municipality * Square1000m + Square250m)[c("inner", "publish")]
# Manual specification to avoid Nittedal combined with another_km
PLSroundingFits(my_km2, "freq", formula = ~(Sex + Age) * Municipality * Square1000m + Square250m,
extend0Fits = list(c("Sex", "Age"),
c("Municipality", "Square1000m", "Square250m")))[c("inner", "publish")]
# Example with both extend0 (specified) and extend0Fits (default is TRUE)
PLSroundingFits(my_km2, "freq", formula = ~(Sex + Age) * Municipality * Square1000m + Square250m,
printInc = TRUE, zeroCandidates = TRUE, roundBase = 5, extend0 = list(c("Sex", "Age"),
c("Municipality", "Square1000m", "Square250m")))[c("inner", "publish")]
Run the code above in your browser using DataLab