View source: R/fit_net_logit.R
hypothesis_func | R Documentation |
Function to set penalties according to hypotheses
hypothesis_func(coefs, expectation = -1, phi_hyp = 1)
coefs |
Vector of estimated coefficients through a Ridge regression. |
expectation |
Expected/Hypothetical signal of the coefficient for a
given covariate. Should take value |
phi_hyp |
Additional penalty constant for the hypothesis-based penalties. A value in the interval 1, Inf where 1 is no additional penalty and higher values correspond to higher penalties when |
# set coefficients
coefs <- c(-1, -0.5, -0.1, 0.8, 0.3, -0.1)
expected_sign <- -1
hypothesis_func(coefs)
x <- seq(-2, 2, length.out = 101)
plot(x, exp(x), ylab = "Penalty", xlab = "Coefficient")
plot(x, hypothesis_func(x), ylab = "Penalty", xlab = "Coefficient")
plot(x, hypothesis_func(x, phi_hyp = 50), ylab = "Penalty", xlab = "Coefficient")
plot(x, exp(x)*hypothesis_func(x, phi_hyp = 10), ylab = "Penalty", xlab = "Coefficient")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.