Skip to main content
deleted 1 characters in body
Source Link
Nick Cox
  • 62.1k
  • 8
  • 145
  • 231

Is least squares the standard method to fit a 3 parameters gaussianGaussian function to some x and y data?

A participant in one experiment needs to decide whether a flash and a sound are simultaneous or not for many possible asynchronies between the flash and the sound (x in seconds). For each asynchrony, the flash and sound are presented 100 times. In the below graph the proportion of 'simultaneous' responses (y) areis plotted as a function of the asynchrony enter image description here

I want to fit a 3-parameter gaussianGaussian distribution to these data. I used least squares (below). My question is whether least squares is the most standard/orthodox form to proceed for this kind of fitting. It makes sense to use maximum likelihood estimation here? How can be done?

 x<-seq(-.3,.3,.1) yes<-c(10,45,90,100,60,10,5) #simultaneous responses y<-yes/100 leastSquares<-function(p) sum((y-p[1]*dnorm(x,p[2],p[3]))^2) p<-optim(c(.001,0.1,.210),leastSquares)$par xseq<-seq(-.3,.3,.01) yseq<-p[1]*dnorm(xseq,p[2],p[3]) plot(x,y) lines(xseq,yseq) 

Is least squares the standard method to fit a 3 parameters gaussian function to some x and y data?

A participant in one experiment needs to decide whether a flash and a sound are simultaneous or not for many possible asynchronies between the flash and the sound (x in seconds). For each asynchrony, the flash and sound are presented 100 times. In the below graph the proportion of 'simultaneous' responses (y) are plotted as a function of the asynchrony enter image description here

I want to fit a 3-parameter gaussian distribution to these data. I used least squares (below). My question is whether least squares is the most standard/orthodox form to proceed for this kind of fitting. It makes sense to use maximum likelihood estimation here? How can be done?

 x<-seq(-.3,.3,.1) yes<-c(10,45,90,100,60,10,5) #simultaneous responses y<-yes/100 leastSquares<-function(p) sum((y-p[1]*dnorm(x,p[2],p[3]))^2) p<-optim(c(.001,0.1,.210),leastSquares)$par xseq<-seq(-.3,.3,.01) yseq<-p[1]*dnorm(xseq,p[2],p[3]) plot(x,y) lines(xseq,yseq) 

Is least squares the standard method to fit a 3 parameters Gaussian function to some x and y data?

A participant in one experiment needs to decide whether a flash and a sound are simultaneous or not for many possible asynchronies between the flash and the sound (x in seconds). For each asynchrony, the flash and sound are presented 100 times. In the below graph the proportion of 'simultaneous' responses (y) is plotted as a function of the asynchrony enter image description here

I want to fit a 3-parameter Gaussian distribution to these data. I used least squares (below). My question is whether least squares is the most standard/orthodox form to proceed for this kind of fitting. It makes sense to use maximum likelihood estimation here? How can be done?

 x<-seq(-.3,.3,.1) yes<-c(10,45,90,100,60,10,5) #simultaneous responses y<-yes/100 leastSquares<-function(p) sum((y-p[1]*dnorm(x,p[2],p[3]))^2) p<-optim(c(.001,0.1,.210),leastSquares)$par xseq<-seq(-.3,.3,.01) yseq<-p[1]*dnorm(xseq,p[2],p[3]) plot(x,y) lines(xseq,yseq) 
Source Link

Is least squares the standard method to fit a 3 parameters gaussian function to some x and y data?

A participant in one experiment needs to decide whether a flash and a sound are simultaneous or not for many possible asynchronies between the flash and the sound (x in seconds). For each asynchrony, the flash and sound are presented 100 times. In the below graph the proportion of 'simultaneous' responses (y) are plotted as a function of the asynchrony enter image description here

I want to fit a 3-parameter gaussian distribution to these data. I used least squares (below). My question is whether least squares is the most standard/orthodox form to proceed for this kind of fitting. It makes sense to use maximum likelihood estimation here? How can be done?

 x<-seq(-.3,.3,.1) yes<-c(10,45,90,100,60,10,5) #simultaneous responses y<-yes/100 leastSquares<-function(p) sum((y-p[1]*dnorm(x,p[2],p[3]))^2) p<-optim(c(.001,0.1,.210),leastSquares)$par xseq<-seq(-.3,.3,.01) yseq<-p[1]*dnorm(xseq,p[2],p[3]) plot(x,y) lines(xseq,yseq)