Reputation: 4229
This is going into statistics, however quite few question has been answered here on SO. If there will be objections I will remove this question asap.
I would like to re-scale logit values so that the output values are scaled so that the min value is 0 or close to 0 and max value close to 1.
Here is sample data
logit <- rlogis(100, location = 1, scale = 5)
y <- sort((1/(1+exp(-logit))))[40:(length(logit)-50)] # here removing the close to 0 and 1 to replicate the problem.
x <- 1:length(y)
data <- data.frame(y,x)
with(data, plot(y~x))
So would someone point me to r package
or show otherwise how to approach this and re-scale these values? Thanks.
Upvotes: 2
Views: 327
Reputation: 226662
You just want the min and max values to have large absolute values.
out_range <- c(-10,10)
L_sc1 <- (logit-min(logit))/diff(range(logit)) # rescale to [0,1]
L_sc2 <- out_range[1]+diff(out_range)*L_sc1 # rescale to (min,max)
Plot results:
plot(sort(plogis(L_sc2)))
Upvotes: 2