lm
Using column numbers not names in lm()
Instead of something like lm(bp~height+age, data=mydata) I would like 开发者_运维技巧to specify the columns by number, not name.[详细]
2023-04-12 07:40 分类:问答Determining the goodness of an R fit using lm()
I learned to get a linear fit with some points using lm in my R script. So, I did that (which worked nice), and printed out the fit:[详细]
2023-03-28 22:16 分类:问答Extract regression coefficient values
I have a regression model for some time series data investigating drug utilisation. The purpose is to fit a spline to a time series and work out 95% CI etc. The model goes as 开发者_如何学运维follows:[详细]
2023-03-17 01:43 分类:问答How to succinctly write a formula with many variables from a data frame?
Suppose I have a response variable and a data containing three covariates (as a toy example): y = c(1,4,6)[详细]
2023-02-16 08:01 分类:问答multivariate regression
I have two dependents that both depent on two variables AND on each other, can this be modelled in R (must be!) but I can\'t figure out how, anyone a hint?[详细]
2023-01-31 17:13 分类:问答predict.lm() with an unknown factor level in test data
I am fitting a model to factor data and predicting. If the newdata in predict.lm() contains a single factor level that is unknown to the model, all of predict.lm() fails and returns an error.[详细]
2023-01-27 06:18 分类:问答Drop lines from actual to modeled points in R
Yesterday I worked up an example of the difference between Ordinary Least Squares (OLS) vs. Principal Components Analysis (PCA). For that illustration I wanted to show the errors minimized by OLS and[详细]
2023-01-16 19:49 分类:问答modify lm or loess function to use it within ggplot2's geom_smooth
I need to modify the lm (or eventually loess) function so I can use it in ggplot2\'s geom_smooth (or stat_smooth).[详细]
2022-12-21 23:17 分类:问答Constrained least squares
I am fitting a simple regression in R on gas usage per capita. The regression formulas looks like: gas_b <- lm(log(gasq_pop) ~ log(gasp) + log(pcincome) + log(pn) +[详细]
2022-12-08 01:52 分类:问答How can I portray my lm() model across different ggplot scatterplot differently?
I am currently regressing GDP on multiple factors (7 different variables to be exact), My x variable is quarterly Dates (2006-Q1 to 2020-Q4). I need need to plot my scatter plot for the GDP with Date[详细]
2022-12-07 19:51 分类:问答