lm

Regression in R using poly() function

自闭症网瘾萝莉.ら 提交于 2021-02-20 10:11:20
问题 The function poly() in R is used in order to produce orthogonal vectors and can be helpful to interpret coefficient significance. However, I don't see the point of using it for prediction. To my view, the two following model (model_1 and model_2) should produce the same predictions. q=1:11 v=c(3,5,7,9.2,14,20,26,34,50,59,80) model_1=lm(v~poly(q,2)) model_2=lm(v~1+q+q^2) predict(model_1) predict(model_2) But it doesn't. Why? 回答1: Because they are not the same model. Your second one has one

Linear regression on raster images - lm complains about NAs

喜你入骨 提交于 2021-02-18 19:13:46
问题 I'm sure this can be fixed with few bytes, but I've spent hours on this simple thing and can't get out of it. I don't use R often. I have 5 asciigrid files that represent 5 raster images. Some pixels do have values, other do have NAs. For example, the first image might be something like: NA NA NA NA NA NA NA 2 3 NA NA 0.2 0.3 1 NA NA NA 4 NA NA and the second might be: NA NA NA NA NA NA NA 5 1 NA NA 0.1 12 12 NA NA NA 6 NA NA As you can see, NA position is always the same and I'm 100% sure

Linear regression on raster images - lm complains about NAs

喜欢而已 提交于 2021-02-18 19:10:28
问题 I'm sure this can be fixed with few bytes, but I've spent hours on this simple thing and can't get out of it. I don't use R often. I have 5 asciigrid files that represent 5 raster images. Some pixels do have values, other do have NAs. For example, the first image might be something like: NA NA NA NA NA NA NA 2 3 NA NA 0.2 0.3 1 NA NA NA 4 NA NA and the second might be: NA NA NA NA NA NA NA 5 1 NA NA 0.1 12 12 NA NA NA 6 NA NA As you can see, NA position is always the same and I'm 100% sure

What package in R is used to calculate non-zero null hypothesis p-values on linear models?

a 夏天 提交于 2021-02-17 06:17:06
问题 The standard summary(lm(Height~Weight)) will output results for the hypothesis test H0: Beta1=0, but if I am interested in testing the hypothesis H0: B1=1 is there a package that will produce that p-value? I know I can calculate it by hand and I know I can "flip the confidence interval" for a two tailed test (test a 95% hypothesis by seeing if the 95% confint contains the point of interest), but I am looking for an easy way to generate the p-values for a simulation study. 回答1: You can use

What package in R is used to calculate non-zero null hypothesis p-values on linear models?

一笑奈何 提交于 2021-02-17 06:17:05
问题 The standard summary(lm(Height~Weight)) will output results for the hypothesis test H0: Beta1=0, but if I am interested in testing the hypothesis H0: B1=1 is there a package that will produce that p-value? I know I can calculate it by hand and I know I can "flip the confidence interval" for a two tailed test (test a 95% hypothesis by seeing if the 95% confint contains the point of interest), but I am looking for an easy way to generate the p-values for a simulation study. 回答1: You can use

How to draw a barplot split by variable levels, while controlling for other variables via multiple regression?

家住魔仙堡 提交于 2021-02-11 12:58:24
问题 How can I draw a barplot for means, while controlling for other variables through regression -- in a split-bars-by-vars fashion? My general problem I conduct a research to figure out which fruit is more likable: mango, banana, or apple. To this end, I go ahead and sample 100 people at random. I ask them to rate, on a scale of 1-5, the degree of liking each of the fruits. I also collect some demographic information about them: gender, age, education level, and whether they are colorblind or

How to draw a barplot split by variable levels, while controlling for other variables via multiple regression?

送分小仙女□ 提交于 2021-02-11 12:57:08
问题 How can I draw a barplot for means, while controlling for other variables through regression -- in a split-bars-by-vars fashion? My general problem I conduct a research to figure out which fruit is more likable: mango, banana, or apple. To this end, I go ahead and sample 100 people at random. I ask them to rate, on a scale of 1-5, the degree of liking each of the fruits. I also collect some demographic information about them: gender, age, education level, and whether they are colorblind or

How to draw a barplot split by variable levels, while controlling for other variables via multiple regression?

北慕城南 提交于 2021-02-11 12:57:00
问题 How can I draw a barplot for means, while controlling for other variables through regression -- in a split-bars-by-vars fashion? My general problem I conduct a research to figure out which fruit is more likable: mango, banana, or apple. To this end, I go ahead and sample 100 people at random. I ask them to rate, on a scale of 1-5, the degree of liking each of the fruits. I also collect some demographic information about them: gender, age, education level, and whether they are colorblind or

plotting a fitted segmented linear model shows more break points than what is estimated

不问归期 提交于 2021-02-10 18:53:51
问题 I was helping a friend with segmented regressions today. We were trying to fit a piecewise regression with a breakpoints to see if it fits data better than a standard linear model. I stumbled across a problem I cannot understand. When fitting a piecewise regression with a single breakpoint with the data provided, it does indeed fit a single breakpoint. However, when you predict from the model it gives what looks like 2 breakpoints. When plotting the model using plot.segmented() this problem

plotting a fitted segmented linear model shows more break points than what is estimated

有些话、适合烂在心里 提交于 2021-02-10 18:51:20
问题 I was helping a friend with segmented regressions today. We were trying to fit a piecewise regression with a breakpoints to see if it fits data better than a standard linear model. I stumbled across a problem I cannot understand. When fitting a piecewise regression with a single breakpoint with the data provided, it does indeed fit a single breakpoint. However, when you predict from the model it gives what looks like 2 breakpoints. When plotting the model using plot.segmented() this problem