Fix my code in R for a bass diffusion model


I would like someone to have a look over my code and fix it, so that I can calculate the correct parameters m, q, and p based on my real-life sales data. Here is the code:

[login to view URL] <-c(0.376000,0.937000,4.416000,22.497000,39.409000,51.630000,54.828000,54.132000,50.315000,42.628000,35.165000,26.379000,14.377000)

Sales <- diff([login to view URL])

sales <- [login to view URL][-1]

sales2 <- sales*sales

l <- length(Sales) #

T <- 1:l # T = [1,2,3,4,5,6,7,8,9,10,11,12,13]

# Bass GA

bassf <- function(x,theta) theta[1] * ( ((theta[2]+theta[3])^2 / theta[2]) * exp(-(theta[2]+theta[3]) * T) ) /(1+(theta[3]/theta[2])*exp(-(theta[2]+theta[3])*x))^2 # f(t)

fitnessL <- function(theta,x,y) -sum((y-bassf(x,theta))^2)



GA3 <- ga(type="real-valued",fitness=fitnessL,x=T,y=Sales,lower=c(0,0,0),upper=c(9999999999,1,1),popSize=500,crossover=gareal_blxCrossover,maxiter=500,run=200,names=c("m","p","q"))


bassf <- function(x,theta) theta[1] * ( ((theta[2]+theta[3])^2 / theta[2]) * exp(-(theta[2]+theta[3])* x) ) /(1+(theta[3]/theta[2])*exp(-(theta[2]+theta[3])*x))^2

theta <- GA3@solution

salesfit <- bassf(0:15,theta)


Total_customer <-cumsum(salesfit)



When running the code in R, I always get a value for M that is not possible based on the assumptions of the bass model. In the end I also want to plot the bass model function and show the development from year 2002 (start date of the sales data) to the end of the sales data 2014 and forecast until 2020.

The data is in pcs sold millions.

Please dont hesitate if you have further questions

Skills: Coding, Mathematics, Programming, Statistical Analysis, Statistics

See more: bass diffusion model parameter estimation, bass model parameters database, fitting bass model in r, bass diffusion model excel, generalized bass model software, bass diffusion model calculator, bass model r, bass diffusion model tutorial, help fix code, hire someone fix code, html background image width fix code, fix code service, fix code ie7 css, quick fix code inject attack website, fix code injection website, javascript fix code, flash fix code, joomla sql injection fix code, sql injection php fix code, joomla javascript fix code

About the Employer:
( 2 reviews ) Bergneustadt, Germany

Project ID: #17983331

8 freelancers are bidding on average $168 for this job


I'm an Engineer in Statistics and Applied Economics, i've got many skills and expertise that will allow me achieving perfectly all the projects and assignments because my priority is your satisfaction I am a master of More

$200 USD in 3 days
(135 Reviews)

This is Vibrant Webtech and I was glad to see that you're looking for help for project Fix my code in R for a bass diffusion model. I've delivered more than 400 + projects in the last 5 years and this makes me very c More

$250 USD in 4 days
(28 Reviews)

Dear employer. I am Jin.S, developer . I've just read your job post and I'm very interested. I'm a certificated freelancer with almost 1100 good reviews from clients. I m quite experienced in Mathematics, Programm More

$155 USD in 3 days
(23 Reviews)

Feel fee to contact me for Fix my code in R for a bass diffusion [login to view URL] me message to discuss further more details .We provide the commments,images,videos,demos and live sessions in order to help the clients.M More

$150 USD in 3 days
(14 Reviews)

I am an expert in R programming check my reviews award me and I will do my best........................................................................................................................................... More

$31 USD in 3 days
(3 Reviews)

My services are available for you always..

$55 USD in 1 day
(1 Review)

⭐⭐⭐⭐⭐⭐hello i can finish your project in short time⭐⭐⭐⭐⭐⭐ This is my profile:: i am new freelancer but my speed is rocket speed so i can help your project beautiful and pe More

$300 USD in 1 day
(0 Reviews)

How are you? I am very interested in your project. I have developed programs with R in 3 years and have many experiences. Please feel free to contact me. Thank you.

$200 USD in 3 days
(0 Reviews)