Description Usage Arguments Details Value See Also Examples
Fit a PIM
1 2 3 4 5 6 7 8 9 10 11 12 | pim(formula, data, link = c("logit", "identity", "probit", "inverse",
"1/mu^2", "log"), blocking.variables = character(), poset = noselfposet,
leftsuffix = "_L", rightsuffix = "_R", interpretation = c("difference",
"regular", "marginal", "symmetric"), na.action = na.fail,
estimator = estimator.nleqslv(),
varianceestimator = varianceestimator.sandwich(), lhs = c("PO", "<",
"<="), keep.data = FALSE, verbosity = 0, nicenames = TRUE,
interactions.difference = (interpretation != "marginal"),
extra.nicenames = data.frame(org = character(), nice = character(),
stringsAsFactors = FALSE), check.symmetric = (interpretation == "regular"),
threshold = 1e-06, weights = NULL,
pseudoweights = pseudoweights.default)
|
formula |
Original formula |
data |
Context where the formula |
link |
Name of the link function (defaults to |
blocking.variables |
Character vector holding column names that hold blocking variables. |
poset |
Matrix of two columns indicating what the original observation number is
for the left and right real observation in the pseudo-observation. Alternatively, can
be a function like |
leftsuffix, rightsuffix |
Suffixes that will be added to the 'left' and 'right' observation's column name in the pseudo-observation. Note: no checking is done that these suffixes are safe, so the wrong suffixes may lead to unexpected behaviour. |
interpretation |
If |
na.action |
Defaults to |
estimator |
Function like the result of |
varianceestimator |
Function like the result of |
lhs |
|
keep.data |
If |
verbosity |
The higher this value, the more levels of progress and debug information is displayed (note: in R for Windows, turn off buffered output) |
nicenames |
Defaults to |
interactions.difference |
If |
extra.nicenames |
Should be a |
check.symmetric |
Defaults to |
threshold |
When checking the symmetry condition, how much digression is allowed. |
weights |
Defaults to |
pseudoweights |
Defaults to |
Some of the items in the return value may be missing if parts of the estimation
fail. See pim.fit for this.
If estimator was estimator.glmnet, The return value gets as an additional class
"glmnetpim".
For more details on how to use this function and its parameters, we refer the reader to
vignette("pim").
An object of class pim,which is a list with items:
coefficients |
Parameter estimates. See |
morefitinfo |
Parameter estimation info. See |
vcov |
Covariance estimates. See |
morevarfitinfo |
Covariance estimation info. See |
varestimationerror |
Only present if covariance estimation failed. See |
call |
Call used when running this function. |
formula |
Passed in formula. |
link |
Name of the link function (defaults to |
fitted.values |
Predicted pseudo-observation values. |
pfd |
Object of class |
data |
Passed in |
estimator.nleqslv varianceestimator.sandwich
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | set.seed(1)
iris$out<-factor(sample(2, nrow(iris), replace=TRUE))
iris$xord<-as.ordered(iris$Species)
pima<-pim(out~Sepal.Length, data=iris, link="logit", interpretation="regular")
pimb<-pim(out~I((R(Sepal.Length) - L(Sepal.Length))/sqrt(R(Sepal.Length) * L(Sepal.Length)) ), data=iris,
link="logit", interpretation="regular", extra.nicenames=data.frame(
org="I((R(Sepal.Length) - L(Sepal.Length))/sqrt(R(Sepal.Length) * L(Sepal.Length)) )",
nice="Sepal.Length.WDiff", stringsAsFactors=FALSE))
pimc<-pim(out~O(xord), data=iris, link="logit", interpretation="regular")
##And an example with weighted fitting
iris50<-iris[sample.int(nrow(iris), 50),]
rwt50<-runif(50) #50 random weights
pimd<-pim(out~O(xord), data=iris50, link="logit", interpretation="regular",
weights = rwt50)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.