# Fix my code in R for a bass diffusion model

Hi,

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:

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)

library(GA)

maxiter=500

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"))

summary(GA3)

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)

salesfit

Total_customer <-cumsum(salesfit)

Total_customer

plot(Total_customer,type="l")

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

Tietoa työnantajasta:
( 2 arvostelua ) Bergneustadt, Germany

Projektin tunnus: #17983331

## 7 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön

sumbali

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 Lisää

\$200 USD 3 päivässä
(137 arvostelua)
6.4
schoudhary1553

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 Lisää

\$250 USD 4 päivässä
(30 arvostelua)
5.8
Yknox

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 Lisää

\$155 USD 3 päivässä
(23 arvostelua)
5.6
Developer000

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 Lisää

\$150 USD 3 päivässä
(14 arvostelua)
4.4
engineeringexp

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

\$31 USD 3 päivässä
(4 arvostelua)
2.7
KashirinA

⭐⭐⭐⭐⭐⭐hello i can finish your project in short time⭐⭐⭐⭐⭐⭐ This is my profile::https://www.freelancer.com/u/bengalTIGER1106 i am new freelancer but my speed is rocket speed so i can help your project beautiful and pe Lisää

\$300 USD 1 päivässä
(0 arvostelua)
0.0
bidroid

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 3 päivässä
(0 arvostelua)
0.0