Coder Social home page Coder Social logo

Comments (4)

harrelfe avatar harrelfe commented on August 17, 2024 1

Run y ~ Year then y ~ scored(Year) which will give you a test of association that is the same as using factor() as well as something you don't get - a test of linearity against all alternatives to linearity (factor). Hear Year is numeric interval-scaled when stored in the data frame/data table.

from rms.

harrelfe avatar harrelfe commented on August 17, 2024

To open an issue without providing the code you wrote that caused the error is not a good way to report problems.

I am fairly certain that you used factor( ) or as.factor( ) inside the model formula. It was the design of rms that this never worked. It only worked by accident before. Now it is explicitly disallowed. You need to define the type of variable it is in the data frame or data table.

To go to the trouble of downgrading to older versions is quite a waste of time when the solution is extremely easy.

from rms.

MarcoPortmann avatar MarcoPortmann commented on August 17, 2024

My apologies, I assumed it should be clear that the complete code would look like that:
lrm(y~x1+factor(x2), data=mydata)
where x2 could be any type of variable. Yes, it took me quite some time to downgrade but I really assumed that this must be a bug in the latest version of either Hmisc or rms. I’ve been using this notation extensively in many of my R scripts for years without any issues and it still seems to work in other functions like lm(). If it’s not a bug then I can close this issue.
I always found it extremely handy to use this notation as it allows to quickly adapt a regression from something like
lrm(y~x1+Year, data=mydata)
to
lrm(y~x1+factor(Year), data=mydata)
where Year enters as numeric variable in the first case while the second version estimates the model with year fixed effects. May I kindly ask how I can achieve the same without using factor() in the formula and without defining the variable as a factor in the data frame?

from rms.

MarcoPortmann avatar MarcoPortmann commented on August 17, 2024

Thank you very much for answer. With scored I get even more information and I can adapt my scripts with search+replace.

from rms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.