predict

plotting GLMM estimate line with categorical and interaction variables

旧巷老猫 提交于 2020-01-12 10:45:30
问题 I am working in R with a GLMM with a mixture of continuous and categorical variables with some interactions. I have used the dredge and model.avg functions in MuMIn to obtain effect estimates for each variable. My problem is in how best to plot the results. I want to make a figure showing the effect of one variable (forest) on my data where the trendline reflects the forest parameter estimate, but I can't figure out how to hold the categorical variables and interaction variables at their

warning when calculating predicted values

懵懂的女人 提交于 2020-01-11 02:27:08
问题 working with a data frame x Date Val 1/1/2012 7 2/1/2012 9 3/1/2012 20 4/1/2012 24 5/1/2012 50 a <- seq(as.Date(tail(x, 1)$Date), by="month", length=5) a <- data.frame(a) x.lm <- lm(x$Val ~ x$Date) x.pre<-predict(x.lm, newdata=a) I am getting this erro: Warning message: 'newdata' had 5 rows but variable(s) found have 29 rows what am I doing wrong? here is the dput output: dput(x) structure(list(Date = structure(c(14610, 14641, 14669, 14700, 14730, 14761, 14791, 14822, 14853, 14883, 14914,

R predict() function returning wrong/too many values

烂漫一生 提交于 2020-01-10 19:47:44
问题 I am trying to convert Absorbance (Abs) values to Concentration (ng/mL), based on an established linear model & standard curve. I planned to do this by using the predict() function. I am having trouble getting predict() to return the desired results. Here is a sample of my code: Standards<-data.frame(ng_mL=c(0,0.4,1,4), Abs550nm=c(1.7535,1.5896,1.4285,0.9362)) LM.2<-lm(log(Standards[['Abs550nm']])~Standards[['ng_mL']]) Abs<-c(1.7812,1.7309,1.3537,1.6757,1.7409,1.7875,1.7533,1.8169,1.753,1

R predict() function returning wrong/too many values

不羁的心 提交于 2020-01-10 19:47:09
问题 I am trying to convert Absorbance (Abs) values to Concentration (ng/mL), based on an established linear model & standard curve. I planned to do this by using the predict() function. I am having trouble getting predict() to return the desired results. Here is a sample of my code: Standards<-data.frame(ng_mL=c(0,0.4,1,4), Abs550nm=c(1.7535,1.5896,1.4285,0.9362)) LM.2<-lm(log(Standards[['Abs550nm']])~Standards[['ng_mL']]) Abs<-c(1.7812,1.7309,1.3537,1.6757,1.7409,1.7875,1.7533,1.8169,1.753,1

The Effect of Specifying Training Data as New Data when Making Random Forest Predictions in R

岁酱吖の 提交于 2020-01-07 01:31:10
问题 While using the predict function in R to get the predictions from a Random Forest model, I misspecified the training data as newdata as follows: RF1pred <- predict(RF1, newdata=TrainS1, type = "class") Used like this, I get extremely high accuracy and AUC, which I am sure is not right, but I couldn't find a good explanation for it. This thread is the closest I got, but I can's say I fully understand the explanation there. If someone could elaborate, I will be grateful. Thank you! EDIT:

The Effect of Specifying Training Data as New Data when Making Random Forest Predictions in R

不问归期 提交于 2020-01-07 01:31:01
问题 While using the predict function in R to get the predictions from a Random Forest model, I misspecified the training data as newdata as follows: RF1pred <- predict(RF1, newdata=TrainS1, type = "class") Used like this, I get extremely high accuracy and AUC, which I am sure is not right, but I couldn't find a good explanation for it. This thread is the closest I got, but I can's say I fully understand the explanation there. If someone could elaborate, I will be grateful. Thank you! EDIT:

How to create prediction line for Quadratic Model

蹲街弑〆低调 提交于 2020-01-05 04:19:10
问题 I am trying to create a quadratic prediction line for a quadratic model. I am using the Auto dataset that comes with R. I had no trouble creating the prediction line for a linear model. However, the quadratic model yields crazy looking lines. Here is my code. # Linear Model plot(Auto$horsepower, Auto$mpg, main = "MPG versus Horsepower", pch = 20) lin_mod = lm(mpg ~ horsepower, data = Auto) lin_pred = predict(lin_mod) lines( Auto$horsepower, lin_pred, col = "blue", lwd = 2 ) # The Quadratic

gcloud ml-engine returns error on large files

浪尽此生 提交于 2020-01-04 07:18:12
问题 I have a trained model that takes in a somewhat large input. I generally do this as a numpy array of the shape (1,473,473,3). When I put that to JSON I end up getting about a 9.2MB file. Even if I convert that to a base64 encoding for the JSON file the input is still rather large. ml-engine predict rejects my request when sending the JSON file with the following error: (gcloud.ml-engine.predict) HTTP request failed. Response: { "error": { "code": 400, "message": "Request payload size exceeds

Role of frequency parameter in ts

前提是你 提交于 2020-01-04 02:35:31
问题 How does the ts() function use its frequency parameter? What is the effect of assigning wrong values as frequency ? I am trying to use 1.5 years of website usage data to build a time series model so that I can forecast the usage for coming periods. I am using data at daily level. What should be the frequency here - 7 or 365 or 365.25? 回答1: The frequency is "the" period at which seasonal cycles repeat. I use "the" in scare quotes since, of course, there are often multiple cycles in time series

Java, Weka: How to predict numeric attribute?

孤人 提交于 2020-01-01 09:57:14
问题 I was trying to use NaiveBayesUpdateable classifier from Weka. My data contains both nominal and numeric attributes: @relation cars @attribute country {FR, UK, ...} @attribute city {London, Paris, ...} @attribute car_make {Toyota, BMW, ...} @attribute price numeric %% car price @attribute sales numeric %% number of cars sold I need to predict the number of sales (numeric!) based on other attributes. I understand that I can not use numeric attribute for Bayes classification in Weka. One