Fitting power fnction

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Fitting power fnction

Kornbrot, Diana
Fitting power fnction Want to fit following function in spss:
Y = a(X-b)^n
Where Y and X are variables  and a, b, n are parameters to be estimated
Can any one direct me to script to create such a function, hopefully with goodness of fit of model
All help gratefully received
Best

Diana


Emeritus Professor Diana Kornbrot
email:  d.e.kornbrot@...    
web:    http://dianakornbrot.wordpress.com/
Work
Department of Psychology
School of Life and Medical Sciences
 University of Hertfordshire
 College Lane, Hatfield, Hertfordshire AL10 9AB, UK
   voice:   +44 (0) 170 728 4626
   fax:     +44 (0) 170 728 5073
Home
 
19 Elmhurst Avenue
 London N2 0LT, UK
    voice:   +44 (0) 208  444 2081
    mobile: +44 (0) 740 318 1612
    fax:      +44 (0) 870 706 1445





Reply | Threaded
Open this post in threaded view
|

Re: Fitting power fnction

David Marso
Administrator
NLR, CNLR, maybe Curvefit?
--
Kornbrot, Diana wrote
Want to fit following function in spss:
Y = a(X-b)^n
Where Y and X are variables  and a, b, n are parameters to be estimated
Can any one direct me to script to create such a function, hopefully with goodness of fit of model
All help gratefully received
Best

Diana

________________________________
Emeritus Professor Diana Kornbrot
email:  [hidden email]
web:    http://dianakornbrot.wordpress.com/
Work
Department of Psychology
School of Life and Medical Sciences
 University of Hertfordshire
 College Lane, Hatfield, Hertfordshire AL10 9AB, UK
   voice:   +44 (0) 170 728 4626
   fax:     +44 (0) 170 728 5073
Home
 19 Elmhurst Avenue
 London N2 0LT, UK
    voice:   +44 (0) 208  444 2081
    mobile: +44 (0) 740 318 1612
    fax:      +44 (0) 870 706 1445
________________________________
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Fitting power function

Jon K Peck
In reply to this post by Kornbrot, Diana
You can do this with NLR.  Here's an example.
MODEL PROGRAM  a=1000 b=50 n=2.
COMPUTE  PRED_=a*(abs(jobtime-b))**n.
NLR salary  /OUTFILE='D:\spsstemp3\spss3072\SPSSFNLR.TMP'.

But note that I inserted an absolute value function in order to deal with the issue of fractional n with a negative number.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        "Kornbrot, Diana" <[hidden email]>
To:        [hidden email],
Date:        10/12/2012 12:35 PM
Subject:        [SPSSX-L] Fitting power fnction
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Want to fit following function in spss:
Y = a(X-b)^n
Where Y and X are variables  and a, b, n are parameters to be estimated
Can any one direct me to script to create such a function, hopefully with goodness of fit of model
All help gratefully received
Best

Diana



Emeritus Professor Diana Kornbrot
email: 
d.e.kornbrot@...    
web:    
http://dianakornbrot.wordpress.com/
Work

Department of Psychology
School of Life and Medical Sciences
University of Hertfordshire
College Lane, Hatfield, Hertfordshire AL10 9AB, UK
  voice:   +44 (0) 170 728 4626
  fax:     +44 (0) 170 728 5073
Home
19 Elmhurst Avenue
London N2 0LT, UK
   voice:   +44 (0) 208  444 2081
   mobile: +44 (0) 740 318 1612
   fax:      +44 (0) 870 706 1445






Reply | Threaded
Open this post in threaded view
|

Re: Fitting power function

Kornbrot, Diana
Re: [SPSSX-L] Fitting power function Many thanks to Jon Peck and David Marso
Of course, Non Linear Regression [NLR]:  regression > non-linear works absolutely fine, even using dialogue boxes
Parameters are straightforward to defin, with starting points. There are warnings where iterations include neg numbers to fractional powers, but converges fine.
Same solution as R, which is a relief
Was being really stupid & apologize for bothering exellent spss list
Best
Diana


On 12/10/2012 19:53, "Jon K Peck" <peck@...> wrote:

You can do this with NLR.  Here's an example.
MODEL PROGRAM  a=1000 b=50 n=2.
COMPUTE  PRED_=a*(abs(jobtime-b))**n.
NLR salary  /OUTFILE='D:\spsstemp3\spss3072\SPSSFNLR.TMP'.

But note that I inserted an absolute value function in order to deal with the issue of fractional n with a negative number.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
peck@...
new phone: 720-342-5621




From:       "Kornbrot, Diana" <d.e.kornbrot@...>
To:       SPSSX-L@...,
Date:       10/12/2012 12:35 PM

Subject:       [SPSSX-L] Fitting power fnction
Sent by:       "SPSSX(r) Discussion" <SPSSX-L@...>




Want to fit following function in spss:
Y = a(X-b)^n
Where Y and X are variables  and a, b, n are parameters to be estimated
Can any one direct me to script to create such a function, hopefully with goodness of fit of model
All help gratefully received
Best

Diana


Emeritus Professor Diana Kornbrot
email:  d.e.kornbrot@... <d.e.kornbrot@...>    
web:    http://dianakornbrot.wordpress.com/ <http://dianakornbrot.wordpress.com/>
Work
Department of Psychology
School of Life and Medical Sciences
 University of Hertfordshire
 College Lane, Hatfield, Hertfordshire AL10 9AB, UK
   voice:   +44 (0) 170 728 4626
   fax:     +44 (0) 170 728 5073
Home
 
19 Elmhurst Avenue
 London N2 0LT, UK
    voice:   +44 (0) 208  444 2081
    mobile: +44 (0) 740 318 1612
    fax:      +44 (0) 870 706 1445









Emeritus Professor Diana Kornbrot
email:  d.e.kornbrot@...    
web:    http://dianakornbrot.wordpress.com/
Work
Department of Psychology
School of Life and Medical Sciences
 University of Hertfordshire
 College Lane, Hatfield, Hertfordshire AL10 9AB, UK
   voice:   +44 (0) 170 728 4626
   fax:     +44 (0) 170 728 5073
Home
 
19 Elmhurst Avenue
 London N2 0LT, UK
    voice:   +44 (0) 208  444 2081
    mobile: +44 (0) 740 318 1612
    fax:      +44 (0) 870 706 1445