Basic NLS Help Needed
Posted: Tue Jul 05, 2011 3:06 pm
Hi,
I am new to eviews and I am trying to run a nonlinear least squares estimation.
I am having trouble programming it and some advice/help would be really great.
The data came from a survey.
I have 28 questions for each participant and i number of of participants.
Each participant is represented by a separate series right now in the workfile.
My equation is:
( p1^c(1) / (p1^(c(1)) - (1-p1)^c(1)) ^ (1/c(1)) ) * z1 ^ c(2) + (1 - ( p1^c(1) / (p1^(c(1)) - (1-p1)^c(1)) ^ (1/c(1)) ) * z2 ^c(2) = series{!i} ^ c(2)
Where p1, z1, z2 are each a series with 28 rows.
series{!i} is a series for each participant from i = 1 to 100 and each particpant and has 28 rows.
I need to estimate c(1) and c(2) in this equation.
When I try to do this I get an error that ^ function given out of range argument.
Any help/advice would be greatly appreciated. I am feeling pretty lost right now,
Thanks,
Jen
I am new to eviews and I am trying to run a nonlinear least squares estimation.
I am having trouble programming it and some advice/help would be really great.
The data came from a survey.
I have 28 questions for each participant and i number of of participants.
Each participant is represented by a separate series right now in the workfile.
My equation is:
( p1^c(1) / (p1^(c(1)) - (1-p1)^c(1)) ^ (1/c(1)) ) * z1 ^ c(2) + (1 - ( p1^c(1) / (p1^(c(1)) - (1-p1)^c(1)) ^ (1/c(1)) ) * z2 ^c(2) = series{!i} ^ c(2)
Where p1, z1, z2 are each a series with 28 rows.
series{!i} is a series for each participant from i = 1 to 100 and each particpant and has 28 rows.
I need to estimate c(1) and c(2) in this equation.
When I try to do this I get an error that ^ function given out of range argument.
Code: Select all
' Create a group of the series of subjects
group tempGroup
for !i = 1 to 100
if !i <10 then
tempGroup.add series0{!i}
else
tempGroup.add series{!i}
endif
next
'use a starting value of 1 for coefficient 1 and coeffecient 2
'note: I have attempted this with and without a starting value
param c(1) 1 c(2) 1
system sys1
for !i = 1 to 100
sys1.append (nn_p1^c(1)) / (nn_p1^c(1) + (1- nn_p1)^c(1)) ^ (1/c(1)) * nn_z1^c(2)+ (1- (nn_p1^c(1)) / (nn_p1^c(1) + (1- nn_p1)^c(1)) ^ (1/c(1))) * nn_z2^c(2) = tempGroup(!i)^c(2)
next
sys1.ls
Thanks,
Jen