+ Reply to Thread
Results 1 to 4 of 4

Thread: How to create a Double Log model?

  1. #1
    Points: 310, Level: 6
    Level completed: 20%, Points required for next Level: 40

    Posts
    17
    Thanks
    9
    Thanked 0 Times in 0 Posts

    How to create a Double Log model?



    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:
    Code: 
    model <-lm("dependent variable"~X1+X2+X3+X4,data="name of my data set")
    Now, I have to make a double-log model using the same variables, and compare it to the linear model.

    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

  2. #2
    Cookie Scientist
    Points: 5,905, Level: 49
    Level completed: 78%, Points required for next Level: 45
    Jake's Avatar
    Location
    Boulder, CO
    Posts
    793
    Thanks
    17
    Thanked 313 Times in 239 Posts

    Re: How to create a Double Log model?

    Quote Originally Posted by Walowizard View Post
    My problem is that I keep failing in making the double-log model using R.
    What did you try exactly?
    “In God we trust. All others must bring data.”
    ~W. Edwards Deming

  3. #3
    Points: 310, Level: 6
    Level completed: 20%, Points required for next Level: 40

    Posts
    17
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Re: How to create a Double Log model?

    Quote Originally Posted by Jake View Post
    What did you try exactly?
    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
    Code: 
    logm1<-lm(log(testscr)~log(str)+log(el_pct),data=school)
    (ignore the names of those variables if they don't help

  4. #4
    Cookie Scientist
    Points: 5,905, Level: 49
    Level completed: 78%, Points required for next Level: 45
    Jake's Avatar
    Location
    Boulder, CO
    Posts
    793
    Thanks
    17
    Thanked 313 Times in 239 Posts

    Re: How to create a Double Log model?


    Try this:
    Code: 
    logm1<-lm(I(log(testscr))~I(log(str))+I(log(el_pct)),data=school)
    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.
    “In God we trust. All others must bring data.”
    ~W. Edwards Deming

  5. The Following User Says Thank You to Jake For This Useful Post:

    trinker (10-29-2012)

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats