# ipOversampling: Plain replication of each observation by inverse-probability... In sambia: A Collection of Techniques Correcting for Sample Selection Bias

## Description

This method corrects for the sample selection bias by the plain replication of each observation in the sample according to its IP weight, i.e. in a stratified random sample one replicates an observation of stratum h by the factor w_h.

## Usage

 `1` ```ipOversampling(data, weights, normalize = FALSE) ```

## Arguments

 `data` a data frame containing the observations rowwise, along with their corresponding categorical strata feature(s). `weights` a numerical vector whose length must coincide with the number of the rows of data. The i-th value contains the inverse-probability e.g. determines how often the i-th observation of data shall be replicated. `normalize` If weight vector should be normalized, i.e. the smallest entry of the vector will be set to 1.

## Details

If the numeric vector contains numbers which are not natural but real, they will be rounded.

## Author(s)

Norbert Krautenbacher, Kevin Strauss, Maximilian Mandl, Christiane Fuchs

## Examples

 ```1 2 3 4 5 6 7 8 9``` ```library(smotefamily) library(sambia) data.example <- sample_generator(100,ratio = 0.80) result <- gsub('n','0',data.example[,'result']) result <- gsub('p','1',result) data.example[,'result'] <- as.numeric(result) weights <- data.example[,'result'] weights <- ifelse(weights==1,1,4) sample <- sambia::ipOversampling(data.example,weights) ```

sambia documentation built on May 2, 2019, 9:15 a.m.
{"ft_lang_label":"__label__en","ft_lang_prob":0.7253814,"math_prob":0.9420078,"size":1459,"snap":"2023-40-2023-50","text_gpt3_token_len":355,"char_repetition_ratio":0.12646048,"word_repetition_ratio":0.0,"special_character_ratio":0.23577793,"punctuation_ratio":0.16727273,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.986565,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-11-28T08:52:59Z\",\"WARC-Record-ID\":\"<urn:uuid:0050e5ce-79db-4cdc-beb4-6bfda5f7ad04>\",\"Content-Length\":\"29351\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:3f942c1d-8022-40a1-b63e-1d9d103f56cd>\",\"WARC-Concurrent-To\":\"<urn:uuid:54f1e2fa-9e1d-403c-9112-edf8e8db0a71>\",\"WARC-IP-Address\":\"51.81.83.12\",\"WARC-Target-URI\":\"https://rdrr.io/cran/sambia/man/ipOversampling.html\",\"WARC-Payload-Digest\":\"sha1:4HGPXLQECIZTTSP4GYNQUB6YD2QZBQCL\",\"WARC-Block-Digest\":\"sha1:LHZDTQAVT3GXKRE64M3J5DDOQ3TO6GMQ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-50/CC-MAIN-2023-50_segments_1700679099281.67_warc_CC-MAIN-20231128083443-20231128113443-00540.warc.gz\"}"}