Description Usage Arguments Examples
This function allows to calculate satistical adjustment weight given some margins (equalities or inequalities).
1 2 | adjustment(data, weight = NULL, margins = list(), weight_min = 0.1,
weight_max = 10, ...)
|
data |
a data frame. |
weight |
a nonnegative numeric vector (with positive sum) of length |
margins |
a list specifing the margins constrains. |
weight_min |
a numeric constant greater or equal to 1. |
weight_max |
a nonnegative numeric constant. |
1 2 3 4 5 6 7 8 9 10 11 12 13 | data <- iris
summary(data)
margins <- list(list(var_name = 'Species',value=c(setosa=0.315),
min=c(versicolor=0.45),
max=c(versicolor=0.01)))
w <- adjustment(data = data,margins = margins)$w
data$w<-w
library(dplyr)
data%>%
group_by(Species)%>%
summarise(eff=sum(w))%>%
merge(data%>%summarise(eff0=sum(w)))%>%
mutate(freq = eff/eff0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.