Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored Jun 20, 2024
1 parent b28baa5 commit afc3c16
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ plm()): Between, between, Sum, Within.
before (all default to FALSE).
* warning issued if an index variable is to be constructed that subsequently
overwrites an already present column of the same name ('id' and/or 'time').
* pacified warning in subsetting with with non-existent rows and columns due
* pacified warning in subsetting with non-existent rows and columns due
to deprecation of 'structure(NULL, *)' in R >= 3.4.0.
* \$<-.pdata.frame: preserves storage mode and sets correct class if propagation
to higher class occurred for a pseries prior to assignment
Expand Down
2 changes: 1 addition & 1 deletion R/deprecated.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ plm.data <- function(x, indexes = NULL) {
class(x) <- setdiff(class(x), "pdata.frame")

# class "plm.dim" always has indexes in first two columns (id, time)
# while "pdata.frame" leaves the index variables at it's place (if not dropped at all with drop.index = T)
# while "pdata.frame" leaves the index variables at its place (if not dropped at all with drop.index = T)
x <- x[ , c(names_indexes, setdiff(orig_col_order, names_indexes))]

# set class
Expand Down
2 changes: 1 addition & 1 deletion R/detect_lin_dep_alias.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
#' form <- price ~ 0 + cpi + fact1 + fact2
#' mf <- model.frame(Cigar.p, form)
#' # no linear dependence in the pooling model's model matrix
#' # (with intercept in the formula, there would be linear depedence)
#' # (with intercept in the formula, there would be linear dependence)
#' detect.lindep(model.matrix(mf, model = "pooling"))
#' # linear dependence present in the FE transformed model matrix
#' modmat_FE <- model.matrix(mf, model = "within")
Expand Down
4 changes: 2 additions & 2 deletions R/est_pi.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ aneweytest <- function(formula, data, subset, na.action, index = NULL, ...){
if(!balanced) stop("'aneweytest' not implemented for unbalanced data")

ht <- match.call(expand.dots = FALSE)
m <- match(c("formula", "data", "subset", "na.action",
"effect", "model", "inst.method", "restict.matrix",
~ <- match(c("formula", "data", "subset", "na.action",
"effect", "model", "inst.method", "restrict.matrix",
"restrict.rhs", "index"), names(ht), 0)
ht <- ht[c(1L, m)]
ht[[1L]] <- as.name("plm")
Expand Down
2 changes: 1 addition & 1 deletion R/tool_ranfixef.R
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ ranef.plm <- function(object, effect = NULL, ...) {
#' Overall Intercept for Within Models Along its Standard Error
#'
#' This function gives an overall intercept for within models and its
#' accompanying standard error or an within model with the overall intercept
#' accompanying standard error or a within model with the overall intercept
#'
#' The (somewhat artificial) intercept for within models (fixed
#' effects models) was made popular by Stata of StataCorp
Expand Down
2 changes: 1 addition & 1 deletion R/tool_transformations_collapse.R
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ pdiff.collapse <- function(x, effect = c("individual", "time"), has.intercept =
}
}

## last data preperation before return
## last data preparation before return
res <- na.omit(res)
if(is.matrix(x)) {
# original pdiff (coded in base R) removes constant columns in matrix,
Expand Down
10 changes: 5 additions & 5 deletions inst/removed/test_model.matrix_pmodel.response_NA.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Tests for correct construction in case of NAs of model.matrix[.pFormula|.plm] and pmodel.response.[pFormula|.plm]

# see, if NA dropping in construction of model.matrix and pmodel.response is done correctly.
# Some special NA patterns were not handeled correctly pre rev. 192 if pmodel.repsonse or model.matrix were called directly
# Some special NA patterns were not handeled correctly pre rev. 192 if pmodel.response or model.matrix were called directly

# 1) model.matrix[.pFormula|.plm]
# 2) pmodel.response.[pFormula|.plm]
Expand Down Expand Up @@ -190,7 +190,7 @@ resp_pFormula_NA_depvar_fe <- plm:::pmodel.response.formula(form, data = pGrun
#Error in model.matrix.pFormula(pFormula(formula), data = data, model = model, :
# dims [product 199] do not match the length of object [0]

# pmodel.repsonse.plm
# pmodel.response.plm
resp_plm_NA_depvar_pool <- plm:::pmodel.response.plm(plm(form, data = pGrunfeld_NA_dep_var, model = "pooling"))
resp_plm_NA_depvar_fe <- plm:::pmodel.response.plm(plm(form, data = pGrunfeld_NA_dep_var, model = "within"))
resp_plm_NA_depvar_fe_tw <- plm:::pmodel.response.plm(plm(form, data = pGrunfeld_NA_dep_var, model = "within", effect = "twoways"))
Expand All @@ -202,17 +202,17 @@ resp_plm_NA_indepvar_fe_tw <- plm:::pmodel.response.plm(plm(form, data = pGrunfe
resp_plm_NA_indepvar_re <- plm:::pmodel.response.plm(plm(form, data = pGrunfeld_NA_indep_var, model = "random"))


# pmodel.repsonse.pFormula with NA in dependent variable
# pmodel.response.pFormula with NA in dependent variable
resp_pFormula_NA_depvar_pool <- plm:::pmodel.response.formula(form, data = pGrunfeld_NA_dep_var, model = "pooling")
resp_pFormula_NA_depvar_fe <- plm:::pmodel.response.formula(form, data = pGrunfeld_NA_dep_var, model = "within")
resp_pFormula_NA_depvar_fe_tw <- plm:::pmodel.response.formula(form, data = pGrunfeld_NA_dep_var, model = "within", effect = "twoways")
# NOT OK: error
#resp_pFormula_NA_depvar_re <- plm:::pmodel.response.pFormula(form, data = pGrunfeld_NA_dep_var, model = "random")

# pmodel.repsonse.pFormula with NA in _in_dependent variable
# pmodel.response.pFormula with NA in _in_dependent variable
# NA in independent variable is detected and vector of dependent variable (response) adjusted according (drop the observation)
# -> resulting response has 199 entries, albeit there are 200 obs for the response but NA in independent variable
# -> thus, the results of pmodel.repsonse and model.matrix match
# -> thus, the results of pmodel.response and model.matrix match
resp_pFormula_NA_indepvar_pool <- plm:::pmodel.response.formula(form, data = pGrunfeld_NA_indep_var, model = "pooling")
resp_pFormula_NA_indepvar_fe <- plm:::pmodel.response.formula(form, data = pGrunfeld_NA_indep_var, model = "within")
resp_pFormula_NA_indepvar_fe_tw <- plm:::pmodel.response.formula(form, data = pGrunfeld_NA_indep_var, model = "within", effect = "twoways")
Expand Down
2 changes: 1 addition & 1 deletion inst/tests/test_detect_lin_dep_alias.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Tests for functions:
# * detect.lindep
# * alias
# YC 2017/10/09 : RE model par defaut pb because the between model is empty
# YC 2017/10/09 : RE model par default pb because the between model is empty


library(plm)
Expand Down
4 changes: 2 additions & 2 deletions inst/tests/test_groupGenerics_pseries.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ print(summary(zz2))
if (!isTRUE(all.equal(zz$coefficients, zz2$coefficients))) stop("estimation results not equal")


############# (3) assinging to a pdata.frame #############
############# (3) assigning to a pdata.frame #############
## test for assigning by $<- to a pdata.frame
## pre rev. 634: decimals which had been integers previously were converted to integers with typeof == integer
## and gave wrong results.
Expand Down Expand Up @@ -188,7 +188,7 @@ mode(x2)
typeof(x2)

y2 <- y / 10
class(y2) # c("myclass", "interger") - not propagated to c("myclass", "numeric")
class(y2) # c("myclass", "integer") - not propagated to c("myclass", "numeric")
mode(y2)
typeof(y2)
y2 # 0.1 0.2 0.3 - class is c("myclass", "integer") but result is decimals!
Expand Down
4 changes: 2 additions & 2 deletions inst/tests/test_lag_lead.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ plm:::lagr.pseries(Grunfeld$firm2)
# from the sample's unique factor levels, but it should stay in the levels
plm:::lagr.pseries(Grunfeld$fac)
if (!(length(unique(Grunfeld$fac)) == 200)) stop("wrong factor values") # 200
if (!(length(unique(plm:::lagr.pseries(Grunfeld$fac))) == 191)) stop("plm:::lagr.pseries: wrong actually uniquely occuring factor values") # 191
if (!(length(unique(plm:::lagr.pseries(Grunfeld$fac))) == 191)) stop("plm:::lagr.pseries: wrong actually uniquely occurring factor values") # 191
if (!(length(levels(plm:::lagr.pseries(Grunfeld$fac))) == 200)) stop("wrong factor levels") # 200

# plm::lead eliminates e.g., level "200"
plm:::leadr.pseries(Grunfeld$fac)
if (!(length(unique(Grunfeld$fac)) == 200)) stop("wrong factor levels") # 200
if (!(length(unique(plm:::leadr.pseries(Grunfeld$fac))) == 191)) stop("plm:::leadr.pseries: wrong actually uniquely occuring factor values") # 191
if (!(length(unique(plm:::leadr.pseries(Grunfeld$fac))) == 191)) stop("plm:::leadr.pseries: wrong actually uniquely occurring factor values") # 191
if (!(length(levels(plm:::leadr.pseries(Grunfeld$fac))) == 200)) stop("plm:::leadr.pseries: wrong factor levels") # 200


Expand Down
2 changes: 1 addition & 1 deletion inst/tests/test_lagt_leadt.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ lag(Grunfeld$firm2)
# from the sample's unique factor levels, but it should stay in the levels
lag(Grunfeld$fac)
if (!(length(unique(Grunfeld$fac)) == 200)) stop("wrong factor levels") # 200
if (!(length(unique(lag(Grunfeld$fac))) == 191)) stop("wrong actually uniquely occuring factor levels") # 191
if (!(length(unique(lag(Grunfeld$fac))) == 191)) stop("wrong actually uniquely occurring factor levels") # 191
if (!(length(levels(lag(Grunfeld$fac))) == 200)) stop("wrong factor levels") # 200

# lead eliminates e.g., level "200"
Expand Down
2 changes: 1 addition & 1 deletion inst/tests/test_pbgtest.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ g_fe_lm <- lm(inv ~ factor(firm) + value + capital, data = Grunfeld)

# compare plm::pbgtest to lmtest::bgtest
# Hint: for lm::bgtest(), if no order argument is supplied, order=1 is default,
# while plm::pbgtest() assues mininum number of obs over time (typically != 1)
# while plm::pbgtest() assues minimum number of obs over time (typically != 1)

# panelmodel interface
plm::pbgtest(g_pool, order = 1)
Expand Down
2 changes: 1 addition & 1 deletion inst/tests/test_pdata.frame_print_duplicated_rownames.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Currently, duplicated row names are allowed for pdata frames.
# This leads to an error when printing pdata frames with duplicate
# row names, becase print.pdata.frame uses print.data.frame
# row names, because print.pdata.frame uses print.data.frame
#
# This is a testfile to check if the workaround works
library(plm)
Expand Down
4 changes: 2 additions & 2 deletions inst/tests/test_pdata.frame_unused_levels.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if (!isTRUE(all.equal(levels(iind), levels(droplevels(iind))))) stop("unused lev
######## test of dropping unused level in factor (non index variable)
df <- data.frame(id = c(1,1,2), time = c(1,2,1),
f = factor(c("a", "a", "b")),
f2 = factor(c(1,2,3), levels = c(1,2,3,4)), # level 4 is unsed
f2 = factor(c(1,2,3), levels = c(1,2,3,4)), # level 4 is unused
n = c(1:3))
pdf <- pdata.frame(df, drop.unused.levels = TRUE)

Expand All @@ -41,7 +41,7 @@ if (!isTRUE(all.equal(levels(pdf$f2), c("1", "2", "3")))) stop("used levels in n
dfindex <- data.frame(id = c(1,1,2),
time = factor(c(1,2,1), levels = c(1,2,9)), # level 9 is unused
f = factor(c("a", "a", "b")),
f2 = factor(c(1,2,3), levels = c(1,2,3,4)), # level 4 is unsed
f2 = factor(c(1,2,3), levels = c(1,2,3,4)), # level 4 is unused
n = c(1:3))
pdfindex <- pdata.frame(dfindex, drop.unused.levels = FALSE)

Expand Down
4 changes: 2 additions & 2 deletions inst/tests/test_plm.data.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# testfile to check if the deprecated function plm.data() is correctly
# reworked by using pdata.frame()
#
# Usefull especially if future changes to pdata.frame() affect the "plm.dim"
# Useful especially if future changes to pdata.frame() affect the "plm.dim"
# object onces created by plm.data()

library(plm)

# use a data set that has index variables not in first two columns, because
# plm.dim objects always have them in the fist two colums (id, time)
# plm.dim objects always have them in the first two columns (id, time)
data("Hedonic", package = "plm")
pHed <- pdata.frame(Hedonic, index = "townid")
plm:::pos.index(pHed) # gives position of indexes
Expand Down
4 changes: 2 additions & 2 deletions inst/tests/test_plmtest_unbalanced.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# [...]

##### Grunfeld data set - balanced ####
# Table 4.2 [Output from EViews], similiar to above table but with p-values
# Table 4.2 [Output from EViews], similar to above table but with p-values
##### EViews add-in BPTest for some older version of EViews needed:
##### http://www.eviews.com/Addins/addins.shtml#addins
##### http://forums.eviews.com/viewtopic.php?f=23&t=2228
Expand Down Expand Up @@ -280,7 +280,7 @@ p.val_2 <- (1/2)*pchisq(crit_2, df=0, lower.tail = F) + (1/2) * pchisq(crit_2, d
# , data = pnlswork, model = "pooling")
#
#
# # Reassembles Exmaple 1 in http://www.stata.com/manuals14/xtxtregpostestimation.pdf
# # Reassembles Example 1 in http://www.stata.com/manuals14/xtxtregpostestimation.pdf
# # use modified plmtest() as a wrapper
# options(digits = 10)
# plmtest(plm_pool_nlswork, type="bp")
Expand Down
2 changes: 1 addition & 1 deletion inst/tests/test_preserve_rownames.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if(!isTRUE(all.equal(names(residuals(gr)), row.names(Grunfeld)))) stop("or


# make a pdata.frame with "fancy" row.names (default)
# [i.e., combination of individual index an time index]
# [i.e., combination of individual index and time index]
pGrunfeld <- pdata.frame(Grunfeld, index = c("firm", "year"))
row.names(pGrunfeld) # fancy row.names
gr_fancy_rownames <- plm(inv ~ value + capital, data=pGrunfeld, model="pooling")
Expand Down
2 changes: 1 addition & 1 deletion inst/tests/test_vcovG_lin_dep.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ if (!identical(vcovBK(mod_fe_lin_dep), vcovBK(mod_fe_no_lin_dep))) {
vcovBK(cr2)


# just run test for for pgmm models (as vcovXX.pgmm methods use vcovXX.plm)
# just run test for pgmm models (as vcovXX.pgmm methods use vcovXX.plm)
# (no linear dependence involved here)
data("EmplUK", package="plm")
ar <- pgmm(dynformula(log(emp) ~ log(wage) + log(capital) + log(output),
Expand Down

0 comments on commit afc3c16

Please sign in to comment.