Hello friends,
I am having some problems trying to create a double-log model using R.
I have a set of explanatory/independent variables, and I have already made a linear model using those variables. (by using:Now, I have to make a double-log model using the same variables, and compare it to the linear model.Code:model <-lm("dependent variable"~X1+X2+X3+X4,data="name of my data set")
My problem is that I keep failing in making the double-log model using R. I have even had trouble trying to find tutorials online.
If anyone has some knowledge in this department, it would be great.
Thanks
Well I was searching online, and found this website that showed a way of doing double log models. http://stackoverflow.com/questions/6...garithmic-data
Anyways, I tried(ignore the names of those variables if they don't helpCode:logm1<-lm(log(testscr)~log(str)+log(el_pct),data=school)
Try this:As you can see all I did is wrap each log in a call to the I() function. You can see ?I for a full description of what this does but basically it says to evaluate the mathematical expression as it appears rather than attempting to interpret the logs as part of the formula object.Code:logm1<-lm(I(log(testscr))~I(log(str))+I(log(el_pct)),data=school)
In God we trust. All others must bring data.
~W. Edwards Deming
trinker (10-29-2012)
|
|