tboot_bmr

0th

Percentile

Function tboot_bmr

Bootstrap nrow rows of dataset using the given row-level weights.

Usage
tboot_bmr(nrow, weights_bmr, tol_rel_sd = 0.01)
Arguments
nrow

number of rows in the new bootstrapped dataset.

weights_bmr

an object of class 'tweights' output from the 'tweights' function.

tol_rel_sd

An error will be called if for some simulation if the target is not achievable with the data. However, the error will only be called if max absolute difference releative to the marginal standard is greater than specified.

Details

Simulates a dataset by first simulating from the posterior distribution of the column means and then simulating a dataset with that underlying mean. Details a further documented in the vignette.

Value

A simulated dataset with 'nrow' rows. The underlying 'true' posterior parameter value is an attribute which can be extracted useing attr(ret, "post_bmr") where 'ret' is the matrix.

See Also

tweights

Aliases
  • tboot_bmr
Examples
# NOT RUN {
#Use winsorized marginal to keep marginal simulation within feasible bootstrap region
winsor=function(marginalSims,y)  {
  l=min(y)
  u=max(y)
  ifelse(marginalSims<l,l,ifelse(marginalSims>u,u, marginalSims))
}
#Create an example marginal posterior
marginal = list(Sepal.Length=winsor(rnorm(10000,mean=5.8, sd=.2),iris$Sepal.Length),
               Sepal.Width=winsor(rnorm(10000,mean=3,sd=.2), iris$Sepal.Width),
               Petal.Length=winsor(rnorm(10000,mean=3.7,sd=.2), iris$Petal.Length)
)

#simulate
w = tweights_bmr(dataset = iris, marginal = marginal, silent = TRUE)
sample_data = tboot_bmr(1000, weights = w)

# }
Documentation reproduced from package tboot, version 0.2.0, License: GPL-3

Community examples

Looks like there are no examples yet.