Quantcast
Channel: Active questions tagged lm - Stack Overflow
Viewing all articles
Browse latest Browse all 124

What is a good starting model for fitting a rotated sigmoidal curve? [migrated]

$
0
0

I'm trying to make a model to fit a rotated sigmoidal curve in R but don't know where to start when looking for an appropriate equation for the model.

Some example data and the type of fit I'm getting at the moment are shown below:

library(tidyverse)#example datadf <- data.frame(x = c(50,54,56,55,58,64,91,148,345,722,1641,4320,4931,5224), y = c(1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192))# 4th order polynomial fittingmodel1 <- lm(y ~ poly(x,4, raw = TRUE), data = df)# inverse log non-linear model?model2 <- nls(y ~ I(1 / x * a) + b * x, data = df, start = list(a = 1, b = 1))# make some evenly spaced points for x and fit modelsmodel_df <- data.frame(logx = seq(1.7, 3.7, by=0.01)) %>% mutate(x = 10^logx)model_df$fit1 <- predict(model1, model_df)  model_df$fit2 <- predict(model2, model_df)  # plot on log axesggplot(df) +    aes(x = x, y = y) +    geom_point(size = 4) +    geom_point(data = model_df, aes(x = x, y = fit1), colour = "red", size = 1) +    geom_point(data = model_df, aes(x = x, y = fit2), colour = "blue", size = 1) +    scale_x_log10() +    scale_y_log10() 

Models to fit experimental data points, model1 red, model2, blue

Does anyone know any suitable way to fit a curve like this?


Viewing all articles
Browse latest Browse all 124

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>