Two .CSV Files: training and analyzing.

No need to pay, these is a helping forum and I only gave you basic generic advice. If you want to give back to the community, try helping others with what you've learned.

Thanks; I will. I may have a follow-up question on how to get the full output, but I am off to work now--thanks again.

Hello all.

I am trying to move to the next phase of this assignment. Below is the image the professor shared with me to know what I need to be able to code:

Screen Shot 2022-01-25 at 5.45.51 PM (1)

I tried:

my_linear_model <- lm(Bridge_Action ~ Age + Material + Deterioration + Water_Pillars + Traffic_Volume +Major_Repairs, data = Bridges)

and:

add_predictions(data, model, var ="pred", type = NULL)

Again I want to master this over time, but I need some guidance.

What you are showing on the image is just the model being printed on the console so if you want to get that output just type the name of the variable that stores your model and press enter.

Is there a reason why you used lm() while the professor used lda()?

Do you mean use predict() ?

I got this just now:

Bridge_Action
[1] "Monitor" "Schedule Repair/Replacement" "Monitor"
[4] "Schedule Assessment" "Schedule Assessment" "Schedule Repair/Replacement"
[7] "Monitor" "Monitor" "Monitor"
[10] "Monitor" "Monitor" "Schedule Repair/Replacement"
[13] "Schedule Repair/Replacement" "Schedule Assessment" "Monitor"
[16] "Monitor" "Schedule Repair/Replacement" "Monitor"
[19] "Monitor" "Monitor" "Schedule Assessment"
[22] "Schedule Assessment" "Schedule Assessment" "Schedule Assessment"
[25] "Schedule Repair/Replacement" "Schedule Assessment" "Monitor"
[28] "Monitor" "Monitor" "Monitor"
[31] "Monitor" "Monitor" "Monitor"
[34] "Monitor" "Monitor" "Schedule Repair/Replacement"
[37] "Monitor" "Monitor" "Immediate Repair/Replacement"
[40] "Monitor" "Monitor" "Monitor"
[43] "Schedule Repair/Replacement" "Monitor" "Schedule Repair/Replacement"
[46] "Monitor" "Monitor" "Schedule Assessment"
[49] "Schedule Repair/Replacement" "Monitor" "Monitor"
[52] "Schedule Repair/Replacement" "Monitor" "Schedule Assessment"
[55] "Schedule Assessment" "Monitor" "Monitor"
[58] "Schedule Repair/Replacement" "Schedule Assessment" "Schedule Assessment"
[61] "Schedule Repair/Replacement" "Immediate Repair/Replacement" "Schedule Repair/Replacement"
[64] "Monitor" "Monitor" "Schedule Assessment"
[67] "Schedule Assessment" "Monitor" "Monitor"
[70] "Schedule Assessment" "Schedule Assessment" "Schedule Repair/Replacement"
[73] "Monitor" "Schedule Assessment" "Monitor"
[76] "Monitor" "Monitor" "Monitor"
[79] "Monitor" "Schedule Repair/Replacement" "Schedule Repair/Replacement"
[82] "Schedule Assessment" "Monitor" "Monitor"
[85] "Monitor" "Monitor" "Monitor"
[88] "Monitor" "Schedule Repair/Replacement" "Schedule Assessment"
[91] "Schedule Assessment" "Schedule Assessment" "Monitor"
[94] "Immediate Repair/Replacement" "Monitor" "Monitor"
[97] "Schedule Repair/Replacement" "Monitor" "Schedule Repair/Replacement"
[100] "Immediate Repair/Replacement" "Monitor" "Monitor"
[103] "Schedule Repair/Replacement" "Schedule Repair/Replacement" "Immediate Repair/Replacement"
[106] "Monitor" "Monitor" "Monitor"
[109] "Monitor" "Monitor" "Schedule Assessment"
[112] "Schedule Repair/Replacement" "Schedule Assessment" "Schedule Repair/Replacement"
[115] "Monitor" "Monitor" "Schedule Repair/Replacement"
[118] "Monitor" "Monitor" "Monitor"
[121] "Schedule Assessment" "Schedule Assessment" "Schedule Repair/Replacement"
[124] "Schedule Repair/Replacement" "Schedule Assessment" "Schedule Repair/Replacement"
[127] "Monitor" "Immediate Repair/Replacement" "Immediate Repair/Replacement"
[130] "Immediate Repair/Replacement" "Monitor" "Schedule Assessment"
[133] "Monitor" "Schedule Assessment" "Monitor"
[136] "Schedule Repair/Replacement" "Schedule Repair/Replacement" "Monitor"
[139] "Monitor" "Monitor" "Schedule Assessment"
[142] "Monitor" "Schedule Assessment" "Schedule Assessment"
[145] "Monitor" "Monitor"

I tried this: table(BridgePred$class)
Error in table(BridgePred$class) : object 'BridgePred' not found

I used LDA originally, but thought it was not working so I tried other approaches--apologies for wasting your time on that one-

I'm confused by your question, what you are showing on the image you posted before are not classification predictions but just the model specification and you would get that output by literally typing the name of the model, so, in code, this is what I mean.

library(MASS)

Bridges <- read.csv("Bridges.csv", header = TRUE)

model_name <- lda(Bridge_Action ~ Age + Matrial + Deterioration + Water_Pillars + Traffic_Volume + Major_Repairs, data = Bridges)

# just type the model name and press enter
model_name

model name: Bridges correct?

Thanks. I see my error.

thank again! This a great discussion area for RStudio.

Have in mind that by naming the model the same as the original dataframe you have effectively eliminated the dataframe from your working environment, so you can no longer reference the original data on future commands.

Thanks-I missed 2 minor, but crucial syntactic requirements. Extremely minor--I will digress in this thread-I understand the stats parts.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.